jicarilla-sandbox/platform/components/http/api/src/java/org/jicarilla/http HTTPEncoding.java,1.4,1.5 HTTPHandler.java,1.4,1.5

Leo Simons <[email protected]>
Newsgroups gmane.comp.java.jicarilla.cvs
Message-ID <[email protected]>
Update of /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/api/src/java/org/jicarilla/http
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1107/platform/components/http/api/src/java/org/jicarilla/http

Modified Files:
	HTTPEncoding.java HTTPHandler.java 
Log Message:
forgot to commit some of this. See weblog for TODO :D

Index: HTTPHandler.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/api/src/java/org/jicarilla/http/HTTPHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- HTTPHandler.java	31 Mar 2004 19:42:52 -0000	1.4
+++ HTTPHandler.java	3 Apr 2004 10:13:23 -0000	1.5
@@ -37,10 +37,6 @@
  */
 public interface HTTPHandler
 {
-    int getBodyType();
-
-    int getBodySize();
-
     /**
      * This method will be called by the parser to signal that
      * it will start providing the data of a new message that
@@ -91,13 +87,42 @@
      * This method will be called zero or more times, once
      * for each header value, after the start line
      * has been parsed. It will always follow immediately after
-     * the <code>foundHeader()</code> has been called.
+     * the <code>foundHeaderName()</code> has been called.
      *
      * @param value the value of the header that was found
      */
     void foundHeaderValue( ByteBuffer value );
 
     /**
+     * This method will be called once by the parser, after
+     * all the headers have been found. If the return value
+     * is {@link HTTPParser.BODY_TYPE_NONE}, it will be
+     * followed by a call to {@link #endMessage()}. If the
+     * return value is {@link HTTPParser.BODY_TYPE_NORMAL}, it
+     * will be followed by a call to {@link #getBodySize()}. If
+     * the return value is {@link HTTPParser.BODY_TYPE_CHUNKING},
+     * it will be followed by one or more calls to
+     * {@link #foundBody(ByteBuffer)}.
+     * 
+     * @return an integer representing the body type that the
+     *     parser should attempt to retrieve. Valid values are
+     *     {@link HTTPParser.BODY_TYPE_NONE},
+     *     {@link HTTPParser.BODY_TYPE_NORMAL} and
+     *     {@link HTTPParser.BODY_TYPE_CHUNKING}.
+     */ 
+    int getBodyType();
+
+    /**
+     * This method will be caleld once by the parser to determine
+     * the size of the expected body, if and only if the call to
+     * {@link #getBodyType()} returned {@link HTTPParser.BODY_TYPE_NORMAL}.
+     * 
+     * @return an integer indicating the expected size of the body,
+     *     in bytes.
+     */ 
+    int getBodySize();
+
+    /**
      * This method will be called zero or more times, after
      * the request or response line and the headers have been
      * parsed. It will always follow after a call to
@@ -110,30 +135,58 @@
     void foundBody( ByteBuffer buffer );
 
     /**
-     * This method will be called zero or more times, once
-     * for each header name, after the start line
-     * has been parsed. It will be followed by a call to the
-     * <code>foundBody()</code> method.
+     * This method will be called by the parser if
+     * {@link #getBodyType()} returns
+     * {@link HTTPParser.BODY_TYPE_CHUNKING} to determine whether
+     * any trailers will be present. It will be followed by a call
+     * to the <code>getTrailerNames()</code> method if and only if
+     * this method returns true. It will be followed by a call to
+     * the <code>endMessage()</code> method if and only if this
+     * method returns false.
+     * 
+     * @return true if there are trailers present, false otherwise.
+     */ 
+    boolean hasTrailers();
+
+    /**
+     * This method will be called once by the parser directly after
+     * {@link #hasTrailers()} if and only if that method returned
+     * true.
+     * 
+     * @return a non-empty array of non-null strings representing
+     *     the trailers that will be present. 
+     */ 
+    String[] getTrailerNames();
+
+    /**
+     * This method will be called one or more times, once
+     * for each trailer name, after the body
+     * has been parsed, if and only if {@link #hasTrailers()} returned
+     * true. It will be followed by a call to the
+     * <code>foundTrailerValue()</code> method. Only trailer
+     * names that have been returned from the parser's call to
+     * {@link #getTrailerNames()} will be provided.
      *
-     * @param footer the name of the footer that was found
+     * @param trailer the name of the trailer that was found.
      */
-    void foundFooterName( ByteBuffer footer );
+    void foundTrailerName( ByteBuffer trailer );
 
     /**
-     * This method will be called zero or more times, once
-     * for each footer value, after the body
-     * has been parsed. It will always follow immediately after
-     * the <code>foundFooterName()</code> has been called.
+     * This method will be called one or more times, once
+     * for each footer value, after the body has been parsed, if and
+     * only if {@link #hasTrailers()} returned
+     * true. It will always follow immediately after
+     * the <code>foundTrailerName()</code> has been called.
      *
-     * @param value the value of the footer that was found
+     * @param value the value of the trailer that was found.
      */
-    void foundFooterValue( ByteBuffer value );
+    void foundTrailerValue( ByteBuffer value );
 
     /**
      * This method will be called by the parser to signal that
-     * the current message has ended.
+     * the current message has ended. It will always be called
+     * exactly once.
      */
     void endMessage();
 
-    boolean hasTrailers();
 }

Index: HTTPEncoding.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/api/src/java/org/jicarilla/http/HTTPEncoding.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- HTTPEncoding.java	26 Feb 2004 16:51:54 -0000	1.4
+++ HTTPEncoding.java	3 Apr 2004 10:13:23 -0000	1.5
@@ -595,6 +595,7 @@
     //
     public static final String HEADER_CONTENT_LENGTH = "content-length";
     public static final String HEADER_TRANSFER_ENCODING = "transfer-encoding";
+    public static final String HEADER_TRAILER = "trailer";
 
     public static final ByteBuffer HEADER_CONTENT_LENGTH_BUFFER;
 



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.