public class XmlCleaningResponseFilter extends Object implements IResponseFilter
If the application needs to use it for other use cases then it can either override shouldFilter(AppendingStringBuffer) in the case it is used as IResponseFilter or stripNonValidXMLCharacters(AppendingStringBuffer) can be used directly.
Usage:
MyApplication.java
public void init() {
super.init();
getRequestCycleSettings().addResponseFilter(new XmlCleaningResponseFilter());
}
Constructor and Description |
---|
XmlCleaningResponseFilter() |
Modifier and Type | Method and Description |
---|---|
AppendingStringBuffer |
filter(AppendingStringBuffer responseBuffer)
Filters the response buffer and returns the filtered response that can be used in the next
filter or returned to the real output itself.
|
protected boolean |
isValidXmlChar(int codePoint)
Checks whether the character represented by this codePoint is
a valid in XML documents.
|
protected boolean |
shouldFilter(AppendingStringBuffer responseBuffer)
Decides whether the filter should be applied.
|
AppendingStringBuffer |
stripNonValidXMLCharacters(AppendingStringBuffer input)
This method ensures that the output String has only
valid XML unicode characters as specified by the
XML 1.0 standard.
|
public AppendingStringBuffer filter(AppendingStringBuffer responseBuffer)
IResponseFilter
filter
in interface IResponseFilter
responseBuffer
- The response buffer to be filteredprotected boolean shouldFilter(AppendingStringBuffer responseBuffer)
responseBuffer
- The buffer to filtertrue
if the buffer brings Ajax responsepublic AppendingStringBuffer stripNonValidXMLCharacters(AppendingStringBuffer input)
input
- The StringBuffer whose non-valid characters we want to remove.protected boolean isValidXmlChar(int codePoint)
codePoint
- The codePoint for the checked charactertrue
if the character can be used in XML documentsCopyright © 2006–2016 Apache Software Foundation. All rights reserved.