title: Verify header before request receive in tomcat
body: <p>I need verify header before receive the request. I found that tomcat valve can help in it. I follow  these steps but valve is not called:</p>
  
  <ol>
  <li><p>make a maven project and do this code in it.</p>
  
  <pre>
  package cz.ValveTest;
  
  import java.io.IOException;
  import java.util.Enumeration;
  import java.util.logging.Level;
  import java.util.logging.Logger;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  
  import org.apache.catalina.connector.Request;
  import org.apache.catalina.connector.Response;
  import org.apache.catalina.valves.ValveBase;
  
  public class ProcessingValve  extends ValveBase {
  
  private static final Logger logger = Logger.getLogger(ProcessingValve.class.getName());
  
  @Override
  public void invoke(Request request, Response response) throws IOException,
          ServletException {
  
  <pre><code>HttpServletRequest httpServletRequest = request.getRequest();
  
   Enumeration&lt;String&gt; headerNames = httpServletRequest.getHeaderNames();
   logger.info("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
  </code></pre>
  
   while (headerNames.hasMoreElements()) {
           String header = headerNames.nextElement();
           logger.log(Level.INFO, "Header --> {0} Value --> {1}", new Object[]{header, httpServletRequest.getHeader(header)});
         }
  
  <pre><code>  getNext().invoke(request, response);  
  </code></pre>
  
  }
  }
  </pre></li>
  <li><p>make jar and put jar inside tomcat/lib folder </p></li>
  <li><p>add this line in server.xml</p>
  
  <pre><code>&lt;valve className="cz.ValveTest.ProcessingValve"/&gt;
  </code></pre></li>
  <li><p>restart tomcat.</p></li>
  <li><p>Now I hit my  web service with header:</p>
  
  <blockquote>
    <p>Expect : 100-continue</p>
  </blockquote></li>
  </ol>
  
  <p>but using this configuration and code valve is not called on http hit.If any one knew why tomcat valve is not called please help.</p>