You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/11/06 18:50:51 UTC

svn commit: r1712993 - in /tomcat/trunk/java/org/apache/coyote: Request.java Response.java

Author: markt
Date: Fri Nov  6 17:50:51 2015
New Revision: 1712993

URL: http://svn.apache.org/viewvc?rev=1712993&view=rev
Log:
Javadoc

Modified:
    tomcat/trunk/java/org/apache/coyote/Request.java
    tomcat/trunk/java/org/apache/coyote/Response.java

Modified: tomcat/trunk/java/org/apache/coyote/Request.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/Request.java?rev=1712993&r1=1712992&r2=1712993&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/Request.java (original)
+++ tomcat/trunk/java/org/apache/coyote/Request.java Fri Nov  6 17:50:51 2015
@@ -225,11 +225,11 @@ public final class Request {
     }
 
     /**
-     * Return the buffer holding the server name, if
-     * any. Use isNull() to check if there is no value
-     * set.
-     * This is the "virtual host", derived from the
-     * Host: header.
+     * Get the "virtual host", derived from the Host: header associated with
+     * this request.
+     *
+     * @return The buffer holding the server name, if any. Use isNull() to check
+     *         if there is no value set.
      */
     public MessageBytes serverName() {
         return serverNameMB;
@@ -280,6 +280,10 @@ public final class Request {
 
     /**
      * Get the character encoding used for this request.
+     *
+     * @return The value set via {@link #setCharacterEncoding(String)} or if no
+     *         call has been made to that method try to obtain if from the
+     *         content type.
      */
     public String getCharacterEncoding() {
 
@@ -483,11 +487,18 @@ public final class Request {
     /**
      * Read data from the input buffer and put it into a byte chunk.
      *
-     * The buffer is owned by the protocol implementation - it will be reused on the next read.
-     * The Adapter must either process the data in place or copy it to a separate buffer if it needs
-     * to hold it. In most cases this is done during byte->char conversions or via InputStream. Unlike
-     * InputStream, this interface allows the app to process data in place, without copy.
+     * The buffer is owned by the protocol implementation - it will be reused on
+     * the next read. The Adapter must either process the data in place or copy
+     * it to a separate buffer if it needs to hold it. In most cases this is
+     * done during byte->char conversions or via InputStream. Unlike
+     * InputStream, this interface allows the app to process data in place,
+     * without copy.
+     *
+     * @param chunk The destination to which to copy the data
      *
+     * @return The number of bytes copied
+     *
+     * @throws IOException If an I/O error occurs during the copy
      */
     public int doRead(ByteChunk chunk) throws IOException {
         int n = inputBuffer.doRead(chunk);
@@ -522,10 +533,6 @@ public final class Request {
      * be faster than ThreadLocal for very frequent operations.
      *
      *  Example use:
-     *   Jk:
-     *     HandlerRequest.HOSTBUFFER = 10 CharChunk, buffer for Host decoding
-     *     WorkerEnv: SSL_CERT_NOTE=16 - MessageBytes containing the cert
-     *
      *   Catalina CoyoteAdapter:
      *      ADAPTER_NOTES = 1 - stores the HttpServletRequest object ( req/res)
      *
@@ -534,6 +541,9 @@ public final class Request {
      *   for connector use.
      *
      *   17-31 range is not allocated or used.
+     *
+     * @param pos Index to use to store the note
+     * @param value The value to store at that index
      */
     public final void setNote(int pos, Object value) {
         notes[pos] = value;

Modified: tomcat/trunk/java/org/apache/coyote/Response.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/Response.java?rev=1712993&r1=1712992&r2=1712993&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/Response.java (original)
+++ tomcat/trunk/java/org/apache/coyote/Response.java Fri Nov  6 17:50:51 2015
@@ -180,15 +180,19 @@ public final class Response {
 
 
     /**
-     * Set the response status
+     * Set the response status.
+     *
+     * @param status The status value to set
      */
-    public void setStatus( int status ) {
+    public void setStatus(int status) {
         this.status = status;
     }
 
 
     /**
      * Get the status message.
+     *
+     * @return The message associated with the current status
      */
     public String getMessage() {
         return message;
@@ -197,6 +201,8 @@ public final class Response {
 
     /**
      * Set the status message.
+     *
+     * @param message The status message to set
      */
     public void setMessage(String message) {
         this.message = message;
@@ -228,8 +234,9 @@ public final class Response {
 
 
     /**
-     * Set the error Exception that occurred during
-     * request processing.
+     * Set the error Exception that occurred during request processing.
+     *
+     * @param ex The exception that occurred
      */
     public void setErrorException(Exception ex) {
         errorException = ex;
@@ -237,8 +244,9 @@ public final class Response {
 
 
     /**
-     * Get the Exception that occurred during request
-     * processing.
+     * Get the Exception that occurred during request processing.
+     *
+     * @return The exception that occurred
      */
     public Exception getErrorException() {
         return errorException;
@@ -268,8 +276,14 @@ public final class Response {
 
     // -------------------- Headers --------------------
     /**
+     * Does the response contain the given header.
+     * <br>
      * Warning: This method always returns <code>false</code> for Content-Type
      * and Content-Length.
+     *
+     * @param name The name of the header of interest
+     *
+     * @return {@code true} if the response contains the header.
      */
     public boolean containsHeader(String name) {
         return headers.getHeader(name) != null;
@@ -350,8 +364,10 @@ public final class Response {
     }
 
     /**
-     * Called explicitly by user to set the Content-Language and
-     * the default encoding
+     * Called explicitly by user to set the Content-Language and the default
+     * encoding.
+     *
+     * @param locale The locale to use for this response
      */
     public void setLocale(Locale locale) {
 
@@ -378,6 +394,9 @@ public final class Response {
 
     /**
      * Return the content language.
+     *
+     * @return The language code foe the language currently associated with this
+     *         response
      */
     public String getContentLanguage() {
         return contentLanguage;
@@ -484,6 +503,10 @@ public final class Response {
 
     /**
      * Write a chunk of bytes.
+     *
+     * @param chunk The bytes to write
+     *
+     * @throws IOException If an I/O error occurs during the write
      */
     public void doWrite(ByteChunk chunk) throws IOException {
         outputBuffer.doWrite(chunk);
@@ -517,6 +540,10 @@ public final class Response {
 
     /**
      * Bytes written by application - i.e. before compression, chunking, etc.
+     *
+     * @return The total number of bytes written to the response by the
+     *         application. This will not be the number of bytes written to the
+     *         network which may be more or less than this value.
      */
     public long getContentWritten() {
         return contentWritten;
@@ -524,6 +551,12 @@ public final class Response {
 
     /**
      * Bytes written to socket - i.e. after compression, chunking, etc.
+     *
+     * @param flush Should any remaining bytes be flushed before returning the
+     *              total? If {@code false} bytes remaining in the buffer will
+     *              not be included in the returned value
+     *
+     * @return The total number of bytes written to the socket for this response
      */
     public long getBytesWritten(boolean flush) {
         if (flush) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org