java.lang.Object
com.aoapps.servlet.filter.EncodeURIFilter
- All Implemented Interfaces:
Filter
Encodes the URL to either
RFC 3986 URI US-ASCII format
or RFC 3987 IRI Unicode format.
If the URL begins with
javascript:
, cid:
, or data:
,
(case-insensitive) it is not altered.
Canonical URLs are always encoded to US-ASCII format.
IRI support is disabled by default, and only recommended for development or internal systems. IRI may result in slightly smaller output, and more readable HTML source, but for interoperability should be off in production systems.
RFC 7231 - 7.1.2. Location refers only to RFC 3986 URI for URI-reference, thus redirects are always formatted as RFC 3986 URI.
This should be used for both the DispatcherType.REQUEST
and DispatcherType.ERROR
dispatchers.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
void
doFilter
(ServletRequest request, ServletResponse response, FilterChain chain) Performs encoding on the given URL in the given response encoding.Deprecated.static EncodeURIFilter
getActiveFilter
(ServletRequest request) Gets the filter active on the given request.void
init
(FilterConfig config)
-
Constructor Details
-
EncodeURIFilter
public EncodeURIFilter()
-
-
Method Details
-
getActiveFilter
Gets the filter active on the given request.- Returns:
- The currently active filter or
null
for none active.
-
init
-
encode
Performs encoding on the given URL in the given response encoding. -
encode
Deprecated.Please provide the currentDoctype
so can be enabled selectively viaDoctype.getSupportsIRI()
.Performs encoding on the given URL in the given response encoding. -
doFilter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException - Specified by:
doFilter
in interfaceFilter
- Throws:
IOException
ServletException
-
destroy
public void destroy()
-
Doctype
so can be enabled selectively viaDoctype.getSupportsIRI()
.