Class RegexGroupFilter

  • All Implemented Interfaces:
    javax.servlet.Filter

    public class RegexGroupFilter
    extends java.lang.Object
    implements javax.servlet.Filter
    Switch servlet path and path info to use another regex match group.

    This filter is meant to be installed in the middle of a pipeline created by MetaServlet.serveRegex(String). The passed request's servlet path is updated to be all text up to the start of the designated capture group, and the path info is changed to the contents of the capture group.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int groupIdx  
    • Constructor Summary

      Constructors 
      Constructor Description
      RegexGroupFilter​(int groupIdx)
      Constructor for RegexGroupFilter
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroy()
      void doFilter​(javax.servlet.ServletRequest request, javax.servlet.ServletResponse rsp, javax.servlet.FilterChain chain)
      private static WrappedRequest[] groupsFor​(javax.servlet.ServletRequest r)  
      void init​(javax.servlet.FilterConfig config)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • groupIdx

        private final int groupIdx
    • Constructor Detail

      • RegexGroupFilter

        public RegexGroupFilter​(int groupIdx)
        Constructor for RegexGroupFilter
        Parameters:
        groupIdx - capture group number, 1 through the number of groups.
    • Method Detail

      • init

        public void init​(javax.servlet.FilterConfig config)
                  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
      • doFilter

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

        private static WrappedRequest[] groupsFor​(javax.servlet.ServletRequest r)