org.appng.core.controller.filter

## Class JspExtensionFilter

- java.lang.Object
- - org.appng.core.controller.filter.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 Summary

    Constructors
    Constructor and Description
    `JspExtensionFilter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `destroy()`
    `void` | `doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)`
    `protected String` | `doReplace(List<org.appng.core.controller.filter.RedirectFilter.RedirectRule> redirectRules, String sourcePath, String domain, String jspExtension, String content)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface javax.servlet.Filter

      `init`

- - ### 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)

    - #### destroy

          public void destroy()

      Specified by:
        `destroy` in interface `javax.servlet.Filter`

Copyright © 2011–2023 aiticon GmbH. All rights reserved.