Class UrlRedirectFilter

java.lang.Object
io.goobi.viewer.filters.UrlRedirectFilter
All Implemented Interfaces:
javax.servlet.Filter

public class UrlRedirectFilter extends Object implements javax.servlet.Filter
Filter for redirecting prettified calls to cmsPages

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 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 using ViewHistory.setCurrentView(ViewerPath, HttpSession)
      Specified by:
      doFilter in interface javax.servlet.Filter
      Throws:
      IOException
      javax.servlet.ServletException
    • destroy

      public void destroy()
      Specified by:
      destroy in interface javax.servlet.Filter
    • init

      public void init(javax.servlet.FilterConfig arg0) throws javax.servlet.ServletException
      Specified by:
      init in interface javax.servlet.Filter
      Throws:
      javax.servlet.ServletException