public class RegexGroupFilter
extends java.lang.Object
implements javax.servlet.Filter
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.
Modifier and Type | Field and Description |
---|---|
private int |
groupIdx |
Constructor and Description |
---|
RegexGroupFilter(int groupIdx)
Constructor for RegexGroupFilter
|
Modifier and Type | Method and 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) |
public RegexGroupFilter(int groupIdx)
groupIdx
- capture group number, 1 through the number of groups.public void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
public void destroy()
destroy
in interface javax.servlet.Filter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse rsp, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
java.io.IOException
javax.servlet.ServletException
private static WrappedRequest[] groupsFor(javax.servlet.ServletRequest r)