Class UrlRedirectFilter
- All Implemented Interfaces:
javax.servlet.Filter
Forwarding is handled by RequestDispatcher.forward(ServletRequest, ServletResponse)
, so the url displayed to the user doesn't
change, but the internal handling of the request is according to the forwarded url
'prettified' in this context refers to calling CMSPages by either their 'alternative url' or the url of the static page they replace.
This filter needs to be placed in the filter chain before the PrettyFilter
because the PrettyFilter needs
to handle the actual CMSPage mapping (the PrettyFilter won't handle the request if it has been called already for this request, despite the
forward)
This filter also stores the called url to the session map using
ViewHistory.setCurrentView(ViewerPath, HttpSession)
. This is essential to leaving a view to return to a
previous view (for example when leaving the reading mode)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
void
doFilter
(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) Redirects prettified calls to cmsPages (either using alternative url or static url of a cmsPage) to the actual page url (The cmsPage pretty-url that is) Also stores the actually requested path in the current http session usingViewHistory.setCurrentView(ViewerPath, HttpSession)
void
init
(javax.servlet.FilterConfig arg0)
-
Constructor Details
-
UrlRedirectFilter
public UrlRedirectFilter()
-
-
Method Details
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException Redirects prettified calls to cmsPages (either using alternative url or static url of a cmsPage) to the actual page url (The cmsPage pretty-url that is) Also stores the actually requested path in the current http session usingViewHistory.setCurrentView(ViewerPath, HttpSession)
- Specified by:
doFilter
in interfacejavax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroy
in interfacejavax.servlet.Filter
-
init
public void init(javax.servlet.FilterConfig arg0) throws javax.servlet.ServletException - Specified by:
init
in interfacejavax.servlet.Filter
- Throws:
javax.servlet.ServletException
-