You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2001/07/10 04:55:05 UTC

cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote ActionCode.java ActionHook.java OutputBuffer.java Request.java Response.java AdapterEventCode.java AdapterListener.java Note.java

remm        01/07/09 19:55:05

  Modified:    coyote/src/java/org/apache/coyote OutputBuffer.java
                        Request.java Response.java
  Added:       coyote/src/java/org/apache/coyote ActionCode.java
                        ActionHook.java
  Removed:     coyote/src/java/org/apache/coyote AdapterEventCode.java
                        AdapterListener.java Note.java
  Log:
  - Various updates to the Coyote API.
    Note: The API can't be considered frozen until the port of at least one
    connector is complete.
  - Status update : I have started porting the Java HTTP/1.1 connector.
    I will patially rewrite it for more memory efficiency and a few additional
    features.
  - On the adapter side, I'll write a simple adapter which will output the full
    request information back to the client, and then I'll write an adapter
    for Catalina.
  
  Revision  Changes    Path
  1.2       +0 -6      jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/OutputBuffer.java
  
  Index: OutputBuffer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/OutputBuffer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OutputBuffer.java	2001/06/14 01:07:57	1.1
  +++ OutputBuffer.java	2001/07/10 02:55:01	1.2
  @@ -73,10 +73,4 @@
           throws IOException;
   
   
  -    public void reset();
  -
  -
  -    public void close();
  -
  -
   }
  
  
  
  1.2       +3 -8      jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java
  
  Index: Request.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Request.java	2001/06/14 01:07:57	1.1
  +++ Request.java	2001/07/10 02:55:02	1.2
  @@ -153,7 +153,7 @@
       /**
        * Notes.
        */
  -    protected Note notes[] = new Note[Constants.MAX_NOTES];
  +    protected Object notes[] = new Object[Constants.MAX_NOTES];
   
   
       /**
  @@ -349,12 +349,12 @@
       // -------------------- Per-Request "notes" --------------------
   
   
  -    public final void setNote(int pos, Note value) {
  +    public final void setNote(int pos, Object value) {
   	notes[pos] = value;
       }
   
   
  -    public final Note getNote(int pos) {
  +    public final Object getNote(int pos) {
   	return notes[pos];
       }
   
  @@ -378,11 +378,6 @@
           serverPort=-1;
   	
   	scookies.recycle();
  -
  -        for (int i=0; i < Constants.MAX_NOTES; i++) {
  -            if (notes[i] != null)
  -                notes[i].recycle();
  -        }
   
           unparsedURIMB.recycle();
           uriMB.recycle();
  
  
  
  1.2       +21 -23    jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java
  
  Index: Response.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Response.java	2001/06/14 01:07:57	1.1
  +++ Response.java	2001/07/10 02:55:02	1.2
  @@ -111,7 +111,7 @@
       /**
        * Notes.
        */
  -    protected Note notes[] = new Note[Constants.MAX_NOTES];
  +    protected Object notes[] = new Object[Constants.MAX_NOTES];
   
   
       /**
  @@ -136,9 +136,9 @@
   
   
       /**
  -     * Adapter listener.
  +     * Action hook.
        */
  -    public AdapterListener listener;
  +    public ActionHook hook;
   
   
       // ------------------------------------------------------------- Properties
  @@ -159,35 +159,35 @@
       }
   
   
  -    public AdapterListener getListener() {
  -        return listener;
  +    public ActionHook getHook() {
  +        return hook;
       }
   
   
  -    public void setAdapterListener(AdapterListener listener) {
  -        this.listener = listener;
  +    public void setHook(ActionHook hook) {
  +        this.hook = hook;
       }
   
   
       // -------------------- Per-Response "notes" --------------------
   
   
  -    public final void setNote(int pos, Note value) {
  +    public final void setNote(int pos, Object value) {
   	notes[pos] = value;
       }
   
   
  -    public final Note getNote(int pos) {
  +    public final Object getNote(int pos) {
   	return notes[pos];
       }
   
   
  -    // -------------------- Events --------------------
  +    // -------------------- Actions --------------------
   
   
  -    public void sendEvent(AdapterEventCode eventCode, Object param) {
  -        if (listener != null) {
  -            listener.event(eventCode, param);
  +    public void action(ActionCode actionCode, Object param) {
  +        if (hook != null) {
  +            hook.action(actionCode, param);
           }
       }
   
  @@ -263,7 +263,9 @@
       // -------------------- Methods --------------------
       
       
  -    public void reset() throws IllegalStateException {
  +    public void reset() 
  +        throws IllegalStateException {
  +        
           // Reset the headers only if this is the main request,
           // not for included
           contentType = Constants.DEFAULT_CONTENT_TYPE;
  @@ -277,16 +279,17 @@
   	// stream before resetting the output stream
   	//
   	// Reset the stream
  -	if( commited ) {
  +	if (commited) {
   	    //String msg = sm.getString("servletOutputStreamImpl.reset.ise"); 
  -	    throw new IllegalStateException(/*msg*/);
  +	    throw new IllegalStateException();
   	}
  -	outputBuffer.reset();
  +        
  +        action(ActionCode.ACTION_RESET, null);
       }
   
   
       public void finish() throws IOException {
  -	outputBuffer.close();
  +        action(ActionCode.ACTION_CLOSE, null);
       }
   
   
  @@ -431,11 +434,6 @@
   	errorException = null;
   	errorURI = null;
   	headers.clear();
  -
  -        for (int i=0; i < Constants.MAX_NOTES; i++) {
  -            if (notes[i] != null)
  -                notes[i].recycle();
  -        }
   
       }
   
  
  
  
  1.1                  jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/ActionCode.java
  
  Index: ActionCode.java
  ===================================================================
  /*
   * ====================================================================
   *
   * 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.coyote;
  
  
  /**
   * Enumerated class containing the adapter event codes.
   *
   * @author Remy Maucherat
   */
  public final class ActionCode {
  
  
      // -------------------------------------------------------------- Constants
  
  
      public static final ActionCode ACTION_CUSTOM = new ActionCode();
  
  
      public static final ActionCode ACTION_CLOSE = new ActionCode();
  
  
      public static final ActionCode ACTION_RESET = new ActionCode();
  
  
      public static final ActionCode ACTION_ACK = new ActionCode();
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Private constructor.
       */
      private ActionCode() {
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/ActionHook.java
  
  Index: ActionHook.java
  ===================================================================
  /*
   * ====================================================================
   *
   * 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.coyote;
  
  
  /**
   * Action hook.
   *
   * @author Remy Maucherat
   */
  public interface ActionHook {
  
  
      /**
       * Send an action to the connector.
       * 
       * @param actionCode Type of the action
       * @param param Action parameter
       */
      public void action(ActionCode actionCode, Object param);
  
  
  }