Class FqdnForwardFilter

java.lang.Object
alpine.server.filters.FqdnForwardFilter
All Implemented Interfaces:
javax.servlet.Filter

public final class FqdnForwardFilter extends Object implements javax.servlet.Filter
FqdnForwardFilter is a configurable Servlet Filter that can forward requests made to a hostname or IP address to another host via a 301 redirect. The primary use case for this filter is in conjunction with TLS hostname verification. Sample usage:
 <filter>
   <filter-name>FqdnForwardFilter</filter-name>
   <filter-class>alpine.filters.FqdnForwardFilter</filter-class>
   <init-param>
     <param-name>host</param-name>
     <param-value>www.example.com</param-value>
   </init-param>
 </filter>

 <filter-mapping>
   <filter-name>FqdnForwardFilter</filter-name>
   <url-pattern>/*</url-pattern>
 </filter-mapping>

 
Since:
1.0.0
Author:
Steve Springett
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    void
    doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
    Forward requests.....
    void
    init(javax.servlet.FilterConfig filterConfig)
    Initialize "host" parameter from web.xml.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FqdnForwardFilter

      public FqdnForwardFilter()
  • Method Details

    • init

      public void init(javax.servlet.FilterConfig filterConfig)
      Initialize "host" parameter from web.xml.
      Specified by:
      init in interface javax.servlet.Filter
      Parameters:
      filterConfig - A filter configuration object used by a servlet container to pass information to a filter during initialization.
    • doFilter

      public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
      Forward requests.....
      Specified by:
      doFilter in interface javax.servlet.Filter
      Parameters:
      request - The request object.
      response - The response object.
      chain - Refers to the FilterChain object to pass control to the next Filter.
      Throws:
      IOException - a IOException
      javax.servlet.ServletException - a ServletException
    • destroy

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