You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ol...@apache.org on 2003/02/12 14:21:27 UTC
cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient RequestOutputStream.java ResponseInputStream.java
olegk 2003/02/12 05:21:27
Modified: httpclient/src/java/org/apache/commons/httpclient
RequestOutputStream.java ResponseInputStream.java
Log:
- ResponseInputStream class deprecated in favour of ChunkedInputStream(HttpConnecion#getResponseInputStream())
- RequestOutputStream class deprecated in favour of ChunkedOutputStream(HttpConnecion#getRequestOutputStream())
Contributed by Oleg Kalnichevski
Revision Changes Path
1.20 +25 -25 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java
Index: RequestOutputStream.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- RequestOutputStream.java 8 Feb 2003 19:22:49 -0000 1.19
+++ RequestOutputStream.java 12 Feb 2003 13:21:27 -0000 1.20
@@ -80,7 +80,7 @@
* @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
* @version $Revision$ $Date$
*
- * @see ResponseInputStream
+ * @deprecated Use new ChunkedOutputStream(HttpConnecion#getRequestOutputStream());
*
*/
public class RequestOutputStream
@@ -93,6 +93,8 @@
* The stream will not use chunking.
*
* @param stream wrapped output stream. Must be non-null.
+ *
+ * @deprecated Use ChunkedOutputStream;
*/
public RequestOutputStream(OutputStream stream) {
this(stream, false);
@@ -104,6 +106,8 @@
* @param stream wrapped output stream. Must be non-null.
* @param useChunking when <code>true</code>, the chunked transfer encoding
* will be used
+ *
+ * @deprecated Use ChunkedOutputStream;
*/
public RequestOutputStream(OutputStream stream, boolean useChunking) {
if (stream == null) {
@@ -118,9 +122,6 @@
/** Log object for this class. */
private static final Log LOG = LogFactory.getLog(RequestOutputStream.class);
- /** Log for any wire messages. */
- private static final Log WIRE_LOG = LogFactory.getLog("httpclient.wire");
-
// ----------------------------------------------------- Instance Variables
/** Has this stream been closed? */
@@ -154,6 +155,8 @@
* Use chunking flag setter.
*
* @param useChunking true if chunking is to be used, false otherwise
+ *
+ * @deprecated Use ChunkedOutputStream;
*/
public void setUseChunking(boolean useChunking) {
this.useChunking = useChunking;
@@ -164,6 +167,8 @@
* Use chunking flag getter.
*
* @return true if chunking is to be used, false otherwise
+ *
+ * @deprecated Use ChunkedOutputStream;
*/
public boolean isUseChunking() {
return useChunking;
@@ -177,6 +182,8 @@
*
* @param s the <code>String</code> to send to the client. Must be non-null.
* @throws IOException if an input or output exception occurred
+ *
+ * @deprecated Use ChunkedOutputStream;
*/
public void print(String s) throws IOException {
LOG.trace("enter RequestOutputStream.print(String)");
@@ -194,6 +201,8 @@
* Writes a carriage return-line feed (CRLF) to the client.
*
* @throws IOException if an input or output exception occurred
+ *
+ * @deprecated Use ChunkedOutputStream;
*/
public void println() throws IOException {
print("\r\n");
@@ -205,6 +214,8 @@
*
* @param s the </code>String</code> to write to the client
* @exception IOException if an input or output exception occurred
+ *
+ * @deprecated Use ChunkedOutputStream;
*/
public void println(String s) throws IOException {
print(s);
@@ -218,6 +229,8 @@
*
* @param b The byte to be written
* @throws IOException if an input/output error occurs
+ *
+ * @deprecated Use ChunkedOutputStream;
*/
public void write(int b) throws IOException {
@@ -227,15 +240,8 @@
stream.write(CRLF, 0, CRLF.length);
stream.write(b);
stream.write(ENDCHUNK, 0, ENDCHUNK.length);
- if (WIRE_LOG.isDebugEnabled()) {
- WIRE_LOG.debug(">> byte 1 \\r\\n (chunk length \"header\")");
- WIRE_LOG.debug(">> byte " + b + "\\r\\n (chunked byte)");
- }
} else {
stream.write(b);
- if (WIRE_LOG.isDebugEnabled()) {
- WIRE_LOG.debug(">> byte " + b);
- }
}
}
@@ -246,6 +252,8 @@
* @param off the offset within <code>b</code> to start writing from
* @param len the length of data within <code>b</code> to write
* @throws IOException when errors occur writing output
+ *
+ * @deprecated Use ChunkedOutputStream;
*/
public void write(byte[] b, int off, int len) throws IOException {
LOG.trace("enter RequestOutputStream.write(byte[], int, int)");
@@ -255,17 +263,8 @@
stream.write(chunkHeader, 0, chunkHeader.length);
stream.write(b, off, len);
stream.write(ENDCHUNK, 0, ENDCHUNK.length);
- if (WIRE_LOG.isDebugEnabled()) {
- WIRE_LOG.debug(">> byte(s)" + len + " \\r\\n (chunk length "
- + "\"header\")");
- WIRE_LOG.debug(">> \"" + new String(b, off, len)
- + "\"\\r\\n (chunked bytes)");
- }
} else {
stream.write(b, off, len);
- if (WIRE_LOG.isDebugEnabled() && len > 0) {
- WIRE_LOG.debug(">> \"" + new String(b, off, len) + "\"");
- }
}
}
@@ -274,6 +273,8 @@
* any further output data to throw an IOException.
*
* @throws IOException if an error occurs closing the stream
+ *
+ * @deprecated Use ChunkedOutputStream;
*/
public void close() throws IOException {
LOG.trace("enter RequestOutputStream.close()");
@@ -285,7 +286,6 @@
stream.write(ZERO, 0, ZERO.length);
stream.write(CRLF, 0, CRLF.length);
stream.write(ENDCHUNK, 0, ENDCHUNK.length);
- WIRE_LOG.debug(">> byte 0 \\r\\n\\r\\n (final chunk)");
}
} catch (IOException ioe) {
LOG.debug("Unexpected exception caught when closing output "
1.23 +18 -9 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.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- ResponseInputStream.java 30 Jan 2003 05:01:54 -0000 1.22
+++ ResponseInputStream.java 12 Feb 2003 13:21:27 -0000 1.23
@@ -78,7 +78,7 @@
* @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
* @version $Revision$ $Date$
*
- * @see RequestOutputStream
+ * @deprecated Use new ChunkedInputStream(HttpConnecion#getResponseInputStream());
*
*/
public class ResponseInputStream extends InputStream {
@@ -88,10 +88,6 @@
/** Log object for this class. */
public static final Log LOG = LogFactory.getLog(ResponseInputStream.class);
- /** Log for wire messages. */
- public static final Log WIRE_LOG = LogFactory.getLog("httpclient.wire");
-
-
// ----------------------------------------------------------- Constructors
/**
@@ -100,6 +96,7 @@
* @param chunked <code>true</code> if the input stream is chunked
* @param contentLength content length
*
+ * @deprecated Use ChunkedInputStream;
*/
public ResponseInputStream(InputStream stream, boolean chunked, int contentLength) {
LOG.trace("enter ResponseInputStream(InputStream, boolean, int)");
@@ -120,6 +117,8 @@
* @param stream Must be non-null.
* @param method Must be non-null.
*
+ * @deprecated Use ChunkedInputStream;
+ *
*/
public ResponseInputStream(InputStream stream, HttpMethod method) {
super();
@@ -215,6 +214,8 @@
* consumed, the remaining bytes will be swallowed.
*
* @throws IOException If an IO problem occurs.
+ *
+ * @deprecated Use ChunkedInputStream;
*/
public void close() throws IOException {
LOG.trace("enter ResponseInputStream.close()");
@@ -269,6 +270,8 @@
* @return The number of bytes that were read.
*
* @exception IOException if an input/output error occurs
+ *
+ * @deprecated Use ChunkedInputStream;
*/
public int read(byte b[], int off, int len)
throws IOException {
@@ -304,6 +307,8 @@
*
* @return The next byte in the stream or -1.
* @exception IOException if an input/output error occurs
+ *
+ * @deprecated Use ChunkedInputStream;
*/
public int read() throws IOException {
LOG.trace("enter ResponseInputStream.read()");
@@ -325,6 +330,8 @@
* Fill the chunk buffer.
* @return true If successful
* @throws IOException If an IO problem occurs.
+ *
+ * @deprecated Use ChunkedInputStream;
*/
private boolean fillBuffer() throws IOException {
LOG.trace("enter ResponseInputStream.fillBuffer()");
@@ -431,6 +438,8 @@
* @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
+ *
+ * @deprecated Use ChunkedInputStream;
*/
private String readLineFromStream()
throws IOException {
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org