craigmcc    01/01/22 18:53:04

  Modified:    catalina/src/share/org/apache/catalina/authenticator
                        AuthenticatorBase.java SingleSignOn.java
               catalina/src/share/org/apache/catalina/valves
                        AccessLogValve.java CertificatesValve.java
                        RemoteAddrValve.java RemoteHostValve.java
                        RequestDumperValve.java RequestFilterValve.java
                        ValveBase.java
  Log:
  Fourth of four commits for the Valves API changes.
  
  Update all existing Valve implementations to reflect the new API changes.
  
  Revision  Changes    Path
  1.7       +20 -17    
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java
  
  Index: AuthenticatorBase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AuthenticatorBase.java    2000/12/16 01:42:46     1.6
  +++ AuthenticatorBase.java    2001/01/23 02:53:02     1.7
  @@ -1,13 +1,13 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java,v
 1.6 2000/12/16 01:42:46 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2000/12/16 01:42:46 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java,v
 1.7 2001/01/23 02:53:02 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/01/23 02:53:02 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -92,6 +92,7 @@
   import org.apache.catalina.Response;
   import org.apache.catalina.Session;
   import org.apache.catalina.Valve;
  +import org.apache.catalina.ValveContext;
   import org.apache.catalina.deploy.LoginConfig;
   import org.apache.catalina.deploy.SecurityConstraint;
   import org.apache.catalina.util.LifecycleSupport;
  @@ -116,7 +117,7 @@
    * requests.  Requests of any other type will simply be passed through.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2000/12/16 01:42:46 $
  + * @version $Revision: 1.7 $ $Date: 2001/01/23 02:53:02 $
    */
   
   
  @@ -393,22 +394,25 @@
        *
        * @param request Request to be processed
        * @param response Response to be processed
  +     * @param context The valve context used to invoke the next valve
  +     *  in the current processing pipeline
        *
        * @exception IOException if an input/output error occurs
        * @exception ServletException if thrown by a processing element
        */
  -    public void invoke(Request request, Response response)
  +    public void invoke(Request request, Response response,
  +                       ValveContext context)
        throws IOException, ServletException {
   
        // If this is not an HTTP request, do nothing
        if (!(request instanceof HttpRequest) ||
               !(response instanceof HttpResponse)) {
  -         invokeNext(request, response);
  +         context.invokeNext(request, response);
            return;
        }
        if (!(request.getRequest() instanceof HttpServletRequest) ||
            !(response.getResponse() instanceof HttpServletResponse)) {
  -         invokeNext(request, response);
  +         context.invokeNext(request, response);
            return;
        }
        HttpRequest hrequest = (HttpRequest) request;
  @@ -417,7 +421,7 @@
            log("Security checking request " +
                ((HttpServletRequest) request.getRequest()).getMethod() + " " +
                ((HttpServletRequest) request.getRequest()).getRequestURI());
  -     LoginConfig config = context.getLoginConfig();
  +     LoginConfig config = this.context.getLoginConfig();
   
           // Have we got a cached authenticated Principal to record?
           if (cache) {
  @@ -443,7 +447,7 @@
        // Special handling for form-based logins to deal with the case
        // where the login form (and therefore the "j_security_check" URI
        // to which it submits) might be outside the secured area
  -     String contextPath = context.getPath();
  +     String contextPath = this.context.getPath();
        String requestURI =
            ((HttpServletRequest) request.getRequest()).getRequestURI();
        if (requestURI.startsWith(contextPath) &&
  @@ -461,7 +465,7 @@
            (!Constants.FORM_METHOD.equals(config.getAuthMethod())) */ ) {
            if (debug >= 1)
                log(" Not subject to any constraint");
  -         invokeNext(request, response);
  +         context.invokeNext(request, response);
            return;
        }
        if ((debug >= 1) && (constraint != null))
  @@ -498,7 +502,7 @@
        // Any and all specified constraints have been satisfied
        if (debug >= 1)
            log(" Successfully passed all security constraints");
  -     invokeNext(request, response);
  +     context.invokeNext(request, response);
   
       }
   
  @@ -952,13 +956,12 @@
                   parent = parent.getParent();
                   continue;
               }
  -            Valve valve = ((Pipeline) parent).findValves();
  -            while ((sso == null) && (valve != null)) {
  -                if (valve instanceof SingleSignOn) {
  -                    sso = (SingleSignOn) valve;
  +            Valve valves[] = ((Pipeline) parent).getValves();
  +            for (int i = 0; i < valves.length; i++) {
  +                if (valves[i] instanceof SingleSignOn) {
  +                    sso = (SingleSignOn) valves[i];
                       break;
                   }
  -                valve = valve.getNext();
               }
               if (sso == null)
                   parent = parent.getParent();
  
  
  
  1.4       +14 -10    
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java
  
  Index: SingleSignOn.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SingleSignOn.java 2000/12/17 01:05:39     1.3
  +++ SingleSignOn.java 2001/01/23 02:53:03     1.4
  @@ -1,13 +1,13 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java,v
 1.3 2000/12/17 01:05:39 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/12/17 01:05:39 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java,v
 1.4 2001/01/23 02:53:03 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/01/23 02:53:03 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -77,6 +77,7 @@
   import org.apache.catalina.Logger;
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
  +import org.apache.catalina.ValveContext;
   import org.apache.catalina.valves.ValveBase;
   import org.apache.catalina.util.StringManager;
   
  @@ -99,7 +100,7 @@
    * </ul>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2000/12/17 01:05:39 $
  + * @version $Revision: 1.4 $ $Date: 2001/01/23 02:53:03 $
    */
   
   public class SingleSignOn
  @@ -179,17 +180,20 @@
        *
        * @param request The servlet request we are processing
        * @param response The servlet response we are creating
  +     * @param context The valve context used to invoke the next valve
  +     *  in the current processing pipeline
        *
        * @exception IOException if an input/output error occurs
        * @exception ServletException if a servlet error occurs
        */
  -    public void invoke(Request request, Response response)
  +    public void invoke(Request request, Response response,
  +                       ValveContext context)
           throws IOException, ServletException {
   
           // If this is not an HTTP request and response, just pass them on
           if (!(request instanceof HttpRequest) ||
               !(response instanceof HttpResponse)) {
  -            invokeNext(request, response);
  +            context.invokeNext(request, response);
               return;
           }
   
  @@ -202,7 +206,7 @@
               if (debug >= 1)
                   log(" Principal '" + hreq.getUserPrincipal().getName() +
                       "' has already been authenticated");
  -            invokeNext(request, response);
  +            context.invokeNext(request, response);
               return;
           }
   
  @@ -222,7 +226,7 @@
           if (cookie == null) {
               if (debug >= 1)
                   log(" SSO cookie is not present");
  -            invokeNext(request, response);
  +            context.invokeNext(request, response);
               return;
           }
   
  @@ -243,7 +247,7 @@
           }
   
           // Invoke the next Valve in our pipeline
  -        invokeNext(request, response);
  +        context.invokeNext(request, response);
   
       }
   
  
  
  
  1.4       +17 -13    
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java
  
  Index: AccessLogValve.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AccessLogValve.java       2001/01/11 03:51:53     1.3
  +++ AccessLogValve.java       2001/01/23 02:53:03     1.4
  @@ -3,7 +3,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -80,20 +80,21 @@
   import org.apache.catalina.LifecycleListener;
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
  +import org.apache.catalina.ValveContext;
   import org.apache.catalina.util.LifecycleSupport;
   import org.apache.catalina.util.StringManager;
   
   
   /**
  - * Implementation of the <b>Valve</b> interface that generates a web server
  + * <p>Implementation of the <b>Valve</b> interface that generates a web server
    * access log with the detailed line contents matching a configurable pattern.
    * The syntax of the available patterns is similar to that supported by the
    * Apache <code>mod_log_config</code> module.  As an additional feature,
  - * automatic rollover of log files when the date changes is also supported.
  - * <p>
  - * Patterns for the logged message may include constant text or any of the
  + * automatic rollover of log files when the date changes is also supported.</p>
  + *
  + * <p>Patterns for the logged message may include constant text or any of the
    * following replacement strings, for which the corresponding information
  - * from the specified Response is substituted:
  + * from the specified Response is substituted:</p>
    * <ul>
    * <li><b>%a</b> - Remote IP address
    * <li><b>%A</b> - Local IP address
  @@ -114,18 +115,18 @@
    * <li><b>%U</b> - Requested URL path
    * <li><b>%v</b> - Local server name
    * </ul>
  - * In addition, the caller can specify one of the following aliases for
  - * commonly utilized patterns:
  + * <p>In addition, the caller can specify one of the following aliases for
  + * commonly utilized patterns:</p>
    * <ul>
    * <li><b>common</b> - <code>%h %l %u %t "%r" %s %b</code>
    * </ul>
    *
  - * <b>FIXME</b> - Improve the parsing so that things like <code>%{xxx}i</code>
  - * can be implemented.
  + * <p><b>FIXME</b> - Improve the parsing so that things like
  + * <code>%{xxx}i</code> can be implemented.</p>
    *
    * @author Craig R. McClanahan
    * @author Jason Brittain
  - * @version $Revision: 1.3 $ $Date: 2001/01/11 03:51:53 $
  + * @version $Revision: 1.4 $ $Date: 2001/01/23 02:53:03 $
    */
   
   public final class AccessLogValve
  @@ -403,15 +404,18 @@
        *
        * @param request Request being processed
        * @param response Response being processed
  +     * @param context The valve context used to invoke the next valve
  +     *  in the current processing pipeline
        *
        * @exception IOException if an input/output error has occurred
        * @exception ServletException if a servlet error has occurred
        */
  -    public void invoke(Request request, Response response)
  +    public void invoke(Request request, Response response,
  +                       ValveContext context)
        throws IOException, ServletException {
   
        // Pass this request on to the next valve in our pipeline
  -     invokeNext(request, response);
  +     context.invokeNext(request, response);
   
           Date date = getDate();
           StringBuffer result = new StringBuffer();
  
  
  
  1.6       +15 -11    
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/CertificatesValve.java
  
  Index: CertificatesValve.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/CertificatesValve.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CertificatesValve.java    2000/10/31 23:53:29     1.5
  +++ CertificatesValve.java    2001/01/23 02:53:03     1.6
  @@ -1,13 +1,13 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/CertificatesValve.java,v
 1.5 2000/10/31 23:53:29 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/10/31 23:53:29 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/CertificatesValve.java,v
 1.6 2001/01/23 02:53:03 craigmcc Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/01/23 02:53:03 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -83,6 +83,7 @@
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
   import org.apache.catalina.Valve;
  +import org.apache.catalina.ValveContext;
   import org.apache.catalina.connector.RequestWrapper;
   import org.apache.catalina.deploy.LoginConfig;
   import org.apache.catalina.util.LifecycleSupport;
  @@ -90,8 +91,8 @@
   
   
   /**
  - * Implementation of a Valve that deals with SSL client certificates, as
  - * follows:
  + * <p>Implementation of a Valve that deals with SSL client certificates, as
  + * follows:</p>
    * <ul>
    * <li>If this request was not received on an SSL socket, simply pass it
    *     on unmodified.</li>
  @@ -107,11 +108,11 @@
    *         as request attributes.</li>
    * </ul>
    *
  - * The above tasks have been combined into a single Valve to minimize the
  - * amount of code that has to check for the existence of JSSE classes.
  + * <p>The above tasks have been combined into a single Valve to minimize the
  + * amount of code that has to check for the existence of JSSE classes.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2000/10/31 23:53:29 $
  + * @version $Revision: 1.6 $ $Date: 2001/01/23 02:53:03 $
    */
   
   public final class CertificatesValve
  @@ -217,11 +218,14 @@
        *
        * @param request The servlet request to be processed
        * @param response The servlet response to be created
  +     * @param context The valve context used to invoke the next valve
  +     *  in the current processing pipeline
        *
        * @exception IOException if an input/output error occurs
        * @exception ServletException if a servlet error occurs
        */
  -    public void invoke(Request request, Response response)
  +    public void invoke(Request request, Response response,
  +                       ValveContext context)
        throws IOException, ServletException {
   
           // Identify the underlying request if this request was wrapped
  @@ -239,7 +243,7 @@
           expose(request, actual);
   
           // Invoke the next Valve in our Pipeline
  -        invokeNext(request, response);
  +        context.invokeNext(request, response);
   
       }
   
  
  
  
  1.2       +10 -6     
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RemoteAddrValve.java
  
  Index: RemoteAddrValve.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RemoteAddrValve.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RemoteAddrValve.java      2000/08/11 17:03:15     1.1
  +++ RemoteAddrValve.java      2001/01/23 02:53:03     1.2
  @@ -1,13 +1,13 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RemoteAddrValve.java,v
 1.1 2000/08/11 17:03:15 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/11 17:03:15 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RemoteAddrValve.java,v
 1.2 2001/01/23 02:53:03 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/01/23 02:53:03 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -69,6 +69,7 @@
   import javax.servlet.ServletException;
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
  +import org.apache.catalina.ValveContext;
   
   
   /**
  @@ -76,7 +77,7 @@
    * based on the string representation of the remote client's IP address.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/08/11 17:03:15 $
  + * @version $Revision: 1.2 $ $Date: 2001/01/23 02:53:03 $
    */
   
   public final class RemoteAddrValve
  @@ -117,15 +118,18 @@
        *
        * @param request The servlet request to be processed
        * @param response The servlet response to be created
  +     * @param context The valve context used to invoke the next valve
  +     *  in the current processing pipeline
        *
        * @exception IOException if an input/output error occurs
        * @exception ServletException if a servlet error occurs
        */
  -    public void invoke(Request request, Response response)
  +    public void invoke(Request request, Response response,
  +                       ValveContext context)
        throws IOException, ServletException {
   
        process(request.getRequest().getRemoteAddr(),
  -             request, response);
  +             request, response, context);
   
       }
   
  
  
  
  1.2       +11 -7     
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RemoteHostValve.java
  
  Index: RemoteHostValve.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RemoteHostValve.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RemoteHostValve.java      2000/08/11 17:03:15     1.1
  +++ RemoteHostValve.java      2001/01/23 02:53:03     1.2
  @@ -1,13 +1,13 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RemoteHostValve.java,v
 1.1 2000/08/11 17:03:15 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/11 17:03:15 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RemoteHostValve.java,v
 1.2 2001/01/23 02:53:03 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/01/23 02:53:03 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -69,6 +69,7 @@
   import javax.servlet.ServletException;
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
  +import org.apache.catalina.ValveContext;
   
   
   /**
  @@ -76,7 +77,7 @@
    * based on the string representation of the remote client's IP address.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/08/11 17:03:15 $
  + * @version $Revision: 1.2 $ $Date: 2001/01/23 02:53:03 $
    */
   
   public final class RemoteHostValve
  @@ -90,7 +91,7 @@
        * The descriptive information related to this implementation.
        */
       private static final String info =
  -     "org.apache.catalina.valves.RemoteAddrValve/1.0";
  +     "org.apache.catalina.valves.RemoteHostValve/1.0";
   
   
       // ------------------------------------------------------------- Properties
  @@ -117,15 +118,18 @@
        *
        * @param request The servlet request to be processed
        * @param response The servlet response to be created
  +     * @param context The valve context used to invoke the next valve
  +     *  in the current processing pipeline
        *
        * @exception IOException if an input/output error occurs
        * @exception ServletException if a servlet error occurs
        */
  -    public void invoke(Request request, Response response)
  +    public void invoke(Request request, Response response,
  +                       ValveContext context)
        throws IOException, ServletException {
   
        process(request.getRequest().getRemoteHost(),
  -             request, response);
  +             request, response, context);
   
       }
   
  
  
  
  1.2       +16 -12    
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RequestDumperValve.java
  
  Index: RequestDumperValve.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RequestDumperValve.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestDumperValve.java   2000/12/17 01:02:44     1.1
  +++ RequestDumperValve.java   2001/01/23 02:53:03     1.2
  @@ -1,13 +1,13 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RequestDumperValve.java,v
 1.1 2000/12/17 01:02:44 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/12/17 01:02:44 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RequestDumperValve.java,v
 1.2 2001/01/23 02:53:03 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/01/23 02:53:03 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -82,21 +82,22 @@
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
   import org.apache.catalina.Valve;
  +import org.apache.catalina.ValveContext;
   import org.apache.catalina.connector.HttpResponseWrapper;
   import org.apache.catalina.util.StringManager;
   
   
   /**
  - * Implementation of a Valve that logs interesting contents from the
  + * <p>Implementation of a Valve that logs interesting contents from the
    * specified Request (before processing) and the corresponding Response
    * (after processing).  It is especially useful in debugging problems
  - * related to headers and cookies.
  - * <p>
  - * This Valve may be attached to any Container, depending on the granularity
  - * of the logging you wish to perform.
  + * related to headers and cookies.</p>
    *
  + * <p>This Valve may be attached to any Container, depending on the granularity
  + * of the logging you wish to perform.</p>
  + *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/12/17 01:02:44 $
  + * @version $Revision: 1.2 $ $Date: 2001/01/23 02:53:03 $
    */
   
   public class RequestDumperValve
  @@ -142,17 +143,20 @@
        *
        * @param request The servlet request to be processed
        * @param response The servlet response to be created
  +     * @param context The valve context used to invoke the next valve
  +     *  in the current processing pipeline
        *
        * @exception IOException if an input/output error occurs
        * @exception ServletException if a servlet error occurs
        */
  -    public void invoke(Request request, Response response)
  +    public void invoke(Request request, Response response,
  +                       ValveContext context)
        throws IOException, ServletException {
   
           // Skip logging for non-HTTP requests and responses
           if (!(request instanceof HttpRequest) ||
               !(response instanceof HttpResponse)) {
  -            invokeNext(request, response);
  +            context.invokeNext(request, response);
               return;
           }
           HttpRequest hrequest = (HttpRequest) request;
  @@ -212,7 +216,7 @@
           log("---------------------------------------------------------------");
   
           // Perform the request
  -        invokeNext(request, response);
  +        context.invokeNext(request, response);
   
           // Log post-service information
           log("---------------------------------------------------------------");
  
  
  
  1.2       +16 -16    
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RequestFilterValve.java
  
  Index: RequestFilterValve.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RequestFilterValve.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestFilterValve.java   2000/08/11 17:03:15     1.1
  +++ RequestFilterValve.java   2001/01/23 02:53:03     1.2
  @@ -1,13 +1,13 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RequestFilterValve.java,v
 1.1 2000/08/11 17:03:15 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/11 17:03:15 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/RequestFilterValve.java,v
 1.2 2001/01/23 02:53:03 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/01/23 02:53:03 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -77,6 +77,7 @@
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
   import org.apache.catalina.Valve;
  +import org.apache.catalina.ValveContext;
   import org.apache.catalina.util.StringManager;
   
   
  @@ -111,7 +112,7 @@
    * of the filtering you wish to perform.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/08/11 17:03:15 $
  + * @version $Revision: 1.2 $ $Date: 2001/01/23 02:53:03 $
    */
   
   public abstract class RequestFilterValve
  @@ -233,11 +234,14 @@
        *
        * @param request The servlet request to be processed
        * @param response The servlet response to be created
  +     * @param context The valve context used to invoke the next valve
  +     *  in the current processing pipeline
        *
        * @exception IOException if an input/output error occurs
        * @exception ServletException if a servlet error occurs
        */
  -    public abstract void invoke(Request request, Response response)
  +    public abstract void invoke(Request request, Response response,
  +                                ValveContext context)
        throws IOException, ServletException;
   
   
  @@ -291,20 +295,17 @@
        * @param property The request property on which to filter
        * @param request The servlet request to be processed
        * @param response The servlet response to be processed
  +     * @param context The valve context used to invoke the next valve
  +     *  in the current processing pipeline
        *
        * @exception IOException if an input/output error occurs
        * @exception ServletException if a servlet error occurs
        */
       protected void process(String property,
  -                        Request request, Response response)
  +                        Request request, Response response,
  +                           ValveContext context)
        throws IOException, ServletException {
   
  -     // Validate our current state
  -     Valve next = getNext();
  -     if (next == null)
  -         throw new IllegalStateException
  -             (sm.getString("requestFilterValve.next"));
  -
        // Check the deny patterns, if any
        for (int i = 0; i < denies.length; i++) {
            if (denies[i].match(property)) {
  @@ -320,17 +321,16 @@
        // Check the allow patterns, if any
        for (int i = 0; i < allows.length; i++) {
            if (allows[i].match(property)) {
  -             next.invoke(request, response);
  +             context.invokeNext(request, response);
                return;
            }
        }
   
        // Allow if denies specified but not allows
        if ((denies.length > 0) && (allows.length == 0)) {
  -         next.invoke(request, response);
  +         context.invokeNext(request, response);
            return;
        }
  -
   
        // Deny this request
        ServletResponse sres = response.getResponse();
  
  
  
  1.2       +12 -87    
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/ValveBase.java
  
  Index: ValveBase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/ValveBase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ValveBase.java    2000/08/11 17:03:15     1.1
  +++ ValveBase.java    2001/01/23 02:53:03     1.2
  @@ -1,13 +1,13 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/ValveBase.java,v
 1.1 2000/08/11 17:03:15 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/11 17:03:15 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/ValveBase.java,v
 1.2 2001/01/23 02:53:03 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/01/23 02:53:03 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -67,10 +67,12 @@
   
   import java.io.IOException;
   import javax.servlet.ServletException;
  +import org.apache.catalina.Contained;
   import org.apache.catalina.Container;
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
   import org.apache.catalina.Valve;
  +import org.apache.catalina.ValveContext;
   import org.apache.catalina.util.StringManager;
   
   
  @@ -82,11 +84,11 @@
    * management and lifecycle support.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/08/11 17:03:15 $
  + * @version $Revision: 1.2 $ $Date: 2001/01/23 02:53:03 $
    */
   
   public abstract class ValveBase
  -    implements Valve {
  +    implements Contained, Valve {
   
   
       //------------------------------------------------------ Instance Variables
  @@ -107,18 +109,6 @@
   
   
       /**
  -     * The next Valve in the pipeline this Valve is a component of.
  -     */
  -    protected Valve next = null;
  -
  -
  -    /**
  -     * The previous Valve in the pipeline this Valve is a component of.
  -     */
  -    protected Valve previous = null;
  -
  -
  -    /**
        * The string manager for this package.
        */
       protected final static StringManager sm =
  @@ -160,52 +150,6 @@
       }
   
   
  -    /**
  -     * Return the next Valve in this pipeline, or <code>null</code> if this
  -     * is the last Valve in the pipeline.
  -     */
  -    public Valve getNext() {
  -
  -     return (next);
  -
  -    }
  -
  -
  -    /**
  -     * Set the Valve that follows this one in the pipeline it is part of.
  -     *
  -     * @param valve The new next valve
  -     */
  -    public void setNext(Valve valve) {
  -
  -     this.next = valve;
  -
  -    }
  -
  -
  -    /**
  -     * Return the previous Valve in this pipeline, or <code>null</code> if
  -     * this is the first Valve in the pipeline.
  -     */
  -    public Valve getPrevious() {
  -
  -     return (previous);
  -
  -    }
  -
  -
  -    /**
  -     * Set the Valve that preceeds this one in the pipeline it is part of.
  -     *
  -     * @param valve The previous valve
  -     */
  -    public void setPrevious(Valve valve) {
  -
  -     this.previous = valve;
  -
  -    }
  -
  -
       //---------------------------------------------------------- Public Methods
   
   
  @@ -217,34 +161,15 @@
        *
        * @param request The servlet request to be processed
        * @param response The servlet response to be created
  +     * @param context The valve context used to invoke the next valve
  +     *  in the current processing pipeline
        *
        * @exception IOException if an input/output error occurs
        * @exception ServletException if a servlet error occurs
        */
  -    public abstract void invoke(Request request, Response response)
  +    public abstract void invoke(Request request, Response response,
  +                                ValveContext context)
        throws IOException, ServletException;
  -
  -
  -    /**
  -     * Invoke the next Valve in our pipeline, or complain if there is no such
  -     * Valve remaining.
  -     *
  -     * @param request The servlet request to be processed
  -     * @param response The servlet response to be created
  -     *
  -     * @exception IOException if an input/output error occurs
  -     * @exception ServletException if a servlet error occurs
  -     */
  -    public void invokeNext(Request request, Response response)
  -     throws IOException, ServletException {
  -
  -     if (getNext() != null)
  -         getNext().invoke(request, response);
  -     else
  -         throw new IllegalStateException
  -             (sm.getString("valveBase.noNext"));
  -
  -    }
   
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to