tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves AccessLogValve.java
Date Fri, 14 Apr 2000 19:41:56 GMT
craigmcc    00/04/14 12:41:55

  Modified:    proposals/catalina/src/share/org/apache/tomcat Response.java
               proposals/catalina/src/share/org/apache/tomcat/connector
                        ResponseBase.java
               proposals/catalina/src/share/org/apache/tomcat/connector/http
                        HttpConnector.java
               proposals/catalina/src/share/org/apache/tomcat/security
                        HttpBasicAuth.java HttpSecurityValve.java
               proposals/catalina/src/share/org/apache/tomcat/valves
                        AccessLogValve.java
  Added:       proposals/catalina/src/share/org/apache/tomcat
                        HttpResponse.java
               proposals/catalina/src/share/org/apache/tomcat/connector
                        HttpResponseBase.java
               proposals/catalina/src/share/org/apache/tomcat/connector/http
                        HttpResponseImpl.java
  Removed:     proposals/catalina/src/share/org/apache/tomcat/connector/http
                        HttpResponse.java
  Log:
  Factor the "generic" versus "HTTP-specific" layers of response handling,
  parallel to the change just done for requests.
  
  Revision  Changes    Path
  1.4       +7 -41     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/Response.java
  
  Index: Response.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/Response.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Response.java	2000/04/11 00:27:51	1.3
  +++ Response.java	2000/04/14 19:41:48	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/Response.java,v
1.3 2000/04/11 00:27:51 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/04/11 00:27:51 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/Response.java,v
1.4 2000/04/14 19:41:48 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/04/14 19:41:48 $
    *
    * ====================================================================
    *
  @@ -74,12 +74,12 @@
   
   
   /**
  - * A <b>Response</b> is the Tomcat-internal facade for an
  - * <code>ServletResponse</code> or <code>HttpServletResponse</code>
  - * that is to be produced, based on the processing of a corresponding Request.
  + * A <b>Response</b> is the Tomcat-internal facade for a
  + * <code>ServletResponse</code> that is to be produced,
  + * based on the processing of a corresponding <code>Request</code>.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2000/04/11 00:27:51 $
  + * @version $Revision: 1.4 $ $Date: 2000/04/14 19:41:48 $
    */
   
   public interface Response {
  @@ -193,40 +193,6 @@
        * or <code>null</code> if no content type was set.
        */
       public String getContentType();
  -
  -
  -    /**
  -     * Return the value for the specified header, or <code>null</code> if this
  -     * header has not been set.  If more than one value was added for this
  -     * name, only the first is returned; use getHeaderValues() to retrieve all
  -     * of them.
  -     *
  -     * @param name Header name to look up
  -     */
  -    public String getHeader(String name);
  -
  -
  -    /**
  -     * Return an enumeration all the header names set for this response, or
  -     * an empty Enumeration if no headers have been set.
  -     */
  -    public Enumeration getHeaderNames();
  -
  -
  -    /**
  -     * Return an enumeration of all the header values associated with the
  -     * specified header name, or an empty enumeration if there are no such
  -     * header values.
  -     *
  -     * @param name Header name to look up
  -     */
  -    public Enumeration getHeaderValues(String name);
  -
  -
  -    /**
  -     * Return the HTTP status code associated with this Response.
  -     */
  -    public int getStatus();
   
   
       /**
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/HttpResponse.java
  
  Index: HttpResponse.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/HttpResponse.java,v
1.1 2000/04/14 19:41:48 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/04/14 19:41:48 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.tomcat;
  
  
  import java.util.Enumeration;
  
  
  /**
   * An <b>HttpResponse</b> is the Tomcat-internal facade for an
   * <code>HttpServletResponse</code> that is to be produced,
   * based on the processing of a corresponding <code>HttpRequest</code>.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/04/14 19:41:48 $
   */
  
  public interface HttpResponse
      extends Response {
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Return the value for the specified header, or <code>null</code> if this
       * header has not been set.  If more than one value was added for this
       * name, only the first is returned; use getHeaderValues() to retrieve all
       * of them.
       *
       * @param name Header name to look up
       */
      public String getHeader(String name);
  
  
      /**
       * Return an enumeration all the header names set for this response, or
       * an empty Enumeration if no headers have been set.
       */
      public Enumeration getHeaderNames();
  
  
      /**
       * Return an enumeration of all the header values associated with the
       * specified header name, or an empty enumeration if there are no such
       * header values.
       *
       * @param name Header name to look up
       */
      public Enumeration getHeaderValues(String name);
  
  
      /**
       * Return the HTTP status code associated with this Response.
       */
      public int getStatus();
  
  
  }
  
  
  
  1.3       +5 -328    jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/ResponseBase.java
  
  Index: ResponseBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/ResponseBase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResponseBase.java	2000/04/11 00:27:52	1.2
  +++ ResponseBase.java	2000/04/14 19:41:50	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/ResponseBase.java,v
1.2 2000/04/11 00:27:52 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/04/11 00:27:52 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/ResponseBase.java,v
1.3 2000/04/14 19:41:50 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/04/14 19:41:50 $
    *
    * ====================================================================
    *
  @@ -68,15 +68,10 @@
   import java.io.IOException;
   import java.io.OutputStream;
   import java.io.PrintWriter;
  -import java.util.Enumeration;
  -import java.util.Hashtable;
   import java.util.Locale;
  -import java.util.Vector;
   import javax.servlet.ServletException;
   import javax.servlet.ServletOutputStream;
   import javax.servlet.ServletResponse;
  -import javax.servlet.http.Cookie;
  -import javax.servlet.http.HttpServletResponse;
   import org.apache.tomcat.Connector;
   import org.apache.tomcat.Context;
   import org.apache.tomcat.Request;
  @@ -89,11 +84,11 @@
    * the connector-specific methods need to be implemented.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/04/11 00:27:52 $
  + * @version $Revision: 1.3 $ $Date: 2000/04/14 19:41:50 $
    */
   
   public class ResponseBase
  -    implements Response, HttpServletResponse {
  +    implements Response, ServletResponse {
   
   
       // ----------------------------------------------------- Instance Variables
  @@ -124,15 +119,6 @@
   
   
       /**
  -     * The HTTP headers explicitly added via addHeader(), but not including
  -     * those to be added with setContentLength(), setContentType(), and so on.
  -     * This collection is keyed by the header name, and the elements are
  -     * Vectors containing the associated values that have been set.
  -     */
  -    protected Hashtable headers = new Hashtable();
  -
  -
  -    /**
        * Descriptive information about this Response implementation.
        */
       protected static final String info =
  @@ -146,12 +132,6 @@
   
   
       /**
  -     * The HTTP status code associated with this Response.
  -     */
  -    protected int status = HttpServletResponse.SC_OK;
  -
  -
  -    /**
        * The output stream associated with this Response.
        */
       protected OutputStream stream = null;
  @@ -324,64 +304,6 @@
   
   
       /**
  -     * Return the value for the specified header, or <code>null</code> if this
  -     * header has not been set.  If more than one value was added for this
  -     * name, only the first is returned; use getHeaderValues() to retrieve all
  -     * of them.
  -     *
  -     * @param name Header name to look up
  -     */
  -    public String getHeader(String name) {
  -
  -	Vector values = (Vector) headers.get(name);
  -	if (values != null)
  -	    return ((String) values.elementAt(0));
  -	else
  -	    return (null);
  -
  -    }
  -
  -
  -    /**
  -     * Return an enumeration all the header names set for this response, or
  -     * an empty Enumeration if no headers have been set.
  -     */
  -    public Enumeration getHeaderNames() {
  -
  -	return (headers.keys());
  -
  -    }
  -
  -
  -    /**
  -     * Return an enumeration of all the header values associated with the
  -     * specified header name, or an empty enumeration if there are no such
  -     * header values.
  -     *
  -     * @param name Header name to look up
  -     */
  -    public Enumeration getHeaderValues(String name) {
  -
  -	Vector values = (Vector) headers.get(name);
  -	if (values != null)
  -	    return (values.elements());
  -	else
  -	    return (null);
  -
  -    }
  -
  -
  -    /**
  -     * Return the HTTP status code associated with this Response.
  -     */
  -    public int getStatus() {
  -
  -	return (this.status);
  -
  -    }
  -
  -
  -    /**
        * Release all object references, and initialize instance variables, in
        * preparation for reuse of this object.
        */
  @@ -391,9 +313,7 @@
   	contentLength = -1;
   	contentType = "text/plain";
   	context = null;
  -	headers.clear();
   	request = null;
  -	status = -1;
   	stream = null;
   
       }
  @@ -543,249 +463,6 @@
       public void setLocale(Locale locale) {
   
   	;	// FIXME: setLocale()
  -
  -    }
  -
  -
  -    // -------------------------------------------- HttpServletResponse Methods
  -
  -
  -    /**
  -     * Add the specified Cookie to those that will be included with
  -     * this Response.
  -     *
  -     * @param cookie Cookie to be added
  -     */
  -    public void addCookie(Cookie cookie) {
  -
  -	;	// FIXME: addCookie()
  -
  -    }
  -
  -
  -    /**
  -     * Add the specified date header to the specified value.
  -     *
  -     * @param name Name of the header to set
  -     * @param value Date value to be set
  -     */
  -    public void addDateHeader(String name, long value) {
  -
  -	;	// FIXME: setDateHeader()
  -
  -    }
  -
  -
  -    /**
  -     * Add the specified header to the specified value.
  -     *
  -     * @param name Name of the header to set
  -     * @param value Value to be set
  -     */
  -    public void addHeader(String name, String value) {
  -
  -	;	// FIXME: addHeader()
  -
  -    }
  -
  -
  -    /**
  -     * Add the specified integer header to the specified value.
  -     *
  -     * @param name Name of the header to set
  -     * @param value Integer value to be set
  -     */
  -    public void addIntHeader(String name, int value) {
  -
  -	;	// FIXME: addIntHeader()
  -
  -    }
  -
  -
  -    /**
  -     * Has the specified header been set already in this response?
  -     *
  -     * @param name Name of the header to check
  -     */
  -    public boolean containsHeader(String name) {
  -
  -	return (false);	// FIXME: containsHeader
  -
  -    }
  -
  -
  -    /**
  -     * Encode the session identifier associated with this response
  -     * into the specified redirect URL, if necessary.
  -     *
  -     * @param url URL to be encoded
  -     */
  -    public String encodeRedirectURL(String url) {
  -
  -	return (url);	// FIXME: encodeRedirectURL()
  -
  -    }
  -
  -
  -    /**
  -     * Encode the session identifier associated with this response
  -     * into the specified redirect URL, if necessary.
  -     *
  -     * @param url URL to be encoded
  -     *
  -     * @deprecated As of Version 2.1 of the Java Servlet API, use
  -     *  <code>encodeRedirectURL()</code> instead.
  -     */
  -    public String encodeRedirectUrl(String url) {
  -
  -	return (encodeRedirectURL(url));
  -
  -    }
  -
  -
  -    /**
  -     * Encode the session identifier associated with this response
  -     * into the specified URL, if necessary.
  -     *
  -     * @param url URL to be encoded
  -     */
  -    public String encodeURL(String url) {
  -
  -	return (url);	// FIXME: encodeURL()
  -
  -    }
  -
  -
  -    /**
  -     * Encode the session identifier associated with this response
  -     * into the specified URL, if necessary.
  -     *
  -     * @param url URL to be encoded
  -     *
  -     * @deprecated As of Version 2.1 of the Java Servlet API, use
  -     *  <code>encodeURL()</code> instead.
  -     */
  -    public String encodeUrl(String url) {
  -
  -	return (encodeURL(url));
  -
  -    }
  -
  -
  -    /**
  -     * Send an error response with the specified status and a
  -     * default message.
  -     *
  -     * @param status HTTP status code to send
  -     *
  -     * @exception IllegalStateException if this response has
  -     *  already been committed
  -     * @exception IOException if an input/output error occurs
  -     */
  -    public void sendError(int status) throws IOException {
  -
  -	;	// FIXME: sendError(status)
  -
  -    }
  -
  -
  -    /**
  -     * Send an error response with the specified status and message.
  -     *
  -     * @param status HTTP status code to send
  -     * @param message Corresponding message to send
  -     *
  -     * @exception IllegalStateException if this response has
  -     *  already been committed
  -     * @exception IOException if an input/output error occurs
  -     */
  -    public void sendError(int status, String message) throws IOException {
  -
  -	;	// FIXME: sendError(status, message)
  -
  -    }
  -
  -
  -    /**
  -     * Send a temporary redirect to the specified redirect location URL.
  -     *
  -     * @param location Location URL to redirect to
  -     *
  -     * @exception IllegalStateException if this response has
  -     *  already been committed
  -     * @exception IOException if an input/output error occurs
  -     */
  -    public void sendRedirect(String location) throws IOException {
  -
  -	;	// FIXME: sendRedirect()
  -
  -    }
  -
  -
  -    /**
  -     * Set the specified date header to the specified value.
  -     *
  -     * @param name Name of the header to set
  -     * @param date Date value to be set
  -     */
  -    public void setDateHeader(String name, long date) {
  -
  -	;	// FIXME: setDateHeader()
  -
  -    }
  -
  -
  -    /**
  -     * Set the specified header to the specified value.
  -     *
  -     * @param name Name of the header to set
  -     * @param value Value to be set
  -     */
  -    public void setHeader(String name, String value) {
  -
  -	;	// FIXME: setHeader()
  -
  -    }
  -
  -
  -    /**
  -     * Set the specified integer header to the specified value.
  -     *
  -     * @param name Name of the header to set
  -     * @param value Integer value to be set
  -     */
  -    public void setIntHeader(String name, int value) {
  -
  -	;	// FIXME: setIntHeader()
  -
  -    }
  -
  -
  -    /**
  -     * Set the HTTP status to be returned with this response.
  -     *
  -     * @param status The new HTTP status
  -     */
  -    public void setStatus(int status) {
  -
  -	;	// FIXME: setStatus(status)
  -
  -    }
  -
  -
  -    /**
  -     * Set the HTTP status and message to be returned with this response.
  -     *
  -     * @param status The new HTTP status
  -     * @param message The associated text message
  -     *
  -     * @deprecated As of Version 2.1 of the Java Servlet API, this method
  -     *  has been deprecated due to the ambiguous meaning of the message
  -     *  parameter.
  -     */
  -    public void setStatus(int status, String message) {
  -
  -	;	// FIXME: setStatus(status, message)
   
       }
   
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/HttpResponseBase.java
  
  Index: HttpResponseBase.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/HttpResponseBase.java,v
1.1 2000/04/14 19:41:50 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/04/14 19:41:50 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.tomcat.connector;
  
  
  import java.io.IOException;
  import java.util.Enumeration;
  import java.util.Hashtable;
  import java.util.Vector;
  import javax.servlet.http.Cookie;
  import javax.servlet.http.HttpServletResponse;
  import org.apache.tomcat.HttpResponse;
  
  
  /**
   * Convenience base implementation of the <b>HttpResponse</b> interface, which
   * can be used for the <code>Response</code> implementation required by most
   * <code>Connectors</code> that deal with HTTP.  Only the connector-specific
   * methods need to be implemented.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/04/14 19:41:50 $
   */
  
  public class HttpResponseBase
      extends ResponseBase
      implements HttpResponse, HttpServletResponse {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The HTTP headers explicitly added via addHeader(), but not including
       * those to be added with setContentLength(), setContentType(), and so on.
       * This collection is keyed by the header name, and the elements are
       * Vectors containing the associated values that have been set.
       */
      protected Hashtable headers = new Hashtable();
  
  
      /**
       * Descriptive information about this HttpResponse implementation.
       */
      protected static final String info =
  	"org.apache.tomcat.connector.HttpResponseBase/1.0";
  
  
      /**
       * The HTTP status code associated with this Response.
       */
      protected int status = HttpServletResponse.SC_OK;
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Return the value for the specified header, or <code>null</code> if this
       * header has not been set.  If more than one value was added for this
       * name, only the first is returned; use getHeaderValues() to retrieve all
       * of them.
       *
       * @param name Header name to look up
       */
      public String getHeader(String name) {
  
  	Vector values = (Vector) headers.get(name);
  	if (values != null)
  	    return ((String) values.elementAt(0));
  	else
  	    return (null);
  
      }
  
  
      /**
       * Return an enumeration all the header names set for this response, or
       * an empty Enumeration if no headers have been set.
       */
      public Enumeration getHeaderNames() {
  
  	return (headers.keys());
  
      }
  
  
      /**
       * Return an enumeration of all the header values associated with the
       * specified header name, or an empty enumeration if there are no such
       * header values.
       *
       * @param name Header name to look up
       */
      public Enumeration getHeaderValues(String name) {
  
  	Vector values = (Vector) headers.get(name);
  	if (values != null)
  	    return (values.elements());
  	else
  	    return (null);
  
      }
  
  
      /**
       * Return the HTTP status code associated with this Response.
       */
      public int getStatus() {
  
  	return (this.status);
  
      }
  
  
      /**
       * Release all object references, and initialize instance variables, in
       * preparation for reuse of this object.
       */
      public void recycle() {
  
  	super.recycle();
  	headers.clear();
  	status = -1;
  
      }
  
  
      // -------------------------------------------- HttpServletResponse Methods
  
  
      /**
       * Add the specified Cookie to those that will be included with
       * this Response.
       *
       * @param cookie Cookie to be added
       */
      public void addCookie(Cookie cookie) {
  
  	;	// FIXME: addCookie()
  
      }
  
  
      /**
       * Add the specified date header to the specified value.
       *
       * @param name Name of the header to set
       * @param value Date value to be set
       */
      public void addDateHeader(String name, long value) {
  
  	;	// FIXME: setDateHeader()
  
      }
  
  
      /**
       * Add the specified header to the specified value.
       *
       * @param name Name of the header to set
       * @param value Value to be set
       */
      public void addHeader(String name, String value) {
  
  	;	// FIXME: addHeader()
  
      }
  
  
      /**
       * Add the specified integer header to the specified value.
       *
       * @param name Name of the header to set
       * @param value Integer value to be set
       */
      public void addIntHeader(String name, int value) {
  
  	;	// FIXME: addIntHeader()
  
      }
  
  
      /**
       * Has the specified header been set already in this response?
       *
       * @param name Name of the header to check
       */
      public boolean containsHeader(String name) {
  
  	return (false);	// FIXME: containsHeader
  
      }
  
  
      /**
       * Encode the session identifier associated with this response
       * into the specified redirect URL, if necessary.
       *
       * @param url URL to be encoded
       */
      public String encodeRedirectURL(String url) {
  
  	return (url);	// FIXME: encodeRedirectURL()
  
      }
  
  
      /**
       * Encode the session identifier associated with this response
       * into the specified redirect URL, if necessary.
       *
       * @param url URL to be encoded
       *
       * @deprecated As of Version 2.1 of the Java Servlet API, use
       *  <code>encodeRedirectURL()</code> instead.
       */
      public String encodeRedirectUrl(String url) {
  
  	return (encodeRedirectURL(url));
  
      }
  
  
      /**
       * Encode the session identifier associated with this response
       * into the specified URL, if necessary.
       *
       * @param url URL to be encoded
       */
      public String encodeURL(String url) {
  
  	return (url);	// FIXME: encodeURL()
  
      }
  
  
      /**
       * Encode the session identifier associated with this response
       * into the specified URL, if necessary.
       *
       * @param url URL to be encoded
       *
       * @deprecated As of Version 2.1 of the Java Servlet API, use
       *  <code>encodeURL()</code> instead.
       */
      public String encodeUrl(String url) {
  
  	return (encodeURL(url));
  
      }
  
  
      /**
       * Send an error response with the specified status and a
       * default message.
       *
       * @param status HTTP status code to send
       *
       * @exception IllegalStateException if this response has
       *  already been committed
       * @exception IOException if an input/output error occurs
       */
      public void sendError(int status) throws IOException {
  
  	;	// FIXME: sendError(status)
  
      }
  
  
      /**
       * Send an error response with the specified status and message.
       *
       * @param status HTTP status code to send
       * @param message Corresponding message to send
       *
       * @exception IllegalStateException if this response has
       *  already been committed
       * @exception IOException if an input/output error occurs
       */
      public void sendError(int status, String message) throws IOException {
  
  	;	// FIXME: sendError(status, message)
  
      }
  
  
      /**
       * Send a temporary redirect to the specified redirect location URL.
       *
       * @param location Location URL to redirect to
       *
       * @exception IllegalStateException if this response has
       *  already been committed
       * @exception IOException if an input/output error occurs
       */
      public void sendRedirect(String location) throws IOException {
  
  	;	// FIXME: sendRedirect()
  
      }
  
  
      /**
       * Set the specified date header to the specified value.
       *
       * @param name Name of the header to set
       * @param date Date value to be set
       */
      public void setDateHeader(String name, long date) {
  
  	;	// FIXME: setDateHeader()
  
      }
  
  
      /**
       * Set the specified header to the specified value.
       *
       * @param name Name of the header to set
       * @param value Value to be set
       */
      public void setHeader(String name, String value) {
  
  	;	// FIXME: setHeader()
  
      }
  
  
      /**
       * Set the specified integer header to the specified value.
       *
       * @param name Name of the header to set
       * @param value Integer value to be set
       */
      public void setIntHeader(String name, int value) {
  
  	;	// FIXME: setIntHeader()
  
      }
  
  
      /**
       * Set the HTTP status to be returned with this response.
       *
       * @param status The new HTTP status
       */
      public void setStatus(int status) {
  
  	;	// FIXME: setStatus(status)
  
      }
  
  
      /**
       * Set the HTTP status and message to be returned with this response.
       *
       * @param status The new HTTP status
       * @param message The associated text message
       *
       * @deprecated As of Version 2.1 of the Java Servlet API, this method
       *  has been deprecated due to the ambiguous meaning of the message
       *  parameter.
       */
      public void setStatus(int status, String message) {
  
  	;	// FIXME: setStatus(status, message)
  
      }
  
  
  }
  
  
  
  1.4       +5 -4      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java
  
  Index: HttpConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HttpConnector.java	2000/04/14 18:55:28	1.3
  +++ HttpConnector.java	2000/04/14 19:41:51	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java,v
1.3 2000/04/14 18:55:28 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/04/14 18:55:28 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java,v
1.4 2000/04/14 19:41:51 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/04/14 19:41:51 $
    *
    * ====================================================================
    *
  @@ -72,6 +72,7 @@
   import org.apache.tomcat.Connector;
   import org.apache.tomcat.Container;
   import org.apache.tomcat.HttpRequest;
  +import org.apache.tomcat.HttpResponse;
   import org.apache.tomcat.Lifecycle;
   import org.apache.tomcat.LifecycleEvent;
   import org.apache.tomcat.LifecycleException;
  @@ -324,7 +325,7 @@
        */
       public Response newResponse() {
   
  -	HttpResponse response = new HttpResponse();
  +	HttpResponseImpl response = new HttpResponseImpl();
   	response.setConnector(this);
   	return (response);
   
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpResponseImpl.java
  
  Index: HttpResponseImpl.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpResponseImpl.java,v
1.1 2000/04/14 19:41:52 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/04/14 19:41:52 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.tomcat.connector.http;
  
  
  import org.apache.tomcat.connector.HttpResponseBase;
  
  
  /**
   * Implementation of <b>HttpResponse</b> specific to the HTTP connector.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/04/14 19:41:52 $
   */
  
  final class HttpResponseImpl
      extends HttpResponseBase {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * Descriptive information about this Response implementation.
       */
      protected static final String info =
  	"org.apache.tomcat.connector.http.HttpResponseImpl/1.0";
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return descriptive information about this Response implementation and
       * the corresponding version number, in the format
       * <code>&lt;description&gt;/&lt;version&gt;</code>.
       */
      public String getInfo() {
  
  	return (info);
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Release all object references, and initialize instance variables, in
       * preparation for reuse of this object.
       */
      public void recycle() {
  
  	super.recycle();
  	((HttpConnector) connector).recycle(this);
  
      }
  
  
  }
  
  
  
  1.5       +7 -5      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpBasicAuth.java
  
  Index: HttpBasicAuth.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpBasicAuth.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HttpBasicAuth.java	2000/04/14 18:55:29	1.4
  +++ HttpBasicAuth.java	2000/04/14 19:41:53	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpBasicAuth.java,v
1.4 2000/04/14 18:55:29 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/04/14 18:55:29 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpBasicAuth.java,v
1.5 2000/04/14 19:41:53 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/04/14 19:41:53 $
    *
    * ====================================================================
    *
  @@ -70,6 +70,7 @@
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import org.apache.tomcat.HttpRequest;
  +import org.apache.tomcat.HttpResponse;
   import org.apache.tomcat.Realm;
   import org.apache.tomcat.Response;
   import org.apache.tomcat.deploy.LoginConfig;
  @@ -84,7 +85,7 @@
    * if this is not the case.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2000/04/14 18:55:29 $
  + * @version $Revision: 1.5 $ $Date: 2000/04/14 19:41:53 $
    */
   
   final class HttpBasicAuth {
  @@ -107,7 +108,8 @@
        *
        * @exception IOException if an input/output error occurs
        */
  -    public static boolean authenticate(HttpRequest request, Response response,
  +    public static boolean authenticate(HttpRequest request,
  +				       HttpResponse response,
   				       LoginConfig config, Realm realm)
   	throws IOException {
   
  
  
  
  1.3       +11 -10    jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpSecurityValve.java
  
  Index: HttpSecurityValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpSecurityValve.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpSecurityValve.java	2000/04/14 18:55:29	1.2
  +++ HttpSecurityValve.java	2000/04/14 19:41:53	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpSecurityValve.java,v
1.2 2000/04/14 18:55:29 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/04/14 18:55:29 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpSecurityValve.java,v
1.3 2000/04/14 19:41:53 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/04/14 19:41:53 $
    *
    * ====================================================================
    *
  @@ -75,6 +75,7 @@
   import org.apache.tomcat.Container;
   import org.apache.tomcat.Context;
   import org.apache.tomcat.HttpRequest;
  +import org.apache.tomcat.HttpResponse;
   import org.apache.tomcat.Lifecycle;
   import org.apache.tomcat.LifecycleEvent;
   import org.apache.tomcat.LifecycleException;
  @@ -115,7 +116,7 @@
    * </ul>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/04/14 18:55:29 $
  + * @version $Revision: 1.3 $ $Date: 2000/04/14 19:41:53 $
    */
   
   
  @@ -215,8 +216,8 @@
   	throws IOException, ServletException {
   
   	// If this is not an HTTP request, do nothing
  -	if (!(request instanceof HttpRequest) /* ||
  -            !(response instanceof HttpResponse) */ ) {
  +	if (!(request instanceof HttpRequest) ||
  +            !(response instanceof HttpResponse)) {
   	    invokeNext(request, response);
   	    return;
   	}
  @@ -358,20 +359,20 @@
   	// Apply the requested login mechanism
   	if (method.equals(Constants.BASIC_METHOD))
   	    return (HttpBasicAuth.authenticate((HttpRequest) request,
  -					       response,
  +					       (HttpResponse) response,
   					       config, context.getRealm()));
   	/*
   	else if (method.equals(Constants.CERT_METHOD))
   	    return (ClientCertAuth.authenticate((HttpRequest) request,
  -	                                        response,
  +	                                        (HttpResponse) response,
   						config, context.getRealm()));
   	else if (method.equals(Constants.DIGEST_METHOD))
   	    return (HttpDigestAuth.authenticate((HttpRequest) request,
  -	                                        response,
  +	                                        (HttpResponse) response,
   						config, context.getRealm()));
   	else if (method.equals(Constants.FORM_METHOD))
   	    return (LoginFormAuth.authenticate(request,
  -	                                       response,
  +	                                       (HttpResponse) response,
   					       config, context.getRealm()));
   	*/
   	else {
  
  
  
  1.5       +3 -2      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves/AccessLogValve.java
  
  Index: AccessLogValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves/AccessLogValve.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AccessLogValve.java	2000/04/11 00:27:53	1.4
  +++ AccessLogValve.java	2000/04/14 19:41:54	1.5
  @@ -71,6 +71,7 @@
   import javax.servlet.ServletResponse;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
  +import org.apache.tomcat.HttpResponse;
   import org.apache.tomcat.Lifecycle;
   import org.apache.tomcat.LifecycleEvent;
   import org.apache.tomcat.LifecycleException;
  @@ -121,7 +122,7 @@
    * can be implemented.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2000/04/11 00:27:53 $
  + * @version $Revision: 1.5 $ $Date: 2000/04/14 19:41:54 $
    */
   
   public final class AccessLogValve
  @@ -513,7 +514,7 @@
   		value = "- - " + req.getProtocol();
   	} else if (pattern == 's') {
   	    if (hres != null)
  -		value = "" + response.getStatus();
  +		value = "" + ((HttpResponse) response).getStatus();
   	    else
   		value = "-";
   	} else if (pattern == 't') {
  
  
  

Mime
View raw message