public final class RedirectFilter extends Object implements javax.servlet.Filter, Serializable
The redirect mapping can be specified as below:
<?xml version="1.0" encoding="utf-8"?>
<redirect-mapping>
<redirect from="/" to="/html/home"/>
<redirect from="/index.html" to="/html/home"/>
<redirect from="/html" to="/html/home"/>
<redirect from="/xml" to="/xml/home"/>
<redirect from="/{+path}.psml" to="/html/{+path}"/>
</redirect-mapping>
All redirects are currently temporary (302) unless the attribute 'permanent' is set to 'yes' in which case the HTTP code will be 301
See #init(javax.servlet.ServletConfig)
for details for configuration options.
Constructor and Description |
---|
RedirectFilter() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain) |
void |
doHTTPFilter(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
javax.servlet.FilterChain chain)
Do the filtering for a HTTP request.
|
void |
init(javax.servlet.FilterConfig config)
Initialises the Redirector Servlet.
|
public void init(javax.servlet.FilterConfig config)
This servlet accepts the following init parameters:
config
path to the URI redirect mapping XML file (eg. '/config/redirect.xml')
init
in interface javax.servlet.Filter
config
- The filter configuration.Servlet.init(javax.servlet.ServletConfig)
public void destroy()
destroy
in interface javax.servlet.Filter
public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws javax.servlet.ServletException, IOException
doFilter
in interface javax.servlet.Filter
javax.servlet.ServletException
IOException
public void doHTTPFilter(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, javax.servlet.FilterChain chain) throws javax.servlet.ServletException, IOException
req
- The HTTP servlet request.res
- The HTTP servlet response.chain
- The filter chain.IOException
- Should an error occurs while writing the response.javax.servlet.ServletException
- If thrown by the filter chain.Copyright © 2016 Allette Systems. All rights reserved.