org.apache.hadoop.lib.servlet
Class MDCFilter

java.lang.Object
  extended by org.apache.hadoop.lib.servlet.MDCFilter
All Implemented Interfaces:
javax.servlet.Filter

@InterfaceAudience.Private
public class MDCFilter
extends Object
implements javax.servlet.Filter

Filter that sets request contextual information for the slf4j MDC.

It sets the following values:


Constructor Summary
MDCFilter()
           
 
Method Summary
 void destroy()
          Destroys the filter.
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          Sets the slf4j MDC and delegates the request to the chain.
 void init(javax.servlet.FilterConfig config)
          Initializes the filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MDCFilter

public MDCFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig config)
          throws javax.servlet.ServletException
Initializes the filter.

This implementation is a NOP.

Specified by:
init in interface javax.servlet.Filter
Parameters:
config - filter configuration.
Throws:
javax.servlet.ServletException - thrown if the filter could not be initialized.

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws IOException,
                     javax.servlet.ServletException
Sets the slf4j MDC and delegates the request to the chain.

Specified by:
doFilter in interface javax.servlet.Filter
Parameters:
request - servlet request.
response - servlet response.
chain - filter chain.
Throws:
IOException - thrown if an IO error occurrs.
javax.servlet.ServletException - thrown if a servet error occurrs.

destroy

public void destroy()
Destroys the filter.

This implementation is a NOP.

Specified by:
destroy in interface javax.servlet.Filter


Copyright © 2014 Apache Software Foundation. All Rights Reserved.