You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2010/04/23 15:44:05 UTC
svn commit: r937295 [3/9] - in /httpcomponents/httpcore/trunk/httpcore/src:
main/java/org/apache/http/ main/java/org/apache/http/entity/
main/java/org/apache/http/impl/ main/java/org/apache/http/impl/entity/
main/java/org/apache/http/impl/io/ main/java...
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/LaxContentLengthStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/LaxContentLengthStrategy.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/LaxContentLengthStrategy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/LaxContentLengthStrategy.java Fri Apr 23 13:44:00 2010
@@ -39,18 +39,18 @@ import org.apache.http.params.CoreProtoc
import org.apache.http.protocol.HTTP;
/**
- * The lax implementation of the content length strategy. This class will ignore
- * unrecognized transfer encodings and malformed <code>Content-Length</code>
- * header values if the {@link CoreProtocolPNames#STRICT_TRANSFER_ENCODING}
- * parameter of the given message is not set or set to <code>false</code>.
+ * The lax implementation of the content length strategy. This class will ignore
+ * unrecognized transfer encodings and malformed <code>Content-Length</code>
+ * header values if the {@link CoreProtocolPNames#STRICT_TRANSFER_ENCODING}
+ * parameter of the given message is not set or set to <code>false</code>.
* <p>
* This class recognizes "chunked" and "identitiy" transfer-coding only.
* <p>
- * The following parameters can be used to customize the behavior of this class:
+ * The following parameters can be used to customize the behavior of this class:
* <ul>
* <li>{@link org.apache.http.params.CoreProtocolPNames#STRICT_TRANSFER_ENCODING}</li>
* </ul>
- *
+ *
* @since 4.0
*/
public class LaxContentLengthStrategy implements ContentLengthStrategy {
@@ -64,9 +64,9 @@ public class LaxContentLengthStrategy im
throw new IllegalArgumentException("HTTP message may not be null");
}
- HttpParams params = message.getParams();
+ HttpParams params = message.getParams();
boolean strict = params.isParameterTrue(CoreProtocolPNames.STRICT_TRANSFER_ENCODING);
-
+
Header transferEncodingHeader = message.getFirstHeader(HTTP.TRANSFER_ENCODING);
Header contentLengthHeader = message.getFirstHeader(HTTP.CONTENT_LEN);
// We use Transfer-Encoding if present and ignore Content-Length.
@@ -84,7 +84,7 @@ public class LaxContentLengthStrategy im
// Currently only chunk and identity are supported
for (int i = 0; i < encodings.length; i++) {
String encoding = encodings[i].getName();
- if (encoding != null && encoding.length() > 0
+ if (encoding != null && encoding.length() > 0
&& !encoding.equalsIgnoreCase(HTTP.CHUNK_CODING)
&& !encoding.equalsIgnoreCase(HTTP.IDENTITY_CODING)) {
throw new ProtocolException("Unsupported transfer encoding: " + encoding);
@@ -94,15 +94,15 @@ public class LaxContentLengthStrategy im
// The chunked encoding must be the last one applied RFC2616, 14.41
int len = encodings.length;
if (HTTP.IDENTITY_CODING.equalsIgnoreCase(transferEncodingHeader.getValue())) {
- return IDENTITY;
+ return IDENTITY;
} else if ((len > 0) && (HTTP.CHUNK_CODING.equalsIgnoreCase(
- encodings[len - 1].getName()))) {
+ encodings[len - 1].getName()))) {
return CHUNKED;
} else {
if (strict) {
throw new ProtocolException("Chunk-encoding must be the last one applied");
}
- return IDENTITY;
+ return IDENTITY;
}
} else if (contentLengthHeader != null) {
long contentlen = -1;
@@ -131,5 +131,5 @@ public class LaxContentLengthStrategy im
return IDENTITY;
}
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/StrictContentLengthStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/StrictContentLengthStrategy.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/StrictContentLengthStrategy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/StrictContentLengthStrategy.java Fri Apr 23 13:44:00 2010
@@ -38,11 +38,11 @@ import org.apache.http.protocol.HTTP;
/**
* The strict implementation of the content length strategy. This class
* will throw {@link ProtocolException} if it encounters an unsupported
- * transfer encoding or a malformed <code>Content-Length</code> header
+ * transfer encoding or a malformed <code>Content-Length</code> header
* value.
* <p>
* This class recognizes "chunked" and "identitiy" transfer-coding only.
- *
+ *
* @since 4.0
*/
public class StrictContentLengthStrategy implements ContentLengthStrategy {
@@ -50,7 +50,7 @@ public class StrictContentLengthStrategy
public StrictContentLengthStrategy() {
super();
}
-
+
public long determineLength(final HttpMessage message) throws HttpException {
if (message == null) {
throw new IllegalArgumentException("HTTP message may not be null");
@@ -65,7 +65,7 @@ public class StrictContentLengthStrategy
if (HTTP.CHUNK_CODING.equalsIgnoreCase(s)) {
if (message.getProtocolVersion().lessEquals(HttpVersion.HTTP_1_0)) {
throw new ProtocolException(
- "Chunked transfer encoding not allowed for " +
+ "Chunked transfer encoding not allowed for " +
message.getProtocolVersion());
}
return CHUNKED;
@@ -84,7 +84,7 @@ public class StrictContentLengthStrategy
throw new ProtocolException("Invalid content length: " + s);
}
} else {
- return IDENTITY;
+ return IDENTITY;
}
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java Fri Apr 23 13:44:00 2010
@@ -45,23 +45,23 @@ import org.apache.http.params.HttpParams
import org.apache.http.util.CharArrayBuffer;
/**
- * Abstract base class for HTTP message parsers that obtain input from
- * an instance of {@link SessionInputBuffer}.
+ * Abstract base class for HTTP message parsers that obtain input from
+ * an instance of {@link SessionInputBuffer}.
* <p>
- * The following parameters can be used to customize the behavior of this
- * class:
+ * The following parameters can be used to customize the behavior of this
+ * class:
* <ul>
* <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_HEADER_COUNT}</li>
* <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_LINE_LENGTH}</li>
* </ul>
- *
+ *
* @since 4.0
*/
public abstract class AbstractMessageParser implements HttpMessageParser {
private static final int HEAD_LINE = 0;
private static final int HEADERS = 1;
-
+
private final SessionInputBuffer sessionBuffer;
private final int maxHeaderCount;
private final int maxLineLen;
@@ -73,7 +73,7 @@ public abstract class AbstractMessagePar
/**
* Creates an instance of this class.
- *
+ *
* @param buffer the session input buffer.
* @param parser the line parser.
* @param params HTTP parameters.
@@ -100,21 +100,21 @@ public abstract class AbstractMessagePar
}
/**
- * Parses HTTP headers from the data receiver stream according to the generic
+ * Parses HTTP headers from the data receiver stream according to the generic
* format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3.
- *
+ *
* @param inbuffer Session input buffer
* @param maxHeaderCount maximum number of headers allowed. If the number
* of headers received from the data stream exceeds maxCount value, an
* IOException will be thrown. Setting this parameter to a negative value
* or zero will disable the check.
* @param maxLineLen maximum number of characters for a header line,
- * including the continuation lines. Setting this parameter to a negative
+ * including the continuation lines. Setting this parameter to a negative
* value or zero will disable the check.
* @return array of HTTP headers
* @param parser line parser to use. Can be <code>null</code>, in which case
* the default implementation of this interface will be used.
- *
+ *
* @throws IOException in case of an I/O error
* @throws HttpException in case of HTTP protocol violation
*/
@@ -125,34 +125,34 @@ public abstract class AbstractMessagePar
LineParser parser)
throws HttpException, IOException {
if (parser == null) {
- parser = BasicLineParser.DEFAULT;
+ parser = BasicLineParser.DEFAULT;
}
List headerLines = new ArrayList();
return parseHeaders(inbuffer, maxHeaderCount, maxLineLen, parser, headerLines);
}
/**
- * Parses HTTP headers from the data receiver stream according to the generic
+ * Parses HTTP headers from the data receiver stream according to the generic
* format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3.
- *
+ *
* @param inbuffer Session input buffer
* @param maxHeaderCount maximum number of headers allowed. If the number
* of headers received from the data stream exceeds maxCount value, an
* IOException will be thrown. Setting this parameter to a negative value
* or zero will disable the check.
* @param maxLineLen maximum number of characters for a header line,
- * including the continuation lines. Setting this parameter to a negative
+ * including the continuation lines. Setting this parameter to a negative
* value or zero will disable the check.
* @param parser line parser to use.
- * @param headerLines List of header lines. This list will be used to store
- * intermediate results. This makes it possible to resume parsing of
+ * @param headerLines List of header lines. This list will be used to store
+ * intermediate results. This makes it possible to resume parsing of
* headers in case of a {@link java.io.InterruptedIOException}.
- *
+ *
* @return array of HTTP headers
- *
+ *
* @throws IOException in case of an I/O error
* @throws HttpException in case of HTTP protocol violation
- *
+ *
* @since 4.1
*/
public static Header[] parseHeaders(
@@ -200,7 +200,7 @@ public abstract class AbstractMessagePar
}
i++;
}
- if (maxLineLen > 0
+ if (maxLineLen > 0
&& previous.length() + 1 + current.length() - i > maxLineLen) {
throw new IOException("Maximum line length limit exceeded");
}
@@ -228,20 +228,20 @@ public abstract class AbstractMessagePar
}
/**
- * Subclasses must override this method to generate an instance of
+ * Subclasses must override this method to generate an instance of
* {@link HttpMessage} based on the initial input from the session buffer.
* <p>
- * Usually this method is expected to read just the very first line or
- * the very first valid from the data stream and based on the input generate
+ * Usually this method is expected to read just the very first line or
+ * the very first valid from the data stream and based on the input generate
* an appropriate instance of {@link HttpMessage}.
- *
+ *
* @param sessionBuffer the session input buffer.
* @return HTTP message based on the input from the session buffer.
* @throws IOException in case of an I/O error.
* @throws HttpException in case of HTTP protocol violation.
* @throws ParseException in case of a parse error.
*/
- protected abstract HttpMessage parseHead(SessionInputBuffer sessionBuffer)
+ protected abstract HttpMessage parseHead(SessionInputBuffer sessionBuffer)
throws IOException, HttpException, ParseException;
public HttpMessage parse() throws IOException, HttpException {
@@ -253,11 +253,11 @@ public abstract class AbstractMessagePar
} catch (ParseException px) {
throw new ProtocolException(px.getMessage(), px);
}
- this.state = HEADERS;
+ this.state = HEADERS;
//$FALL-THROUGH$
case HEADERS:
Header[] headers = AbstractMessageParser.parseHeaders(
- this.sessionBuffer,
+ this.sessionBuffer,
this.maxHeaderCount,
this.maxLineLen,
this.lineParser,
@@ -266,11 +266,11 @@ public abstract class AbstractMessagePar
HttpMessage result = this.message;
this.message = null;
this.headerLines.clear();
- this.state = HEAD_LINE;
+ this.state = HEAD_LINE;
return result;
default:
throw new IllegalStateException("Inconsistent parser state");
}
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageWriter.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageWriter.java Fri Apr 23 13:44:00 2010
@@ -42,19 +42,19 @@ import org.apache.http.util.CharArrayBuf
/**
* Abstract base class for HTTP message writers that serialize output to
- * an instance of {@link SessionOutputBuffer}.
- *
+ * an instance of {@link SessionOutputBuffer}.
+ *
* @since 4.0
*/
public abstract class AbstractMessageWriter implements HttpMessageWriter {
-
- protected final SessionOutputBuffer sessionBuffer;
+
+ protected final SessionOutputBuffer sessionBuffer;
protected final CharArrayBuffer lineBuf;
protected final LineFormatter lineFormatter;
/**
* Creates an instance of AbstractMessageWriter.
- *
+ *
* @param buffer the session output buffer.
* @param formatter the line formatter.
* @param params HTTP parameters.
@@ -71,11 +71,11 @@ public abstract class AbstractMessageWri
this.lineFormatter = (formatter != null) ?
formatter : BasicLineFormatter.DEFAULT;
}
-
+
/**
* Subclasses must override this method to write out the first header line
* based on the {@link HttpMessage} passed as a parameter.
- *
+ *
* @param message the message whose first line is to be written out.
* @throws IOException in case of an I/O error.
*/
@@ -95,5 +95,5 @@ public abstract class AbstractMessageWri
this.lineBuf.clear();
this.sessionBuffer.writeLine(this.lineBuf);
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java Fri Apr 23 13:44:00 2010
@@ -41,17 +41,17 @@ import org.apache.http.util.ByteArrayBuf
import org.apache.http.util.CharArrayBuffer;
/**
- * Abstract base class for session input buffers that stream data from
- * an arbitrary {@link InputStream}. This class buffers input data in
+ * Abstract base class for session input buffers that stream data from
+ * an arbitrary {@link InputStream}. This class buffers input data in
* an internal byte array for optimal input performance.
* <p>
- * {@link #readLine(CharArrayBuffer)} and {@link #readLine()} methods of this
+ * {@link #readLine(CharArrayBuffer)} and {@link #readLine()} methods of this
* class treat a lone LF as valid line delimiters in addition to CR-LF required
- * by the HTTP specification.
+ * by the HTTP specification.
*
* <p>
- * The following parameters can be used to customize the behavior of this
- * class:
+ * The following parameters can be used to customize the behavior of this
+ * class:
* <ul>
* <li>{@link org.apache.http.params.CoreProtocolPNames#HTTP_ELEMENT_CHARSET}</li>
* <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_LINE_LENGTH}</li>
@@ -65,20 +65,20 @@ public abstract class AbstractSessionInp
private byte[] buffer;
private int bufferpos;
private int bufferlen;
-
+
private ByteArrayBuffer linebuffer = null;
-
+
private String charset = HTTP.US_ASCII;
private boolean ascii = true;
private int maxLineLen = -1;
private int minChunkLimit = 512;
-
+
private HttpTransportMetricsImpl metrics;
-
+
/**
- * Initializes this session input buffer.
- *
- * @param instream the source input stream.
+ * Initializes this session input buffer.
+ *
+ * @param instream the source input stream.
* @param buffersize the size of the internal buffer.
* @param params HTTP parameters.
*/
@@ -118,7 +118,7 @@ public abstract class AbstractSessionInp
public int length() {
return this.bufferlen - this.bufferpos;
}
-
+
/**
* @since 4.1
*/
@@ -152,7 +152,7 @@ public abstract class AbstractSessionInp
protected boolean hasBufferedData() {
return this.bufferpos < this.bufferlen;
}
-
+
public int read() throws IOException {
int noRead = 0;
while (!hasBufferedData()) {
@@ -163,7 +163,7 @@ public abstract class AbstractSessionInp
}
return this.buffer[this.bufferpos++] & 0xff;
}
-
+
public int read(final byte[] b, int off, int len) throws IOException {
if (b == null) {
return 0;
@@ -174,7 +174,7 @@ public abstract class AbstractSessionInp
this.bufferpos += chunk;
return chunk;
}
- // If the remaining capacity is big enough, read directly from the
+ // If the remaining capacity is big enough, read directly from the
// underlying input stream bypassing the buffer.
if (len > this.minChunkLimit) {
return this.instream.read(b, off, len);
@@ -192,14 +192,14 @@ public abstract class AbstractSessionInp
return chunk;
}
}
-
+
public int read(final byte[] b) throws IOException {
if (b == null) {
return 0;
}
return read(b, 0, b.length);
}
-
+
private int locateLF() {
for (int i = this.bufferpos; i < this.bufferlen; i++) {
if (this.buffer[i] == HTTP.LF) {
@@ -208,17 +208,17 @@ public abstract class AbstractSessionInp
}
return -1;
}
-
+
/**
- * Reads a complete line of characters up to a line delimiter from this
- * session buffer into the given line buffer. The number of chars actually
- * read is returned as an integer. The line delimiter itself is discarded.
- * If no char is available because the end of the stream has been reached,
- * the value <code>-1</code> is returned. This method blocks until input
+ * Reads a complete line of characters up to a line delimiter from this
+ * session buffer into the given line buffer. The number of chars actually
+ * read is returned as an integer. The line delimiter itself is discarded.
+ * If no char is available because the end of the stream has been reached,
+ * the value <code>-1</code> is returned. This method blocks until input
* data is available, end of file is detected, or an exception is thrown.
* <p>
- * This method treats a lone LF as a valid line delimiters in addition
- * to CR-LF required by the HTTP specification.
+ * This method treats a lone LF as a valid line delimiters in addition
+ * to CR-LF required by the HTTP specification.
*
* @param charbuffer the line buffer.
* @return one line of characters
@@ -234,7 +234,7 @@ public abstract class AbstractSessionInp
// attempt to find end of line (LF)
int i = locateLF();
if (i != -1) {
- // end of line found.
+ // end of line found.
if (this.linebuffer.isEmpty()) {
// the entire line is preset in the read buffer
return lineFromReadBuffer(charbuffer, i);
@@ -265,24 +265,24 @@ public abstract class AbstractSessionInp
}
return lineFromLineBuffer(charbuffer);
}
-
+
/**
- * Reads a complete line of characters up to a line delimiter from this
- * session buffer. The line delimiter itself is discarded. If no char is
- * available because the end of the stream has been reached,
- * <code>null</code> is returned. This method blocks until input data is
+ * Reads a complete line of characters up to a line delimiter from this
+ * session buffer. The line delimiter itself is discarded. If no char is
+ * available because the end of the stream has been reached,
+ * <code>null</code> is returned. This method blocks until input data is
* available, end of file is detected, or an exception is thrown.
* <p>
- * This method treats a lone LF as a valid line delimiters in addition
- * to CR-LF required by the HTTP specification.
- *
+ * This method treats a lone LF as a valid line delimiters in addition
+ * to CR-LF required by the HTTP specification.
+ *
* @return HTTP line as a string
* @exception IOException if an I/O error occurs.
*/
- private int lineFromLineBuffer(final CharArrayBuffer charbuffer)
+ private int lineFromLineBuffer(final CharArrayBuffer charbuffer)
throws IOException {
// discard LF if found
- int l = this.linebuffer.length();
+ int l = this.linebuffer.length();
if (l > 0) {
if (this.linebuffer.byteAt(l - 1) == HTTP.LF) {
l--;
@@ -296,11 +296,11 @@ public abstract class AbstractSessionInp
}
}
}
- l = this.linebuffer.length();
+ l = this.linebuffer.length();
if (this.ascii) {
charbuffer.append(this.linebuffer, 0, l);
} else {
- // This is VERY memory inefficient, BUT since non-ASCII charsets are
+ // This is VERY memory inefficient, BUT since non-ASCII charsets are
// NOT meant to be used anyway, there's no point optimizing it
String s = new String(this.linebuffer.buffer(), 0, l, this.charset);
charbuffer.append(s);
@@ -308,8 +308,8 @@ public abstract class AbstractSessionInp
this.linebuffer.clear();
return l;
}
-
- private int lineFromReadBuffer(final CharArrayBuffer charbuffer, int pos)
+
+ private int lineFromReadBuffer(final CharArrayBuffer charbuffer, int pos)
throws IOException {
int off = this.bufferpos;
int len;
@@ -322,14 +322,14 @@ public abstract class AbstractSessionInp
if (this.ascii) {
charbuffer.append(this.buffer, off, len);
} else {
- // This is VERY memory inefficient, BUT since non-ASCII charsets are
+ // This is VERY memory inefficient, BUT since non-ASCII charsets are
// NOT meant to be used anyway, there's no point optimizing it
String s = new String(this.buffer, off, len, this.charset);
charbuffer.append(s);
}
return len;
}
-
+
public String readLine() throws IOException {
CharArrayBuffer charbuffer = new CharArrayBuffer(64);
int l = readLine(charbuffer);
@@ -339,9 +339,9 @@ public abstract class AbstractSessionInp
return null;
}
}
-
+
public HttpTransportMetrics getMetrics() {
return this.metrics;
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java Fri Apr 23 13:44:00 2010
@@ -41,15 +41,15 @@ import org.apache.http.util.ByteArrayBuf
import org.apache.http.util.CharArrayBuffer;
/**
- * Abstract base class for session output buffers that stream data to
- * an arbitrary {@link OutputStream}. This class buffers small chunks of
+ * Abstract base class for session output buffers that stream data to
+ * an arbitrary {@link OutputStream}. This class buffers small chunks of
* output data in an internal byte array for optimal output performance.
* <p>
- * {@link #writeLine(CharArrayBuffer)} and {@link #writeLine(String)} methods
- * of this class use CR-LF as a line delimiter.
+ * {@link #writeLine(CharArrayBuffer)} and {@link #writeLine(String)} methods
+ * of this class use CR-LF as a line delimiter.
* <p>
- * The following parameters can be used to customize the behavior of this
- * class:
+ * The following parameters can be used to customize the behavior of this
+ * class:
* <ul>
* <li>{@link org.apache.http.params.CoreProtocolPNames#HTTP_ELEMENT_CHARSET}</li>
* <li>{@link org.apache.http.params.CoreConnectionPNames#MIN_CHUNK_LIMIT}</li>
@@ -61,20 +61,20 @@ import org.apache.http.util.CharArrayBuf
public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer, BufferInfo {
private static final byte[] CRLF = new byte[] {HTTP.CR, HTTP.LF};
-
+
private OutputStream outstream;
private ByteArrayBuffer buffer;
-
+
private String charset = HTTP.US_ASCII;
private boolean ascii = true;
private int minChunkLimit = 512;
-
+
private HttpTransportMetricsImpl metrics;
-
+
/**
- * Initializes this session output buffer.
- *
- * @param outstream the destination output stream.
+ * Initializes this session output buffer.
+ *
+ * @param outstream the destination output stream.
* @param buffersize the size of the internal buffer.
* @param params HTTP parameters.
*/
@@ -90,13 +90,13 @@ public abstract class AbstractSessionOut
}
this.outstream = outstream;
this.buffer = new ByteArrayBuffer(buffersize);
- this.charset = HttpProtocolParams.getHttpElementCharset(params);
+ this.charset = HttpProtocolParams.getHttpElementCharset(params);
this.ascii = this.charset.equalsIgnoreCase(HTTP.US_ASCII)
|| this.charset.equalsIgnoreCase(HTTP.ASCII);
this.minChunkLimit = params.getIntParameter(CoreConnectionPNames.MIN_CHUNK_LIMIT, 512);
this.metrics = new HttpTransportMetricsImpl();
}
-
+
/**
* @since 4.1
*/
@@ -110,7 +110,7 @@ public abstract class AbstractSessionOut
public int length() {
return this.buffer.length();
}
-
+
/**
* @since 4.1
*/
@@ -126,12 +126,12 @@ public abstract class AbstractSessionOut
this.metrics.incrementBytesTransferred(len);
}
}
-
+
public void flush() throws IOException {
flushBuffer();
this.outstream.flush();
}
-
+
public void write(final byte[] b, int off, int len) throws IOException {
if (b == null) {
return;
@@ -156,26 +156,26 @@ public abstract class AbstractSessionOut
this.buffer.append(b, off, len);
}
}
-
+
public void write(final byte[] b) throws IOException {
if (b == null) {
return;
}
write(b, 0, b.length);
}
-
+
public void write(int b) throws IOException {
if (this.buffer.isFull()) {
flushBuffer();
}
this.buffer.append(b);
}
-
+
/**
- * Writes characters from the specified string followed by a line delimiter
+ * Writes characters from the specified string followed by a line delimiter
* to this session buffer.
* <p>
- * This method uses CR-LF as a line delimiter.
+ * This method uses CR-LF as a line delimiter.
*
* @param s the line.
* @exception IOException if an I/O error occurs.
@@ -189,12 +189,12 @@ public abstract class AbstractSessionOut
}
write(CRLF);
}
-
+
/**
- * Writes characters from the specified char array followed by a line
+ * Writes characters from the specified char array followed by a line
* delimiter to this session buffer.
* <p>
- * This method uses CR-LF as a line delimiter.
+ * This method uses CR-LF as a line delimiter.
*
* @param s the buffer containing chars of the line.
* @exception IOException if an I/O error occurs.
@@ -219,16 +219,16 @@ public abstract class AbstractSessionOut
remaining -= chunk;
}
} else {
- // This is VERY memory inefficient, BUT since non-ASCII charsets are
+ // This is VERY memory inefficient, BUT since non-ASCII charsets are
// NOT meant to be used anyway, there's no point optimizing it
byte[] tmp = s.toString().getBytes(this.charset);
write(tmp);
}
write(CRLF);
}
-
+
public HttpTransportMetrics getMetrics() {
return this.metrics;
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java Fri Apr 23 13:44:00 2010
@@ -41,8 +41,8 @@ import org.apache.http.util.ExceptionUti
/**
* Implements chunked transfer coding. The content is received in small chunks.
- * Entities transferred using this input stream can be of unlimited length.
- * After the stream is read to the end, it provides access to the trailers,
+ * Entities transferred using this input stream can be of unlimited length.
+ * After the stream is read to the end, it provides access to the trailers,
* if any.
* <p>
* Note that this class NEVER closes the underlying stream, even when close
@@ -60,16 +60,16 @@ public class ChunkedInputStream extends
private static final int CHUNK_LEN = 1;
private static final int CHUNK_DATA = 2;
private static final int CHUNK_CRLF = 3;
-
+
private static final int BUFFER_SIZE = 2048;
-
+
/** The session input buffer */
private final SessionInputBuffer in;
private final CharArrayBuffer buffer;
private int state;
-
+
/** The chunk size */
private int chunkSize;
@@ -81,7 +81,7 @@ public class ChunkedInputStream extends
/** True if this stream is closed */
private boolean closed = false;
-
+
private Header[] footers = new Header[] {};
/**
@@ -103,17 +103,17 @@ public class ChunkedInputStream extends
public int available() throws IOException {
if (this.in instanceof BufferInfo) {
int len = ((BufferInfo) this.in).length();
- return Math.min(len, this.chunkSize - this.pos);
+ return Math.min(len, this.chunkSize - this.pos);
} else {
return 0;
}
}
-
+
/**
* <p> Returns all the data in a chunked stream in coalesced form. A chunk
* is followed by a CRLF. The method returns -1 as soon as a chunksize of 0
* is detected.</p>
- *
+ *
* <p> Trailer headers are read automatically at the end of the stream and
* can be obtained with the getResponseFooters() method.</p>
*
@@ -127,10 +127,10 @@ public class ChunkedInputStream extends
}
if (this.eof) {
return -1;
- }
+ }
if (state != CHUNK_DATA) {
nextChunk();
- if (this.eof) {
+ if (this.eof) {
return -1;
}
}
@@ -160,12 +160,12 @@ public class ChunkedInputStream extends
throw new IOException("Attempted read from closed stream.");
}
- if (eof) {
+ if (eof) {
return -1;
}
if (state != CHUNK_DATA) {
nextChunk();
- if (eof) {
+ if (eof) {
return -1;
}
}
@@ -180,7 +180,7 @@ public class ChunkedInputStream extends
} else {
eof = true;
throw new TruncatedChunkException("Truncated chunk "
- + "( expected size: " + chunkSize
+ + "( expected size: " + chunkSize
+ "; actual size: " + pos + ")");
}
}
@@ -221,9 +221,9 @@ public class ChunkedInputStream extends
* @param in The new input stream.
* @param required <tt>true<tt/> if a valid chunk must be present,
* <tt>false<tt/> otherwise.
- *
+ *
* @return the chunk size as integer
- *
+ *
* @throws IOException when the chunk size could not be parsed
*/
private int getChunkSize() throws IOException {
@@ -235,11 +235,11 @@ public class ChunkedInputStream extends
if (i == -1) {
return 0;
}
- if (!this.buffer.isEmpty()) {
+ if (!this.buffer.isEmpty()) {
throw new MalformedChunkCodingException(
"Unexpected content at the end of chunk");
}
- state = CHUNK_LEN;
+ state = CHUNK_LEN;
//$FALL-THROUGH$
case CHUNK_LEN:
this.buffer.clear();
@@ -270,9 +270,9 @@ public class ChunkedInputStream extends
this.footers = AbstractMessageParser.parseHeaders
(in, -1, -1, null);
} catch (HttpException e) {
- IOException ioe = new MalformedChunkCodingException("Invalid footer: "
+ IOException ioe = new MalformedChunkCodingException("Invalid footer: "
+ e.getMessage());
- ExceptionUtils.initCause(ioe, e);
+ ExceptionUtils.initCause(ioe, e);
throw ioe;
}
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java Fri Apr 23 13:44:00 2010
@@ -38,10 +38,10 @@ import org.apache.http.io.SessionOutputB
* Writes are buffered to an internal buffer (2048 default size).
* <p>
* Note that this class NEVER closes the underlying stream, even when close
- * gets called. Instead, the stream will be marked as closed and no further
+ * gets called. Instead, the stream will be marked as closed and no further
* output will be permitted.
- *
- *
+ *
+ *
* @since 4.0
*/
public class ChunkedOutputStream extends OutputStream {
@@ -57,11 +57,11 @@ public class ChunkedOutputStream extends
/** True if the stream is closed. */
private boolean closed = false;
-
+
// ----------------------------------------------------------- Constructors
/**
* Wraps a session output buffer and chunk-encodes the output.
- *
+ *
* @param out The session output buffer
* @param bufferSize The minimum chunk size (excluding last chunk)
* @throws IOException in case of an I/O error
@@ -74,13 +74,13 @@ public class ChunkedOutputStream extends
}
/**
- * Wraps a session output buffer and chunks the output. The default buffer
+ * Wraps a session output buffer and chunks the output. The default buffer
* size of 2048 was chosen because the chunk overhead is less than 0.5%
*
* @param out the output buffer to wrap
* @throws IOException in case of an I/O error
*/
- public ChunkedOutputStream(final SessionOutputBuffer out)
+ public ChunkedOutputStream(final SessionOutputBuffer out)
throws IOException {
this(out, 2048);
}
@@ -118,7 +118,7 @@ public class ChunkedOutputStream extends
// ----------------------------------------------------------- Public Methods
/**
- * Must be called to ensure the internal cache is flushed and the closing
+ * Must be called to ensure the internal cache is flushed and the closing
* chunk is written.
* @throws IOException in case of an I/O error
*/
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java Fri Apr 23 13:44:00 2010
@@ -34,11 +34,11 @@ import org.apache.http.io.BufferInfo;
import org.apache.http.io.SessionInputBuffer;
/**
- * Input stream that cuts off after a defined number of bytes. This class
- * is used to receive content of HTTP messages where the end of the content
- * entity is determined by the value of the <code>Content-Length header</code>.
+ * Input stream that cuts off after a defined number of bytes. This class
+ * is used to receive content of HTTP messages where the end of the content
+ * entity is determined by the value of the <code>Content-Length header</code>.
* Entities transferred using this stream can be maximum {@link Long#MAX_VALUE}
- * long.
+ * long.
* <p>
* Note that this class NEVER closes the underlying stream, even when close
* gets called. Instead, it will read until the "end" of its limit on
@@ -50,7 +50,7 @@ import org.apache.http.io.SessionInputBu
* @since 4.0
*/
public class ContentLengthInputStream extends InputStream {
-
+
private static final int BUFFER_SIZE = 2048;
/**
* The maximum number of bytes that can be read from the stream. Subsequent
@@ -70,7 +70,7 @@ public class ContentLengthInputStream ex
private SessionInputBuffer in = null;
/**
- * Wraps a session input buffer and cuts off output after a defined number
+ * Wraps a session input buffer and cuts off output after a defined number
* of bytes.
*
* @param in The session input buffer
@@ -113,12 +113,12 @@ public class ContentLengthInputStream ex
public int available() throws IOException {
if (this.in instanceof BufferInfo) {
int len = ((BufferInfo) this.in).length();
- return Math.min(len, (int) (this.contentLength - this.pos));
+ return Math.min(len, (int) (this.contentLength - this.pos));
} else {
return 0;
}
}
-
+
/**
* Read the next byte from the stream
* @return The next byte or -1 if the end of stream has been reached.
@@ -191,9 +191,9 @@ public class ContentLengthInputStream ex
return 0;
}
byte[] buffer = new byte[BUFFER_SIZE];
- // make sure we don't skip more bytes than are
+ // make sure we don't skip more bytes than are
// still available
- long remaining = Math.min(n, this.contentLength - this.pos);
+ long remaining = Math.min(n, this.contentLength - this.pos);
// skip and keep track of the bytes actually skipped
long count = 0;
while (remaining > 0) {
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java Fri Apr 23 13:44:00 2010
@@ -33,20 +33,20 @@ import java.io.OutputStream;
import org.apache.http.io.SessionOutputBuffer;
/**
- * Output stream that cuts off after a defined number of bytes. This class
- * is used to send content of HTTP messages where the end of the content entity
- * is determined by the value of the <code>Content-Length header</code>.
+ * Output stream that cuts off after a defined number of bytes. This class
+ * is used to send content of HTTP messages where the end of the content entity
+ * is determined by the value of the <code>Content-Length header</code>.
* Entities transferred using this stream can be maximum {@link Long#MAX_VALUE}
- * long.
+ * long.
* <p>
* Note that this class NEVER closes the underlying stream, even when close
- * gets called. Instead, the stream will be marked as closed and no further
+ * gets called. Instead, the stream will be marked as closed and no further
* output will be permitted.
- *
+ *
* @since 4.0
*/
public class ContentLengthOutputStream extends OutputStream {
-
+
/**
* Wrapped session output buffer.
*/
@@ -65,13 +65,13 @@ public class ContentLengthOutputStream e
private boolean closed = false;
/**
- * Wraps a session output buffer and cuts off output after a defined number
+ * Wraps a session output buffer and cuts off output after a defined number
* of bytes.
*
* @param out The session output buffer
* @param contentLength The maximum number of bytes that can be written to
* the stream. Subsequent write operations will be ignored.
- *
+ *
* @since 4.0
*/
public ContentLengthOutputStream(final SessionOutputBuffer out, long contentLength) {
@@ -88,7 +88,7 @@ public class ContentLengthOutputStream e
/**
* <p>Does not close the underlying socket output.</p>
- *
+ *
* @throws IOException If an I/O problem occurs.
*/
public void close() throws IOException {
@@ -129,5 +129,5 @@ public class ContentLengthOutputStream e
this.total++;
}
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestParser.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestParser.java Fri Apr 23 13:44:00 2010
@@ -43,34 +43,34 @@ import org.apache.http.params.HttpParams
import org.apache.http.util.CharArrayBuffer;
/**
- * HTTP request parser that obtain its input from an instance
- * of {@link SessionInputBuffer}.
+ * HTTP request parser that obtain its input from an instance
+ * of {@link SessionInputBuffer}.
* <p>
- * The following parameters can be used to customize the behavior of this
- * class:
+ * The following parameters can be used to customize the behavior of this
+ * class:
* <ul>
* <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_HEADER_COUNT}</li>
* <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_LINE_LENGTH}</li>
* </ul>
- *
+ *
* @since 4.0
*/
public class HttpRequestParser extends AbstractMessageParser {
-
+
private final HttpRequestFactory requestFactory;
private final CharArrayBuffer lineBuf;
-
+
/**
* Creates an instance of this class.
- *
+ *
* @param buffer the session input buffer.
* @param parser the line parser.
- * @param requestFactory the factory to use to create
+ * @param requestFactory the factory to use to create
* {@link HttpRequest}s.
* @param params HTTP parameters.
*/
public HttpRequestParser(
- final SessionInputBuffer buffer,
+ final SessionInputBuffer buffer,
final LineParser parser,
final HttpRequestFactory requestFactory,
final HttpParams params) {
@@ -89,11 +89,11 @@ public class HttpRequestParser extends A
this.lineBuf.clear();
int i = sessionBuffer.readLine(this.lineBuf);
if (i == -1) {
- throw new ConnectionClosedException("Client closed connection");
+ throw new ConnectionClosedException("Client closed connection");
}
ParserCursor cursor = new ParserCursor(0, this.lineBuf.length());
RequestLine requestline = this.lineParser.parseRequestLine(this.lineBuf, cursor);
return this.requestFactory.newHttpRequest(requestline);
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestWriter.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestWriter.java Fri Apr 23 13:44:00 2010
@@ -36,9 +36,9 @@ import org.apache.http.message.LineForma
import org.apache.http.params.HttpParams;
/**
- * HTTP request writer that serializes its output to an instance
- * of {@link SessionOutputBuffer}.
- *
+ * HTTP request writer that serializes its output to an instance
+ * of {@link SessionOutputBuffer}.
+ *
* @since 4.0
*/
public class HttpRequestWriter extends AbstractMessageWriter {
@@ -48,11 +48,11 @@ public class HttpRequestWriter extends A
final HttpParams params) {
super(buffer, formatter, params);
}
-
+
protected void writeHeadLine(final HttpMessage message)
throws IOException {
- lineFormatter.formatRequestLine(this.lineBuf,
+ lineFormatter.formatRequestLine(this.lineBuf,
((HttpRequest) message).getRequestLine());
this.sessionBuffer.writeLine(this.lineBuf);
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseParser.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseParser.java Fri Apr 23 13:44:00 2010
@@ -43,29 +43,29 @@ import org.apache.http.params.HttpParams
import org.apache.http.util.CharArrayBuffer;
/**
- * HTTP response parser that obtain its input from an instance
- * of {@link SessionInputBuffer}.
+ * HTTP response parser that obtain its input from an instance
+ * of {@link SessionInputBuffer}.
* <p>
- * The following parameters can be used to customize the behavior of this
- * class:
+ * The following parameters can be used to customize the behavior of this
+ * class:
* <ul>
* <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_HEADER_COUNT}</li>
* <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_LINE_LENGTH}</li>
* </ul>
- *
+ *
* @since 4.0
*/
public class HttpResponseParser extends AbstractMessageParser {
-
+
private final HttpResponseFactory responseFactory;
private final CharArrayBuffer lineBuf;
-
+
/**
* Creates an instance of this class.
- *
+ *
* @param buffer the session input buffer.
* @param parser the line parser.
- * @param responseFactory the factory to use to create
+ * @param responseFactory the factory to use to create
* {@link HttpResponse}s.
* @param params HTTP parameters.
*/
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseWriter.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseWriter.java Fri Apr 23 13:44:00 2010
@@ -36,9 +36,9 @@ import org.apache.http.message.LineForma
import org.apache.http.params.HttpParams;
/**
- * HTTP response writer that serializes its output to an instance
- * of {@link SessionOutputBuffer}.
- *
+ * HTTP response writer that serializes its output to an instance
+ * of {@link SessionOutputBuffer}.
+ *
* @since 4.0
*/
public class HttpResponseWriter extends AbstractMessageWriter {
@@ -48,11 +48,11 @@ public class HttpResponseWriter extends
final HttpParams params) {
super(buffer, formatter, params);
}
-
+
protected void writeHeadLine(final HttpMessage message)
throws IOException {
- lineFormatter.formatStatusLine(this.lineBuf,
+ lineFormatter.formatStatusLine(this.lineBuf,
((HttpResponse) message).getStatusLine());
this.sessionBuffer.writeLine(this.lineBuf);
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpTransportMetricsImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpTransportMetricsImpl.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpTransportMetricsImpl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpTransportMetricsImpl.java Fri Apr 23 13:44:00 2010
@@ -37,11 +37,11 @@ import org.apache.http.io.HttpTransportM
public class HttpTransportMetricsImpl implements HttpTransportMetrics {
private long bytesTransferred = 0;
-
+
public HttpTransportMetricsImpl() {
super();
}
-
+
public long getBytesTransferred() {
return this.bytesTransferred;
}
@@ -57,5 +57,5 @@ public class HttpTransportMetricsImpl im
public void reset() {
this.bytesTransferred = 0;
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java Fri Apr 23 13:44:00 2010
@@ -34,23 +34,23 @@ import org.apache.http.io.BufferInfo;
import org.apache.http.io.SessionInputBuffer;
/**
- * Input stream that reads data without any transformation. The end of the
- * content entity is demarcated by closing the underlying connection
- * (EOF condition). Entities transferred using this input stream can be of
- * unlimited length.
+ * Input stream that reads data without any transformation. The end of the
+ * content entity is demarcated by closing the underlying connection
+ * (EOF condition). Entities transferred using this input stream can be of
+ * unlimited length.
* <p>
* Note that this class NEVER closes the underlying stream, even when close
- * gets called. Instead, it will read until the end of the stream (until
+ * gets called. Instead, it will read until the end of the stream (until
* <code>-1</code> is returned).
- *
+ *
* @since 4.0
*/
public class IdentityInputStream extends InputStream {
-
+
private final SessionInputBuffer in;
-
+
private boolean closed = false;
-
+
/**
* Wraps session input stream and reads input until the the end of stream.
*
@@ -63,7 +63,7 @@ public class IdentityInputStream extends
}
this.in = in;
}
-
+
public int available() throws IOException {
if (this.in instanceof BufferInfo) {
return ((BufferInfo) this.in).length();
@@ -71,7 +71,7 @@ public class IdentityInputStream extends
return 0;
}
}
-
+
public void close() throws IOException {
this.closed = true;
}
@@ -83,7 +83,7 @@ public class IdentityInputStream extends
return this.in.read();
}
}
-
+
public int read(final byte[] b, int off, int len) throws IOException {
if (this.closed) {
return -1;
@@ -91,5 +91,5 @@ public class IdentityInputStream extends
return this.in.read(b, off, len);
}
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java Fri Apr 23 13:44:00 2010
@@ -33,19 +33,19 @@ import java.io.OutputStream;
import org.apache.http.io.SessionOutputBuffer;
/**
- * Output stream that writes data without any transformation. The end of
- * the content entity is demarcated by closing the underlying connection
- * (EOF condition). Entities transferred using this input stream can be of
- * unlimited length.
+ * Output stream that writes data without any transformation. The end of
+ * the content entity is demarcated by closing the underlying connection
+ * (EOF condition). Entities transferred using this input stream can be of
+ * unlimited length.
* <p>
* Note that this class NEVER closes the underlying stream, even when close
- * gets called. Instead, the stream will be marked as closed and no further
+ * gets called. Instead, the stream will be marked as closed and no further
* output will be permitted.
- *
+ *
* @since 4.0
*/
public class IdentityOutputStream extends OutputStream {
-
+
/**
* Wrapped session output buffer.
*/
@@ -64,7 +64,7 @@ public class IdentityOutputStream extend
/**
* <p>Does not close the underlying socket output.</p>
- *
+ *
* @throws IOException If an I/O problem occurs.
*/
public void close() throws IOException {
@@ -95,5 +95,5 @@ public class IdentityOutputStream extend
}
this.out.write(b);
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java Fri Apr 23 13:44:00 2010
@@ -38,13 +38,13 @@ import org.apache.http.params.HttpParams
/**
* {@link SessionInputBuffer} implementation bound to a {@link Socket}.
* <p>
- * The following parameters can be used to customize the behavior of this
- * class:
+ * The following parameters can be used to customize the behavior of this
+ * class:
* <ul>
* <li>{@link org.apache.http.params.CoreProtocolPNames#HTTP_ELEMENT_CHARSET}</li>
* <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_LINE_LENGTH}</li>
* </ul>
- *
+ *
* @since 4.0
*/
public class SocketInputBuffer extends AbstractSessionInputBuffer implements EofSensor {
@@ -54,9 +54,9 @@ public class SocketInputBuffer extends A
/**
* Returns <code>SocketTimeoutExceptionClass<code> or <code>null</code> if the class
* does not exist.
- *
+ *
* @return <code>SocketTimeoutExceptionClass<code>, or <code>null</code> if unavailable.
- */
+ */
static private Class SocketTimeoutExceptionClass() {
try {
return Class.forName("java.net.SocketTimeoutException");
@@ -72,24 +72,24 @@ public class SocketInputBuffer extends A
return true;
}
}
-
+
private final Socket socket;
-
+
private boolean eof;
-
+
/**
- * Creates an instance of this class.
- *
- * @param socket the socket to read data from.
+ * Creates an instance of this class.
+ *
+ * @param socket the socket to read data from.
* @param buffersize the size of the internal buffer. If this number is less
- * than <code>0</code> it is set to the value of
- * {@link Socket#getReceiveBufferSize()}. If resultant number is less
- * than <code>1024</code> it is set to <code>1024</code>.
+ * than <code>0</code> it is set to the value of
+ * {@link Socket#getReceiveBufferSize()}. If resultant number is less
+ * than <code>1024</code> it is set to <code>1024</code>.
* @param params HTTP parameters.
*/
public SocketInputBuffer(
- final Socket socket,
- int buffersize,
+ final Socket socket,
+ int buffersize,
final HttpParams params) throws IOException {
super();
if (socket == null) {
@@ -105,7 +105,7 @@ public class SocketInputBuffer extends A
}
init(socket.getInputStream(), buffersize, params);
}
-
+
protected int fillBuffer() throws IOException {
int i = super.fillBuffer();
this.eof = i == -1;
@@ -133,6 +133,6 @@ public class SocketInputBuffer extends A
public boolean isEof() {
return this.eof;
- }
-
+ }
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java Fri Apr 23 13:44:00 2010
@@ -36,28 +36,28 @@ import org.apache.http.params.HttpParams
/**
* {@link SessionOutputBuffer} implementation bound to a {@link Socket}.
* <p>
- * The following parameters can be used to customize the behavior of this
- * class:
+ * The following parameters can be used to customize the behavior of this
+ * class:
* <ul>
* <li>{@link org.apache.http.params.CoreProtocolPNames#HTTP_ELEMENT_CHARSET}</li>
* </ul>
- *
+ *
* @since 4.0
*/
public class SocketOutputBuffer extends AbstractSessionOutputBuffer {
/**
- * Creates an instance of this class.
- *
- * @param socket the socket to write data to.
+ * Creates an instance of this class.
+ *
+ * @param socket the socket to write data to.
* @param buffersize the size of the internal buffer. If this number is less
- * than <code>0</code> it is set to the value of
- * {@link Socket#getSendBufferSize()}. If resultant number is less
- * than <code>1024</code> it is set to <code>1024</code>.
+ * than <code>0</code> it is set to the value of
+ * {@link Socket#getSendBufferSize()}. If resultant number is less
+ * than <code>1024</code> it is set to <code>1024</code>.
* @param params HTTP parameters.
*/
public SocketOutputBuffer(
- final Socket socket,
+ final Socket socket,
int buffersize,
final HttpParams params) throws IOException {
super();
@@ -72,5 +72,5 @@ public class SocketOutputBuffer extends
}
init(socket.getOutputStream(), buffersize, params);
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/BufferInfo.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/BufferInfo.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/BufferInfo.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/BufferInfo.java Fri Apr 23 13:44:00 2010
@@ -36,21 +36,21 @@ public interface BufferInfo {
/**
* Return length data stored in the buffer
- *
+ *
* @return data length
*/
int length();
/**
* Returns total capacity of the buffer
- *
+ *
* @return total capacity
*/
int capacity();
/**
* Returns available space in the buffer.
- *
+ *
* @return available space.
*/
int available();
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/EofSensor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/EofSensor.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/EofSensor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/EofSensor.java Fri Apr 23 13:44:00 2010
@@ -29,11 +29,11 @@ package org.apache.http.io;
/**
* EOF sensor.
- *
+ *
* @since 4.0
*/
public interface EofSensor {
-
+
boolean isEof();
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpMessageParser.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpMessageParser.java Fri Apr 23 13:44:00 2010
@@ -33,17 +33,17 @@ import org.apache.http.HttpException;
import org.apache.http.HttpMessage;
/**
- * Abstract message parser intended to build HTTP messages from an arbitrary
- * data source.
- *
+ * Abstract message parser intended to build HTTP messages from an arbitrary
+ * data source.
+ *
* @since 4.0
*/
public interface HttpMessageParser {
-
+
/**
* Generates an instance of {@link HttpMessage} from the underlying data
* source.
- *
+ *
* @return HTTP message
* @throws IOException in case of an I/O error
* @throws HttpException in case of HTTP protocol violation
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpMessageWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpMessageWriter.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpMessageWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpMessageWriter.java Fri Apr 23 13:44:00 2010
@@ -33,22 +33,22 @@ import org.apache.http.HttpException;
import org.apache.http.HttpMessage;
/**
- * Abstract message writer intended to serialize HTTP messages to an arbitrary
- * data sink.
- *
+ * Abstract message writer intended to serialize HTTP messages to an arbitrary
+ * data sink.
+ *
* @since 4.0
*/
public interface HttpMessageWriter {
-
+
/**
* Serializes an instance of {@link HttpMessage} to the underlying data
* sink.
- *
+ *
* @param message
* @throws IOException in case of an I/O error
* @throws HttpException in case of HTTP protocol violation
*/
void write(HttpMessage message)
throws IOException, HttpException;
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpTransportMetrics.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpTransportMetrics.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpTransportMetrics.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/HttpTransportMetrics.java Fri Apr 23 13:44:00 2010
@@ -34,15 +34,15 @@ package org.apache.http.io;
* @since 4.0
*/
public interface HttpTransportMetrics {
-
+
/**
* Returns the number of bytes transferred.
*/
- long getBytesTransferred();
-
+ long getBytesTransferred();
+
/**
* Resets the counts
*/
void reset();
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java Fri Apr 23 13:44:00 2010
@@ -32,16 +32,16 @@ import java.io.IOException;
import org.apache.http.util.CharArrayBuffer;
/**
- * Session input buffer for blocking connections. This interface is similar to
- * InputStream class, but it also provides methods for reading lines of text.
+ * Session input buffer for blocking connections. This interface is similar to
+ * InputStream class, but it also provides methods for reading lines of text.
* <p>
* Implementing classes are also expected to manage intermediate data buffering
- * for optimal input performance.
- *
+ * for optimal input performance.
+ *
* @since 4.0
*/
public interface SessionInputBuffer {
-
+
/**
* Reads up to <code>len</code> bytes of data from the session buffer into
* an array of bytes. An attempt is made to read as many as
@@ -65,8 +65,8 @@ public interface SessionInputBuffer {
* the stream has been reached.
* @exception IOException if an I/O error occurs.
*/
- int read(byte[] b, int off, int len) throws IOException;
-
+ int read(byte[] b, int off, int len) throws IOException;
+
/**
* Reads some number of bytes from the session buffer and stores them into
* the buffer array <code>b</code>. The number of bytes actually read is
@@ -79,8 +79,8 @@ public interface SessionInputBuffer {
* the stream has been reached.
* @exception IOException if an I/O error occurs.
*/
- int read(byte[] b) throws IOException;
-
+ int read(byte[] b) throws IOException;
+
/**
* Reads the next byte of data from this session buffer. The value byte is
* returned as an <code>int</code> in the range <code>0</code> to
@@ -93,56 +93,56 @@ public interface SessionInputBuffer {
* stream is reached.
* @exception IOException if an I/O error occurs.
*/
- int read() throws IOException;
-
+ int read() throws IOException;
+
/**
- * Reads a complete line of characters up to a line delimiter from this
- * session buffer into the given line buffer. The number of chars actually
- * read is returned as an integer. The line delimiter itself is discarded.
- * If no char is available because the end of the stream has been reached,
- * the value <code>-1</code> is returned. This method blocks until input
+ * Reads a complete line of characters up to a line delimiter from this
+ * session buffer into the given line buffer. The number of chars actually
+ * read is returned as an integer. The line delimiter itself is discarded.
+ * If no char is available because the end of the stream has been reached,
+ * the value <code>-1</code> is returned. This method blocks until input
* data is available, end of file is detected, or an exception is thrown.
* <p>
- * The choice of a char encoding and line delimiter sequence is up to the
- * specific implementations of this interface.
+ * The choice of a char encoding and line delimiter sequence is up to the
+ * specific implementations of this interface.
*
* @param buffer the line buffer.
* @return one line of characters
* @exception IOException if an I/O error occurs.
*/
int readLine(CharArrayBuffer buffer) throws IOException;
-
+
/**
- * Reads a complete line of characters up to a line delimiter from this
- * session buffer. The line delimiter itself is discarded. If no char is
- * available because the end of the stream has been reached,
- * <code>null</code> is returned. This method blocks until input data is
+ * Reads a complete line of characters up to a line delimiter from this
+ * session buffer. The line delimiter itself is discarded. If no char is
+ * available because the end of the stream has been reached,
+ * <code>null</code> is returned. This method blocks until input data is
* available, end of file is detected, or an exception is thrown.
* <p>
- * The choice of a char encoding and line delimiter sequence is up to the
- * specific implementations of this interface.
- *
+ * The choice of a char encoding and line delimiter sequence is up to the
+ * specific implementations of this interface.
+ *
* @return HTTP line as a string
* @exception IOException if an I/O error occurs.
*/
String readLine() throws IOException;
-
- /** Blocks until some data becomes available in the session buffer or the
+
+ /** Blocks until some data becomes available in the session buffer or the
* given timeout period in milliseconds elapses. If the timeout value is
- * <code>0</code> this method blocks indefinitely.
- *
+ * <code>0</code> this method blocks indefinitely.
+ *
* @param timeout in milliseconds.
* @return <code>true</code> if some data is available in the session
* buffer or <code>false</code> otherwise.
* @exception IOException if an I/O error occurs.
*/
- boolean isDataAvailable(int timeout) throws IOException;
+ boolean isDataAvailable(int timeout) throws IOException;
/**
* Returns {@link HttpTransportMetrics} for this session buffer.
- *
+ *
* @return transport metrics.
*/
HttpTransportMetrics getMetrics();
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java Fri Apr 23 13:44:00 2010
@@ -32,22 +32,22 @@ import java.io.IOException;
import org.apache.http.util.CharArrayBuffer;
/**
- * Session output buffer for blocking connections. This interface is similar to
- * OutputStream class, but it also provides methods for writing lines of text.
+ * Session output buffer for blocking connections. This interface is similar to
+ * OutputStream class, but it also provides methods for writing lines of text.
* <p>
* Implementing classes are also expected to manage intermediate data buffering
- * for optimal output performance.
- *
+ * for optimal output performance.
+ *
* @since 4.0
*/
public interface SessionOutputBuffer {
/**
- * Writes <code>len</code> bytes from the specified byte array
+ * Writes <code>len</code> bytes from the specified byte array
* starting at offset <code>off</code> to this session buffer.
* <p>
- * If <code>off</code> is negative, or <code>len</code> is negative, or
- * <code>off+len</code> is greater than the length of the array
+ * If <code>off</code> is negative, or <code>len</code> is negative, or
+ * <code>off+len</code> is greater than the length of the array
* <code>b</code>, then an <tt>IndexOutOfBoundsException</tt> is thrown.
*
* @param b the data.
@@ -56,16 +56,16 @@ public interface SessionOutputBuffer {
* @exception IOException if an I/O error occurs.
*/
void write(byte[] b, int off, int len) throws IOException;
-
+
/**
- * Writes <code>b.length</code> bytes from the specified byte array
+ * Writes <code>b.length</code> bytes from the specified byte array
* to this session buffer.
*
* @param b the data.
* @exception IOException if an I/O error occurs.
*/
void write(byte[] b) throws IOException;
-
+
/**
* Writes the specified byte to this session buffer.
*
@@ -73,48 +73,48 @@ public interface SessionOutputBuffer {
* @exception IOException if an I/O error occurs.
*/
void write(int b) throws IOException;
-
+
/**
- * Writes characters from the specified string followed by a line delimiter
+ * Writes characters from the specified string followed by a line delimiter
* to this session buffer.
* <p>
- * The choice of a char encoding and line delimiter sequence is up to the
- * specific implementations of this interface.
+ * The choice of a char encoding and line delimiter sequence is up to the
+ * specific implementations of this interface.
*
* @param s the line.
* @exception IOException if an I/O error occurs.
*/
void writeLine(String s) throws IOException;
-
+
/**
- * Writes characters from the specified char array followed by a line
+ * Writes characters from the specified char array followed by a line
* delimiter to this session buffer.
* <p>
- * The choice of a char encoding and line delimiter sequence is up to the
- * specific implementations of this interface.
+ * The choice of a char encoding and line delimiter sequence is up to the
+ * specific implementations of this interface.
*
* @param buffer the buffer containing chars of the line.
* @exception IOException if an I/O error occurs.
*/
void writeLine(CharArrayBuffer buffer) throws IOException;
-
+
/**
- * Flushes this session buffer and forces any buffered output bytes
- * to be written out. The general contract of <code>flush</code> is
- * that calling it is an indication that, if any bytes previously
- * written have been buffered by the implementation of the output
- * stream, such bytes should immediately be written to their
+ * Flushes this session buffer and forces any buffered output bytes
+ * to be written out. The general contract of <code>flush</code> is
+ * that calling it is an indication that, if any bytes previously
+ * written have been buffered by the implementation of the output
+ * stream, such bytes should immediately be written to their
* intended destination.
*
* @exception IOException if an I/O error occurs.
*/
void flush() throws IOException;
-
+
/**
* Returns {@link HttpTransportMetrics} for this session buffer.
- *
+ *
* @return transport metrics.
*/
HttpTransportMetrics getMetrics();
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/package.html
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/package.html?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/package.html (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/io/package.html Fri Apr 23 13:44:00 2010
@@ -32,7 +32,7 @@
<body>
The blocking I/O abstraction of the HTTP components.
<p/>
-This layer defines interfaces for transferring basic elements of
+This layer defines interfaces for transferring basic elements of
HTTP messages over connections.
</body>
</html>
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/AbstractHttpMessage.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/AbstractHttpMessage.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/AbstractHttpMessage.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/AbstractHttpMessage.java Fri Apr 23 13:44:00 2010
@@ -37,15 +37,15 @@ import org.apache.http.params.BasicHttpP
/**
* Basic implementation of {@link HttpMessage}.
- *
+ *
* @since 4.0
*/
public abstract class AbstractHttpMessage implements HttpMessage {
-
+
protected HeaderGroup headergroup;
-
+
protected HttpParams params;
-
+
protected AbstractHttpMessage(final HttpParams params) {
super();
this.headergroup = new HeaderGroup();
@@ -60,7 +60,7 @@ public abstract class AbstractHttpMessag
public boolean containsHeader(String name) {
return this.headergroup.containsHeader(name);
}
-
+
// non-javadoc, see interface HttpMessage
public Header[] getHeaders(final String name) {
return this.headergroup.getHeaders(name);
@@ -80,7 +80,7 @@ public abstract class AbstractHttpMessag
public Header[] getAllHeaders() {
return this.headergroup.getAllHeaders();
}
-
+
// non-javadoc, see interface HttpMessage
public void addHeader(final Header header) {
this.headergroup.addHeader(header);
@@ -116,7 +116,7 @@ public abstract class AbstractHttpMessag
public void removeHeader(final Header header) {
this.headergroup.removeHeader(header);
}
-
+
// non-javadoc, see interface HttpMessage
public void removeHeaders(final String name) {
if (name == null) {
@@ -129,7 +129,7 @@ public abstract class AbstractHttpMessag
}
}
}
-
+
// non-javadoc, see interface HttpMessage
public HeaderIterator headerIterator() {
return this.headergroup.iterator();
@@ -139,7 +139,7 @@ public abstract class AbstractHttpMessag
public HeaderIterator headerIterator(String name) {
return this.headergroup.iterator(name);
}
-
+
// non-javadoc, see interface HttpMessage
public HttpParams getParams() {
if (this.params == null) {
@@ -147,7 +147,7 @@ public abstract class AbstractHttpMessag
}
return this.params;
}
-
+
// non-javadoc, see interface HttpMessage
public void setParams(final HttpParams params) {
if (params == null) {
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java Fri Apr 23 13:44:00 2010
@@ -33,14 +33,14 @@ import org.apache.http.ParseException;
/**
* Basic implementation of {@link Header}.
- *
+ *
* @since 4.0
*/
public class BasicHeader implements Header, Cloneable {
private final String name;
private final String value;
-
+
/**
* Constructor with name and value
*
@@ -74,12 +74,12 @@ public class BasicHeader implements Head
// result intentionally not cached, it's probably not used again
return BasicHeaderValueParser.parseElements(this.value, null);
} else {
- return new HeaderElement[] {};
+ return new HeaderElement[] {};
}
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
-
+
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java?rev=937295&r1=937294&r2=937295&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java Fri Apr 23 13:44:00 2010
@@ -34,7 +34,7 @@ import org.apache.http.util.LangUtils;
/**
* Basic implementation of {@link HeaderElement}
- *
+ *
* @since 4.0
*/
public class BasicHeaderElement implements HeaderElement, Cloneable {
@@ -52,7 +52,7 @@ public class BasicHeaderElement implemen
* Parameters are copied by reference, not by value
*/
public BasicHeaderElement(
- final String name,
+ final String name,
final String value,
final NameValuePair[] parameters) {
super();
@@ -70,7 +70,7 @@ public class BasicHeaderElement implemen
/**
* Constructor with name and value.
- *
+ *
* @param name header element name
* @param value header element value. May be <tt>null</tt>
*/
@@ -102,7 +102,7 @@ public class BasicHeaderElement implemen
public NameValuePair getParameterByName(final String name) {
if (name == null) {
throw new IllegalArgumentException("Name may not be null");
- }
+ }
NameValuePair found = null;
for (int i = 0; i < this.parameters.length; i++) {
NameValuePair current = this.parameters[ i ];
@@ -136,7 +136,7 @@ public class BasicHeaderElement implemen
}
return hash;
}
-
+
public String toString() {
CharArrayBuffer buffer = new CharArrayBuffer(64);
buffer.append(this.name);
@@ -150,12 +150,12 @@ public class BasicHeaderElement implemen
}
return buffer.toString();
}
-
+
public Object clone() throws CloneNotSupportedException {
// parameters array is considered immutable
// no need to make a copy of it
return super.clone();
}
-
+
}