Appendix C. BadInputValve.java

This appendix gives the full source code to BadInputValve.java, which we introduced and detailed in Chapter 6. You can download Appendix C from this book's web site at http://www.oreilly.com/catalog/9780596101060.

Example C-1. BadInputValve.java

/* * $Revision$ * $Date$ * * Copyright (c) 2007 O'Reilly Media. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You may * obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.oreilly.tomcat.valve; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.servlet.ServletException; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.catalina.util.ParameterMap; import org.apache.catalina.valves.RequestFilterValve; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; ...

Get Tomcat: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.