public class WicketFilter extends Object implements javax.servlet.Filter
The advantage of a filter is that, unlike a servlet, it can choose not to process the request and let whatever is next in chain try. So when using a Wicket filter and a request comes in for foo.gif the filter can choose not to process it because it knows it is not a wicket-related request. Since the filter didn't process it, it falls on to the application server to try, and then it works."
for documentation| Modifier and Type | Field and Description |
|---|---|
static String |
APP_FACT_PARAM
The name of the context parameter that specifies application factory class
|
static String |
FILTER_MAPPING_PARAM
The name of the root path parameter that specifies the root dir of the app.
|
static String |
IGNORE_PATHS_PARAM
Name of parameter used to express a comma separated list of paths that should be ignored
|
| Constructor and Description |
|---|
WicketFilter()
default constructor, usually invoked through the servlet container by the web.xml
configuration
|
WicketFilter(WebApplication application)
constructor supporting programmatic setup of the filter
this can be useful for programmatically creating and appending the wicket filter to the
servlet context using servlet 3 features.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
checkIfRedirectRequired(String requestURI,
String contextPath)
Try to determine as fast as possible if a redirect is necessary
|
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain) |
protected WebApplication |
getApplication() |
protected IWebApplicationFactory |
getApplicationFactory()
Creates the web application factory instance.
|
protected ClassLoader |
getClassLoader() |
javax.servlet.FilterConfig |
getFilterConfig() |
String |
getFilterPath()
Provide a standard getter for filterPath.
|
protected String |
getFilterPath(javax.servlet.http.HttpServletRequest request)
Either get the filterPath retrieved from web.xml, or if not found the old (1.3) way via a
filter mapping param.
|
protected String |
getFilterPathFromAnnotation(boolean isServlet)
Stub method that lets subclasses configure filter path from annotations.
|
protected String |
getFilterPathFromConfig(javax.servlet.FilterConfig filterConfig) |
protected String |
getFilterPathFromWebXml(boolean isServlet,
javax.servlet.FilterConfig filterConfig) |
String |
getRelativePath(javax.servlet.http.HttpServletRequest request)
Returns a relative path to the filter path and context root from an HttpServletRequest - use
this to resolve a Wicket request.
|
void |
init(boolean isServlet,
javax.servlet.FilterConfig filterConfig)
Servlets and Filters are treated essentially the same with Wicket.
|
void |
init(javax.servlet.FilterConfig filterConfig)
If you do have a need to subclass, you may subclass
init(boolean, FilterConfig) |
protected boolean |
processRequestCycle(RequestCycle requestCycle,
WebResponse webResponse,
javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
javax.servlet.FilterChain chain)
Process the request cycle
|
void |
setFilterPath(String filterPath)
Sets the filter path instead of reading it from web.xml.
|
public static final String FILTER_MAPPING_PARAM
public static final String APP_FACT_PARAM
public static final String IGNORE_PATHS_PARAM
public WicketFilter()
public WicketFilter(WebApplication application)
application - web applicationprotected ClassLoader getClassLoader()
protected boolean processRequestCycle(RequestCycle requestCycle, WebResponse webResponse, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
requestCycle - webResponse - httpServletRequest - httpServletResponse - chain - IOExceptionjavax.servlet.ServletExceptionpublic void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
throws IOException,
javax.servlet.ServletException
doFilter in interface javax.servlet.FilterIOExceptionjavax.servlet.ServletExceptionFilter.doFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse, javax.servlet.FilterChain)protected IWebApplicationFactory getApplicationFactory()
ContextParamWebApplicationFactorypublic final void init(javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
init(boolean, FilterConfig)init in interface javax.servlet.Filterjavax.servlet.ServletExceptionFilter.init(javax.servlet.FilterConfig)public void init(boolean isServlet,
javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
isServlet - True if Servlet, false if FilterfilterConfig - javax.servlet.ServletExceptioninit(FilterConfig)protected String getFilterPathFromAnnotation(boolean isServlet)
isServlet - protected String getFilterPathFromWebXml(boolean isServlet, javax.servlet.FilterConfig filterConfig)
isServlet - filterConfig - public javax.servlet.FilterConfig getFilterConfig()
protected String getFilterPath(javax.servlet.http.HttpServletRequest request)
request - public String getFilterPath()
protected String getFilterPathFromConfig(javax.servlet.FilterConfig filterConfig)
filterConfig - public void destroy()
destroy in interface javax.servlet.FilterFilter.destroy()protected final String checkIfRedirectRequired(String requestURI, String contextPath)
requestURI - contextPath - public final void setFilterPath(String filterPath)
filterPath - public String getRelativePath(javax.servlet.http.HttpServletRequest request)
request - protected WebApplication getApplication()
Copyright © 2006–2021 Apache Software Foundation. All rights reserved.