You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ad...@apache.org on 2004/08/03 06:11:09 UTC

cvs commit: jakarta-commons/httpclient/xdocs logging.xml tutorial.xml userguide.xml

adrian      2004/08/02 21:11:09

  Modified:    httpclient/xdocs logging.xml tutorial.xml userguide.xml
  Log:
  Minor documentation updates.
  
  * Remove "To be completed" from the index pages.  Those pages were completed long ago.
  * Moved the call to releaseConnection into a finally block in the tutorial (that code is getting copied into a lot of projects so we should probably get it right).
  * Added a note that users should ensure that log4j is configured to avoid performance problems.  (Bug 29973)
  
  Revision  Changes    Path
  1.14      +6 -1      jakarta-commons/httpclient/xdocs/logging.xml
  
  Index: logging.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/xdocs/logging.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- logging.xml	5 Jul 2004 20:47:53 -0000	1.13
  +++ logging.xml	3 Aug 2004 04:11:09 -0000	1.14
  @@ -142,6 +142,11 @@
   log4j.logger.org.apache.commons.httpclient=DEBUG<br />
                   </blockquote>
                </p>          
  +             <p>Note that the default configuration for Log4J is very
  +             inefficient as it causes all the logging information to be
  +             generated but not actually sent anywhere.  The Log4J manual is the
  +             best reference for how to configure Log4J.  It is available at <a
  +             href="http://logging.apache.org/log4j/docs/manual.html">http://logging.apache.org/log4j/docs/manual.html</a>
             </subsection>
         </section>
      </body>
  
  
  
  1.6       +32 -27    jakarta-commons/httpclient/xdocs/tutorial.xml
  
  Index: tutorial.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/xdocs/tutorial.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- tutorial.xml	23 Feb 2004 23:05:43 -0000	1.5
  +++ tutorial.xml	3 Aug 2004 04:11:09 -0000	1.6
  @@ -207,39 +207,44 @@
   
               // Create a method instance.
               HttpMethod method = new GetMethod(url);
  -
  -            // Execute the method.
  -            int statusCode = -1;
  -            // We will retry up to 3 times.
  -            for (int attempt = 0; statusCode == -1 && attempt < 3; attempt++) {
  -              try {
  -                // execute the method.
  -                statusCode = client.executeMethod(method);
  -              } catch (HttpRecoverableException e) {
  -                System.err.println(
  -                  "A recoverable exception occurred, retrying." + 
  -                  e.getMessage());
  -              } catch (IOException e) {
  -                System.err.println("Failed to download file.");
  -                e.printStackTrace();
  -                System.exit(-1);
  +            
  +            try {
  +              // Execute the method.
  +              int statusCode = -1;
  +              byte[] responseBody = null;
  +              // We will retry up to 3 times.
  +              for (int attempt = 0; statusCode == -1 && attempt < 3; attempt++) {
  +                try {
  +                  // execute the method.
  +                  statusCode = client.executeMethod(method);
  +                } catch (HttpRecoverableException e) {
  +                  System.err.println(
  +                    "A recoverable exception occurred, retrying." + 
  +                    e.getMessage());
  +                } catch (IOException e) {
  +                  System.err.println("Failed to download file.");
  +                  e.printStackTrace();
  +                  System.exit(-1);
  +                }
  +              }
  +              // Check that we didn't run out of retries.
  +              if (statusCode == -1) {
  +                System.err.println("Failed to recover from exception.");
  +                System.exit(-2);
                 }
  -            }
  -            // Check that we didn't run out of retries.
  -            if (statusCode == -1) {
  -              System.err.println("Failed to recover from exception.");
  -              System.exit(-2);
  -            }
   
  -            // Read the response body.
  -            byte[] responseBody = method.getResponseBody();
  +              // Read the response body.
  +              responseBody = method.getResponseBody();
   
  -            // Release the connection.
  -            method.releaseConnection();
  +            } finally {
  +              // Release the connection.
  +              method.releaseConnection();
  +            }
   
               // Deal with the response.
               // Use caution: ensure correct character encoding and is not binary data
               System.err.println(new String(responseBody));
  +
             }
           }
         ]]></source>
  
  
  
  1.3       +4 -4      jakarta-commons/httpclient/xdocs/userguide.xml
  
  Index: userguide.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/xdocs/userguide.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- userguide.xml	21 Aug 2003 16:08:54 -0000	1.2
  +++ userguide.xml	3 Aug 2004 04:11:09 -0000	1.3
  @@ -30,13 +30,13 @@
           </tr>
           <tr>
             <td><a href="charencodings.html">Character Encodings</a></td>
  -          <td>To be completed.  Guidelines for correctly detecting the
  +          <td>Guidelines for correctly detecting the
             character encoding to use when sending and receiving data with
             HttpClient.</td>
           </tr>
           <tr>
             <td><a href="redirects.html">Cross Host Redirects</a></td>
  -          <td>To be completed.  Provide sample code for handling redirects
  +          <td>Provide sample code for handling redirects
             across hosts.</td>
           </tr>
           <tr>
  @@ -46,7 +46,7 @@
           </tr>
           <tr>
             <td><a href="methods.html">Methods</a></td>
  -          <td>To be completed.  This document describes the various methods
  +          <td>This document describes the various methods
             that are provided by HttpClient and how to use them.</td>
           </tr>
           <tr>
  
  
  

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