You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/09/03 03:36:27 UTC

cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods GetMethod.java UrlDeleteMethod.java UrlGetMethod.java UrlHeadMethod.java UrlOptionsMethod.java UrlPutMethod.java

jsdever     2002/09/02 18:36:26

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpConnectionManager.java HttpException.java
                        HttpMethod.java HttpMethodBase.java
                        HttpRecoverableException.java HttpUrlMethod.java
                        ResponseInputStream.java
               httpclient/src/java/org/apache/commons/httpclient/methods
                        GetMethod.java UrlDeleteMethod.java
                        UrlGetMethod.java UrlHeadMethod.java
                        UrlOptionsMethod.java UrlPutMethod.java
  Log:
  Javadoc and other code cleanups.
  
  Contributed by: Ryan Lubke
  
  Revision  Changes    Path
  1.10      +8 -7      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnectionManager.java
  
  Index: HttpConnectionManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnectionManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- HttpConnectionManager.java	28 Jul 2002 18:08:57 -0000	1.9
  +++ HttpConnectionManager.java	3 Sep 2002 01:36:26 -0000	1.10
  @@ -159,7 +159,8 @@
        * @param sURL - a fully specified URL.
        * @return an HttpConnection for the given host:port
        * @exception java.net.MalformedURLException
  -     * @exception org.apache.commons.HttpException - If no connection becomes availble before the timeout expires
  +     * @exception org.apache.commons.httpclient.HttpException -
  +     *            If no connection becomes available before the timeout expires
        */
       public HttpConnection getConnection(String sURL)
       throws HttpException, MalformedURLException {
  @@ -174,7 +175,7 @@
        *
        * @param protocol the protocol to use to get the port for, e.g. http or
        *      https
  -     * @param the port provided with the url (could be -1)
  +     * @param port the port provided with the url (could be -1)
        * @return the port for the specified port and protocol.
        */
       private static int getPort(String protocol, int port) {
  @@ -205,8 +206,8 @@
        *      to become available
        * @return an HttpConnection for the given host:port
        * @exception java.net.MalformedURLException
  -     * @exception org.apache.commons.HttpException - If no connection becomes 
  -     *      availble before the timeout expires
  +     * @exception org.apache.commons.httpclient.HttpException -
  +     *            If no connection becomes available before the timeout expires
        */
       public HttpConnection getConnection(String sURL, long timeout) 
       throws HttpException, MalformedURLException {
  
  
  
  1.8       +13 -4     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.java
  
  Index: HttpException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- HttpException.java	8 Aug 2002 18:21:55 -0000	1.7
  +++ HttpException.java	3 Sep 2002 01:36:26 -0000	1.8
  @@ -69,10 +69,19 @@
    * @version $Revision$ $Date$
    */
   public class HttpException extends Exception {
  +
  +    /**
  +     * Creates a new HttpException.
  +     */
       public HttpException() {
           super();
       }
   
  +    /**
  +     * Creates a new HttpException with the specified message.
  +     *
  +     * @param message exception message
  +     */
       public HttpException(String message) {
           super(message);
       }
  
  
  
  1.16      +4 -5      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java
  
  Index: HttpMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- HttpMethod.java	2 Sep 2002 14:52:47 -0000	1.15
  +++ HttpMethod.java	3 Sep 2002 01:36:26 -0000	1.16
  @@ -169,7 +169,6 @@
        * Remove all request headers associated with the given name.
        * Note that header-name matching is case insensitive.
        * @param headerName the header name
  -     * @return the header
        */
       public void removeRequestHeader(String headerName);
   
  
  
  
  1.54      +9 -11     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
  
  Index: HttpMethodBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- HttpMethodBase.java	2 Sep 2002 16:16:10 -0000	1.53
  +++ HttpMethodBase.java	3 Sep 2002 01:36:26 -0000	1.54
  @@ -649,16 +649,14 @@
        * exists, the new value will be appended onto the the existing value
        * list.  A <i>header</i> value of <code>null</code> will be ignored. Note
        * that header-name matching is case insensitive.
  -     * 
  -     * @param header the header to add to the request
        */
       private void closeConnection(HttpConnection connection) {
  -        if (shouldCloseConnection(connection)) {
  +        if (shouldCloseConnection()) {
               connection.close();
           }
       }
   
  -    private boolean shouldCloseConnection(HttpConnection connection) {
  +    private boolean shouldCloseConnection() {
           if (!http11) {
               if (getName().equals(ConnectMethod.NAME) && 
                       (statusCode == HttpStatus.SC_OK)) {
  @@ -727,7 +725,7 @@
               Authenticator.authenticateProxy(this, state);
           }
   
  -        Set visited = new HashSet();
  +        //Set visited = new HashSet();
           realms = new HashSet();
           proxyRealms = new HashSet();
           int forwardCount = 0; //protect from an infinite loop
  @@ -1514,7 +1512,7 @@
        *
        * @param state the client state
        * @param conn the {@link HttpConnection} to read the response from
  -     * @returns InputStream to read the response body from
  +     * @return InputStream to read the response body from
        */
       private InputStream _readResponseBody(HttpState state, HttpConnection conn) throws IOException {
           log.trace("enter HttpMethodBase.readResponseBody(HttpState, HttpConnection)");
  @@ -1543,7 +1541,7 @@
           }
           if (result == null) return null;
   
  -        if (shouldCloseConnection(conn)) {
  +        if (shouldCloseConnection()) {
               result = new AutoCloseInputStream(result, conn);
           }
           return result;
  
  
  
  1.4       +14 -4     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverableException.java
  
  Index: HttpRecoverableException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverableException.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HttpRecoverableException.java	8 Aug 2002 18:21:56 -0000	1.3
  +++ HttpRecoverableException.java	3 Sep 2002 01:36:26 -0000	1.4
  @@ -71,10 +71,20 @@
    * @version $Revision$ $Date$
    */
   public class HttpRecoverableException extends HttpException {
  +
  +    /**
  +     * Creates a new HttpRecoverableException.
  +     */
       public HttpRecoverableException() {
           super();
       }
   
  +    /**
  +     * Creates a new HttpRecoverableException with the
  +     * specified message.
  +     *
  +     * @param message exception message
  +     */
       public HttpRecoverableException(String message) {
           super(message);
       }
  
  
  
  1.5       +4 -4      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.java
  
  Index: HttpUrlMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HttpUrlMethod.java	1 Sep 2002 01:27:37 -0000	1.4
  +++ HttpUrlMethod.java	3 Sep 2002 01:36:26 -0000	1.5
  @@ -82,7 +82,7 @@
        * HttpMethod.setQueryString() is called.
        * 
        * @param url - the URL for this request.
  -     * @throws MalformedURLException when the {@link URL} can't be created
  +     * @throws MalformedURLException when the <i>url</i> can't be created
        */
       void setUrl(String url) throws MalformedURLException;
   
  
  
  
  1.19      +11 -14    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java
  
  Index: ResponseInputStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ResponseInputStream.java	9 Aug 2002 11:38:58 -0000	1.18
  +++ ResponseInputStream.java	3 Sep 2002 01:36:26 -0000	1.19
  @@ -411,7 +411,6 @@
        * until it reads a certain number of bytes or reaches a newline character,
        * which it reads into the array as well.
        *
  -     * @param input Input stream on which the bytes are read
        * @return The line that was read, or <code>null</code> if end-of-file
        *  was encountered
        * @exception IOException   if an input or output exception has occurred
  @@ -420,24 +419,22 @@
       throws IOException {
           log.trace("enter ResponseInputStream.ReadLineFromStream()");
   
  -	//TODO: Reformat this code
           StringBuffer sb = new StringBuffer();
           while (true) {
               int ch = stream.read();
               if (ch < 0) {
  -            if (sb.length() == 0) {
  -                return (null);
  -            } else {
  -                break;
  -            }
  +                if (sb.length() == 0) {
  +                    return (null);
  +                } else {
  +                    break;
  +                }
               } else if (ch == '\r') {
  -            continue;
  +                continue;
               } else if (ch == '\n') {
  -            break;
  +                break;
               }
               sb.append((char) ch);
           }
           return (sb.toString());
  -
       }
   }
  
  
  
  1.18      +4 -6      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java
  
  Index: GetMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- GetMethod.java	2 Sep 2002 14:52:48 -0000	1.17
  +++ GetMethod.java	3 Sep 2002 01:36:26 -0000	1.18
  @@ -61,8 +61,6 @@
    */
   package org.apache.commons.httpclient.methods;
   
  -import java.io.ByteArrayInputStream;
  -import java.io.ByteArrayOutputStream;
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.FileOutputStream;
  @@ -72,9 +70,9 @@
   import java.net.URLEncoder;
   
   import org.apache.commons.httpclient.HttpConnection;
  +import org.apache.commons.httpclient.HttpException;
   import org.apache.commons.httpclient.HttpMethodBase;
   import org.apache.commons.httpclient.HttpState;
  -import org.apache.commons.httpclient.HttpException;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  
  
  
  1.7       +4 -4      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java
  
  Index: UrlDeleteMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- UrlDeleteMethod.java	28 Jul 2002 18:08:59 -0000	1.6
  +++ UrlDeleteMethod.java	3 Sep 2002 01:36:26 -0000	1.7
  @@ -88,7 +88,7 @@
   
       /**
        * Path-setting constructor.
  -     * @param path the path to request
  +     * @param url the path of the request
        */
       public UrlDeleteMethod(String url) throws MalformedURLException {
           super(URIUtil.getPath(url));
  
  
  
  1.7       +6 -6      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGetMethod.java
  
  Index: UrlGetMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGetMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- UrlGetMethod.java	28 Jul 2002 18:08:59 -0000	1.6
  +++ UrlGetMethod.java	3 Sep 2002 01:36:26 -0000	1.7
  @@ -105,7 +105,7 @@
   
       /**
        * Constructor.
  -     * @param path the path to request
  +     * @param url the path of the request
        * @param tempDir the directory in which to store temporary files
        * @param tempFile the file (under tempDir) to buffer contents to
        * @exception java.net.MalformedURLException
  @@ -118,8 +118,8 @@
   
       /**
        * Constructor.
  -     * @param path the path to request
  -     * @param tempFile the file to buffer contents to
  +     * @param url the path of the request
  +     * @param fileData the file to buffer contents to
        * @exception java.net.MalformedURLException
        */
       public UrlGetMethod(String url, File fileData) throws MalformedURLException
  
  
  
  1.7       +4 -4      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHeadMethod.java
  
  Index: UrlHeadMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHeadMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- UrlHeadMethod.java	28 Jul 2002 18:08:59 -0000	1.6
  +++ UrlHeadMethod.java	3 Sep 2002 01:36:26 -0000	1.7
  @@ -87,7 +87,7 @@
   
       /**
        * Path-setting constructor.
  -     * @param path the path to request
  +     * @param url the path of the request
        */
       public UrlHeadMethod(String url) throws MalformedURLException
       {
  
  
  
  1.7       +4 -4      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java
  
  Index: UrlOptionsMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- UrlOptionsMethod.java	28 Jul 2002 18:08:59 -0000	1.6
  +++ UrlOptionsMethod.java	3 Sep 2002 01:36:26 -0000	1.7
  @@ -87,7 +87,7 @@
   
       /**
        * Path-setting constructor.
  -     * @param path the path to request
  +     * @param url the path of the request
        */
       public UrlOptionsMethod(String url) throws MalformedURLException
       {
  
  
  
  1.7       +4 -4      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPutMethod.java
  
  Index: UrlPutMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPutMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- UrlPutMethod.java	28 Jul 2002 18:08:59 -0000	1.6
  +++ UrlPutMethod.java	3 Sep 2002 01:36:26 -0000	1.7
  @@ -87,7 +87,7 @@
   
       /**
        * Path-setting constructor.
  -     * @param path the path to request
  +     * @param url the path of the request
        */
       public UrlPutMethod(String url) throws MalformedURLException {
           super(URIUtil.getPath(url));
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>