Module com.aoapps.servlet.filter
Package com.aoapps.servlet.filter
Class StripInvalidXmlCharactersFilter
java.lang.Object
com.aoapps.servlet.filter.StripInvalidXmlCharactersFilter
- All Implemented Interfaces:
Filter
Strips all invalid XML characters on incoming parameters.
GET requests on the
DispatcherType.REQUEST dispatcher will be 301-redirected to the same URL without the invalid XML characters.
All other methods and all other dispatchers, including POST requests, will have the invalid XML characters stripped.
Parameters with invalid names are removed.
This implementation supports UTF-16 surrogate pairs: https://wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates
The allowed characters defined by the specification at https://www.w3.org/TR/xml/#charsets:
Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
Only HTTP/HTTPS requests are filtered.
This should be used for both the DispatcherType.REQUEST and DispatcherType.ERROR dispatchers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()voiddoFilter(ServletRequest request, ServletResponse response, FilterChain chain) voidinit(FilterConfig config)
-
Constructor Details
-
StripInvalidXmlCharactersFilter
public StripInvalidXmlCharactersFilter()
-
-
Method Details
-
init
-
doFilter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException - Specified by:
doFilterin interfaceFilter- Throws:
IOExceptionServletException
-
destroy
public void destroy()
-
