public class GenericReverseProxyFilter extends Object implements javax.servlet.Filter
ReverseProxyService
injected.
Unlike servlets, servlet filters cannot know the filter mapping path prefix by itself.
So, this filter should be configured with filterPath
init parameters
in order to get the link rewriting and redirection done properly with the prefix.
For example, if this filter is mapped to '/rproxyfilter/*', then you should add an init parameter
like the following:
Constructor and Description |
---|
GenericReverseProxyFilter()
Zero-argument default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys this servlet filter.
|
void |
doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
Invokes the internal
ReverseProxyService on allowed HTTP requests. |
protected javax.servlet.FilterConfig |
getFilterConfig()
Returns the
FilterConfig of this servlet filter. |
protected String |
getFilterPath()
Returns the servlet filter mapping path prefix.
|
ReverseProxyService |
getProxyService()
Returns the internal
ReverseProxyService instance. |
protected String |
getRequestBasePath(javax.servlet.http.HttpServletRequest request)
Returns the concatenation of the servlet context path
(see
ServletContext.getContext(String)
and the filterPath (see getFilterPath() ). |
void |
init(javax.servlet.FilterConfig filterConfig)
Initializes this servlet filter.
|
void |
setProxyService(ReverseProxyService proxyService)
Sets the internal
ReverseProxyService instance. |
public GenericReverseProxyFilter()
public ReverseProxyService getProxyService()
ReverseProxyService
instance.public void setProxyService(ReverseProxyService proxyService)
ReverseProxyService
instance.proxyService
- public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
ReverseProxyService
on allowed HTTP requests.doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
public void destroy()
destroy
in interface javax.servlet.Filter
protected javax.servlet.FilterConfig getFilterConfig()
FilterConfig
of this servlet filter.protected String getFilterPath()
protected String getRequestBasePath(javax.servlet.http.HttpServletRequest request)
ServletContext.getContext(String)
and the filterPath (see getFilterPath()
).Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.