Class JspExtensionFilter

  • All Implemented Interfaces:
    javax.servlet.Filter

    public class JspExtensionFilter
    extends Object
    implements javax.servlet.Filter
    A Filter that performs a search-and-replace on the given content of the ServletResponse.
    It searches for paths (relative or absolute paths that match the Site's domain) that end with ".jsp" (respectively the configured file ending for JSPs) and removes the ".jsp" ending from that path.
    Before:
     <a href="/en/contact.jsp">Contact</a>
     <a href="http://foobar.org/en/index.jsp">Index</a>
     <a href="http://example.com/index.jsp">Example</a>
     
    After, assuming the site's domain is 'http://foobar.org':
     <a href="/en/contact">Contact</a>
     <a href="http://foobar.org/en/index">Index</a>
     <a href="http://example.com/index.jsp">Example</a>
     
    Author:
    Matthias Herlitzius, Matthias Müller
    • Constructor Detail

      • JspExtensionFilter

        public JspExtensionFilter()
    • Method Detail

      • doFilter

        public void doFilter​(javax.servlet.ServletRequest request,
                             javax.servlet.ServletResponse response,
                             javax.servlet.FilterChain chain)
                      throws IOException,
                             javax.servlet.ServletException
        Specified by:
        doFilter in interface javax.servlet.Filter
        Throws:
        IOException
        javax.servlet.ServletException
      • doReplace

        protected String doReplace​(List<org.appng.core.controller.filter.RedirectFilter.RedirectRule> redirectRules,
                                   String sourcePath,
                                   String domain,
                                   String jspExtension,
                                   String content)
      • init

        public void init​(javax.servlet.FilterConfig filterConfig)
                  throws javax.servlet.ServletException
        Specified by:
        init in interface javax.servlet.Filter
        Throws:
        javax.servlet.ServletException
      • destroy

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