public class WebFilter extends Object implements javax.servlet.Filter
Filter
to associate the current Web context with the current thread.
You need to setup this filter and WebListener
in the web.xml
as below if you use Jaguar in Web environment:
<filter> <filter-name>webFilter</filter-name> <filter-class>org.eiichiro.jaguar.WebFilter</filter-class> </filter> <filter-mapping> <filter-name>webFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
Constructor and Description |
---|
WebFilter() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
no-op.
|
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
Associates the current HTTP servlet request with the current thread until
filter chain ends.
|
void |
init(javax.servlet.FilterConfig filterConfig)
no-op.
|
static javax.servlet.http.HttpServletRequest |
request()
Returns the HTTP servlet request associated with the current thread.
|
static void |
request(javax.servlet.http.HttpServletRequest request)
Associates the specified HTTP servlet request to the current thread.
|
static javax.servlet.http.HttpSession |
session()
Returns the HTTP session associated with the current thread.
|
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
filterConfig
- FilterConfig
to initialize this filter.javax.servlet.ServletException
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
request
- The current ServletRequest
.response
- The current ServletResponse
.chain
- The current FilterChain
.IOException
javax.servlet.ServletException
public void destroy()
destroy
in interface javax.servlet.Filter
public static javax.servlet.http.HttpServletRequest request()
public static void request(javax.servlet.http.HttpServletRequest request)
request
- The HTTP servlet request to be associated to the current
thread.public static javax.servlet.http.HttpSession session()
Copyright © 2011-2014 Eiichiro Uchiumi. All Rights Reserved.