To use it, add the following lines to a web.xml file
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | destroy()
Overrides default jakarta. Called by the web container to indicate to a filter that it is being taken out of service. |
| public void | doFilter(ServletRequest
the request, ServletResponse ServletRequest object contains the client's requestthe response, FilterChain ServletResponse object contains the filter's responsethe chain)FilterChain for invoking the next filter or the resourceImplements jakarta. doFilter method of the Filter is called by the container each time a request/response pair is passed
through the chain due to a client request for a resource at the end of the chain.
|
| public void | init(FilterConfig
a arg0)FilterConfig object containing the filter's configuration and initialization
parametersOverrides default jakarta. Called by the web container to indicate to a filter that it is being placed into service. |
| LoggerContextFilter | back to summary |
|---|---|
| public LoggerContextFilter() | |
| destroy | back to summary |
|---|---|
| public void destroy() Overrides default jakarta. Doc from jakarta. Called by the web container to indicate to a filter that it is being taken out of service. This method is only called once all threads within the filter's doFilter method have exited or after a timeout period has passed. After the web container calls this method, it will not call the doFilter method again on this instance of the filter. This method gives the filter an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the filter's current state in memory. | |
| doFilter | back to summary |
|---|---|
| public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException Implements jakarta. Doc from jakarta. The A typical implementation of this method would follow the following pattern:
| |
| init | back to summary |
|---|---|
| public void init(FilterConfig arg0) throws ServletException Overrides default jakarta. Doc from jakarta. Called by the web container to indicate to a filter that it is being placed into service.
The servlet container calls the init method exactly once after instantiating the filter. The init method must
complete successfully before the filter is asked to do any filtering work. The container will ensure that actions
performed in the The web container cannot place the filter into service if the init method either
| |