|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.webapps.servlets.filters.FilterCore org.dlese.dpc.webapps.servlets.filters.XMLPostProcessingFilter
public class XMLPostProcessingFilter
Performs post-processing of an XML stream and gzips the response if supported by the browser. Supported post-processing actions include XML validation, XML transform to localized XML, and XML to JSON serialization.
The XML validation is implemented using a servlet response Filter that checks the content for validity against an XML schema or DTD, which must be referenced in the content itself.
The JSON serialization is implemented using the json.org XML serializer and appropriate classes must be included in your classpath. See http://www.json.org/javadoc/ .
Constructor Summary | |
---|---|
XMLPostProcessingFilter()
|
Method Summary | |
---|---|
void |
destroy()
Destroy is called at application shut-down time. |
void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
Performs XML post-processing and gzipping of the response. |
protected String |
getValidationMessage(String xml,
ServletRequest request)
Validate the provided xml and return a validation message. |
void |
init(FilterConfig config)
Init is called once at application start-up. |
protected void |
prtln(String s)
Output a line of text to standard out, with datestamp, if debug is set to true. |
protected void |
prtlnErr(String s)
Output a line of text to error out, with datestamp. |
protected void |
setDebugz(boolean db)
Sets the debug attribute of the XMLPostProcessingFilter object |
protected String |
xmlToHtml(String xml)
Get html-displayable version of provided xml |
Methods inherited from class org.dlese.dpc.webapps.servlets.filters.FilterCore |
---|
getDateStamp, handleErrorCodes, isGzipSupported, prtlnCore, writeGzipResponse, writeRegularResponse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLPostProcessingFilter()
Method Detail |
---|
public final void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException
request
- The requestresponse
- The responsechain
- The chain of Filters
ServletException
- Iff error
IOException
- Iff IO errorprotected String getValidationMessage(String xml, ServletRequest request)
xml
- XML string to be validated
protected String xmlToHtml(String xml)
xml
- xml to be displayed as html
public void init(FilterConfig config) throws ServletException
config
- The FilterConfig object that holds the ServletContext and init information.
ServletException
- If an error occurspublic void destroy()
protected final void prtlnErr(String s)
s
- The text that will be output to error out.protected void prtln(String s)
s
- The String that will be output.protected final void setDebugz(boolean db)
db
- The new debug value
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |