marcsaeg    02/02/22 11:22:07

  Modified:    httpclient/src/java/org/apache/commons/httpclient/methods
                        GetMethod.java
  Log:
  Changed readResponseBody() to use new implementation in HttpMethodBase
  that takes the OutputStream parameter.
  
  Revision  Changes    Path
  1.9       +4 -39     
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- GetMethod.java    12 Feb 2002 00:46:58 -0000      1.8
  +++ GetMethod.java    22 Feb 2002 19:22:07 -0000      1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java,v
 1.8 2002/02/12 00:46:58 dion Exp $
  - * $Revision: 1.8 $
  - * $Date: 2002/02/12 00:46:58 $
  + * $Header: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java,v
 1.9 2002/02/22 19:22:07 marcsaeg Exp $
  + * $Revision: 1.9 $
  + * $Date: 2002/02/22 19:22:07 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -384,41 +384,7 @@
               out = new ByteArrayOutputStream();
           }
   
  -        int expectedLength = -1;
  -        int foundLength = 0;
  -        {
  -            Header lengthHeader = getResponseHeader("Content-Length");
  -            if(null != lengthHeader) {
  -                try {
  -                    expectedLength = Integer.parseInt(lengthHeader.getValue());
  -                } catch(NumberFormatException e) {
  -                    // ignored
  -                }
  -            }
  -        }
  -        InputStream is = conn.getResponseInputStream(this);
  -        byte[] buffer = new byte[4096];
  -        int nb = 0;
  -        while (true) {
  -            nb = is.read(buffer);
  -            if (nb == -1)
  -                break;
  -            if (out == null)
  -                throw new IOException("Unable to buffer data");
  -            if(wireLog.isInfoEnabled()) {
  -                wireLog.info("<< \"" + new String(buffer,0,nb) + "\"");
  -            }
  -            out.write(buffer, 0, nb);
  -            foundLength += nb;
  -            if(expectedLength > -1) {
  -                if(foundLength == expectedLength) {
  -                    break;
  -                } else if(foundLength > expectedLength) {
  -                    log.warn("GetMethod.readResponseBody(): expected length (" + 
expectedLength + ") exceeded.  Found " + foundLength + " bytes.");
  -                    break;
  -                }
  -            }
  -        }
  +        readResponseBody(state, conn, out);
   
           if (!useDisk) {
               memoryData = ((ByteArrayOutputStream) out).toByteArray();
  @@ -426,5 +392,4 @@
   
           out.close();
       }
  -
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to