hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1639706 [1/2] - in /httpcomponents/httpcore/trunk: httpcore-ab/src/main/java/org/apache/http/benchmark/ httpcore-nio/src/main/java/org/apache/http/impl/nio/ httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ httpcore-nio/src/main...
Date Fri, 14 Nov 2014 17:17:53 GMT
Author: olegk
Date: Fri Nov 14 17:17:52 2014
New Revision: 1639706

URL: http://svn.apache.org/r1639706
Log:
Removed HTTP class in favor of HttpHeaders and HeaderElements classes

Added:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderElements.java
      - copied, changed from r1638390, httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/EmptyInputStream.java
      - copied, changed from r1638390, httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java
Removed:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HTTP.java
Modified:
    httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
    httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ErrorResponseProducer.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestNHttpConnectionBase.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestErrorResponseProducer.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
    httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalReverseProxy.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultConnectionReuseStrategy.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/LaxContentLengthStrategy.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/StrictContentLengthStrategy.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpEntityEnclosingRequest.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpExpectationVerifier.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestConnControl.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestContent.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestDate.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestExpectContinue.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseConnControl.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseContent.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseDate.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseServer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestAbstractHttpEntity.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestHttpEntityWrapper.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java

Modified: httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java Fri Nov 14 17:17:52 2014
@@ -36,6 +36,7 @@ import java.util.Iterator;
 import javax.net.SocketFactory;
 
 import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.Consts;
 import org.apache.http.Header;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpException;
@@ -45,7 +46,6 @@ import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.apache.http.entity.ContentType;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpProcessor;
 import org.apache.http.protocol.HttpProcessorBuilder;
@@ -172,7 +172,7 @@ class BenchmarkWorker implements Runnabl
                     final ContentType ct = ContentType.getOrDefault(entity);
                     Charset charset = ct.getCharset();
                     if (charset == null) {
-                        charset = HTTP.DEF_CONTENT_CHARSET;
+                        charset = Consts.ISO_8859_1;
                     }
                     long contentlen = 0;
                     final InputStream instream = entity.getContent();

Modified: httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java Fri Nov 14 17:17:52 2014
@@ -43,7 +43,9 @@ import org.apache.commons.cli.CommandLin
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.PosixParser;
 import org.apache.http.Header;
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpEntity;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpVersion;
@@ -52,7 +54,6 @@ import org.apache.http.entity.FileEntity
 import org.apache.http.entity.StringEntity;
 import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.ssl.SSLContextBuilder;
 import org.apache.http.ssl.TrustStrategy;
 
@@ -133,7 +134,7 @@ public class HttpBenchmark {
         }
 
         if (!config.isKeepAlive()) {
-            request.addHeader(new DefaultHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE));
+            request.addHeader(new DefaultHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE));
         }
 
         final String[] headers = config.getHeaders();

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java Fri Nov 14 17:17:52 2014
@@ -40,6 +40,7 @@ import org.apache.http.Header;
 import org.apache.http.HttpConnectionMetrics;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpMessage;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
@@ -69,7 +70,6 @@ import org.apache.http.nio.reactor.Sessi
 import org.apache.http.nio.reactor.SessionOutputBuffer;
 import org.apache.http.nio.reactor.SocketAccessor;
 import org.apache.http.nio.util.ByteBufferAllocator;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.util.Args;
 import org.apache.http.util.NetUtils;
@@ -281,11 +281,11 @@ public class NHttpConnectionBase impleme
             entity.setContentLength(len);
         }
 
-        final Header contentTypeHeader = message.getFirstHeader(HTTP.CONTENT_TYPE);
+        final Header contentTypeHeader = message.getFirstHeader(HttpHeaders.CONTENT_TYPE);
         if (contentTypeHeader != null) {
             entity.setContentType(contentTypeHeader);
         }
-        final Header contentEncodingHeader = message.getFirstHeader(HTTP.CONTENT_ENCODING);
+        final Header contentEncodingHeader = message.getFirstHeader(HttpHeaders.CONTENT_ENCODING);
         if (contentEncodingHeader != null) {
             entity.setContentEncoding(contentEncodingHeader);
         }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java Fri Nov 14 17:17:52 2014
@@ -37,6 +37,7 @@ import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CoderResult;
 
+import org.apache.http.Consts;
 import org.apache.http.MessageConstraintException;
 import org.apache.http.annotation.NotThreadSafe;
 import org.apache.http.config.MessageConstraints;
@@ -44,7 +45,6 @@ import org.apache.http.nio.reactor.Sessi
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.ExpandableBuffer;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.util.Args;
 import org.apache.http.util.CharArrayBuffer;
 
@@ -233,7 +233,7 @@ public class SessionInputBufferImpl exte
         int pos = -1;
         for (int i = this.buffer.position(); i < this.buffer.limit(); i++) {
             final int b = this.buffer.get(i);
-            if (b == HTTP.LF) {
+            if (b == Consts.LF) {
                 pos = i + 1;
                 break;
             }
@@ -320,13 +320,13 @@ public class SessionInputBufferImpl exte
         // discard LF if found
         int l = linebuffer.length();
         if (l > 0) {
-            if (linebuffer.charAt(l - 1) == HTTP.LF) {
+            if (linebuffer.charAt(l - 1) == Consts.LF) {
                 l--;
                 linebuffer.setLength(l);
             }
             // discard CR if found
             if (l > 0) {
-                if (linebuffer.charAt(l - 1) == HTTP.CR) {
+                if (linebuffer.charAt(l - 1) == Consts.CR) {
                     l--;
                     linebuffer.setLength(l);
                 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java Fri Nov 14 17:17:52 2014
@@ -37,12 +37,12 @@ import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
 
+import org.apache.http.Consts;
 import org.apache.http.annotation.NotThreadSafe;
 import org.apache.http.nio.reactor.SessionOutputBuffer;
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.ExpandableBuffer;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.util.Args;
 import org.apache.http.util.CharArrayBuffer;
 
@@ -55,7 +55,7 @@ import org.apache.http.util.CharArrayBuf
 @NotThreadSafe
 public class SessionOutputBufferImpl extends ExpandableBuffer implements SessionOutputBuffer {
 
-    private static final byte[] CRLF = new byte[] {HTTP.CR, HTTP.LF};
+    private static final byte[] CRLF = new byte[] {Consts.CR, Consts.LF};
 
     private final CharsetEncoder charencoder;
     private final int lineBuffersize;

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java Fri Nov 14 17:17:52 2014
@@ -35,12 +35,12 @@ import java.io.UnsupportedEncodingExcept
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
 
+import org.apache.http.Consts;
 import org.apache.http.annotation.NotThreadSafe;
 import org.apache.http.entity.AbstractHttpEntity;
 import org.apache.http.entity.ContentType;
 import org.apache.http.nio.ContentEncoder;
 import org.apache.http.nio.IOControl;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.util.Args;
 
 /**
@@ -71,7 +71,7 @@ public class NStringEntity extends Abstr
         Args.notNull(s, "Source string");
         Charset charset = contentType != null ? contentType.getCharset() : null;
         if (charset == null) {
-            charset = HTTP.DEF_CONTENT_CHARSET;
+            charset = Consts.ISO_8859_1;
         }
         this.b = s.getBytes(charset);
         this.buf = ByteBuffer.wrap(this.b);
@@ -86,7 +86,7 @@ public class NStringEntity extends Abstr
      *
      * @param s content to be used. Not {@code null}.
      * @param charset character set to be used. May be {@code null}, in which case the default
-     *   is {@link HTTP#DEF_CONTENT_CHARSET} is assumed
+     *   is {@link org.apache.http.Consts#ISO_8859_1} is assumed
      *
      * @throws IllegalArgumentException if the string parameter is null
      *

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ErrorResponseProducer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ErrorResponseProducer.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ErrorResponseProducer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ErrorResponseProducer.java Fri Nov 14 17:17:52 2014
@@ -29,13 +29,14 @@ package org.apache.http.nio.protocol;
 
 import java.io.IOException;
 
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpEntity;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpResponse;
 import org.apache.http.nio.ContentEncoder;
 import org.apache.http.nio.IOControl;
 import org.apache.http.nio.entity.EntityAsyncContentProducer;
 import org.apache.http.nio.entity.HttpAsyncContentProducer;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 
 class ErrorResponseProducer implements HttpAsyncResponseProducer {
@@ -63,9 +64,9 @@ class ErrorResponseProducer implements H
     @Override
     public HttpResponse generateResponse() {
         if (this.keepAlive) {
-            response.addHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE);
+            response.addHeader(HttpHeaders.CONNECTION, HeaderElements.KEEP_ALIVE);
         } else {
-            response.addHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
+            response.addHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
         }
         response.setEntity(this.entity);
         return response;

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java Fri Nov 14 17:17:52 2014
@@ -34,6 +34,7 @@ import java.util.LinkedList;
 import org.apache.http.ByteChannelMock;
 import org.apache.http.Consts;
 import org.apache.http.HttpEntity;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
@@ -53,7 +54,6 @@ import org.apache.http.nio.entity.HttpAs
 import org.apache.http.nio.entity.NStringEntity;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.util.SimpleInputBuffer;
-import org.apache.http.protocol.HTTP;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -329,7 +329,7 @@ public class TestDefaultNHttpClientConne
         conn = new DefaultNHttpClientConnection(session, 64);
 
         final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.addHeader(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
+        request.addHeader(HttpHeaders.TRANSFER_ENCODING, "chunked");
         final NStringEntity entity = new NStringEntity("a lot of various stuff");
         entity.setChunked(true);
         request.setEntity(entity);
@@ -360,7 +360,7 @@ public class TestDefaultNHttpClientConne
         conn = new DefaultNHttpClientConnection(session, 64);
 
         final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.addHeader(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
+        request.addHeader(HttpHeaders.TRANSFER_ENCODING, "chunked");
         final NStringEntity entity = new NStringEntity("a lot of various stuff");
         entity.setChunked(true);
         request.setEntity(entity);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java Fri Nov 14 17:17:52 2014
@@ -35,6 +35,7 @@ import org.apache.http.ByteChannelMock;
 import org.apache.http.Consts;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
@@ -46,14 +47,13 @@ import org.apache.http.message.BasicHttp
 import org.apache.http.nio.ContentDecoder;
 import org.apache.http.nio.ContentEncoder;
 import org.apache.http.nio.IOControl;
-import org.apache.http.nio.NHttpServerConnection;
 import org.apache.http.nio.NHttpConnection;
+import org.apache.http.nio.NHttpServerConnection;
 import org.apache.http.nio.NHttpServerEventHandler;
 import org.apache.http.nio.entity.HttpAsyncContentProducer;
 import org.apache.http.nio.entity.NStringEntity;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.util.SimpleInputBuffer;
-import org.apache.http.protocol.HTTP;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -325,7 +325,7 @@ public class TestDefaultNHttpServerConne
         conn = new DefaultNHttpServerConnection(session, 64);
 
         final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        response.addHeader(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
+        response.addHeader(HttpHeaders.TRANSFER_ENCODING, "chunked");
         final NStringEntity entity = new NStringEntity("a lot of various stuff");
         entity.setChunked(true);
         response.setEntity(entity);
@@ -355,7 +355,7 @@ public class TestDefaultNHttpServerConne
         conn = new DefaultNHttpServerConnection(session, 64);
 
         final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        response.addHeader(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
+        response.addHeader(HttpHeaders.TRANSFER_ENCODING, "chunked");
         final NStringEntity entity = new NStringEntity("a lot of various stuff");
         entity.setChunked(true);
         response.setEntity(entity);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestNHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestNHttpConnectionBase.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestNHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestNHttpConnectionBase.java Fri Nov 14 17:17:52 2014
@@ -32,6 +32,7 @@ import java.nio.channels.ByteChannel;
 import java.nio.channels.SelectionKey;
 
 import org.apache.http.HttpEntity;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpVersion;
 import org.apache.http.impl.entity.LaxContentLengthStrategy;
 import org.apache.http.impl.entity.StrictContentLengthStrategy;
@@ -45,7 +46,6 @@ import org.apache.http.message.BasicHttp
 import org.apache.http.nio.NHttpConnection;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.util.CharArrayBuffer;
 import org.junit.Assert;
 import org.junit.Before;
@@ -214,9 +214,9 @@ public class TestNHttpConnectionBase {
     @Test
     public void testPrepareLengthDelimitedDecoder() throws Exception {
         final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        response.addHeader(HTTP.CONTENT_LEN, "10");
-        response.addHeader(HTTP.CONTENT_TYPE, "stuff");
-        response.addHeader(HTTP.CONTENT_ENCODING, "identity");
+        response.addHeader(HttpHeaders.CONTENT_LENGTH, "10");
+        response.addHeader(HttpHeaders.CONTENT_TYPE, "stuff");
+        response.addHeader(HttpHeaders.CONTENT_ENCODING, "identity");
         Mockito.when(session.channel()).thenReturn(channel);
 
         final HttpEntity entity = conn.prepareDecoder(response);
@@ -233,9 +233,9 @@ public class TestNHttpConnectionBase {
     @Test
     public void testPrepareChunkDecoder() throws Exception {
         final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        response.addHeader(HTTP.TRANSFER_ENCODING, "chunked");
-        response.addHeader(HTTP.CONTENT_TYPE, "stuff");
-        response.addHeader(HTTP.CONTENT_ENCODING, "identity");
+        response.addHeader(HttpHeaders.TRANSFER_ENCODING, "chunked");
+        response.addHeader(HttpHeaders.CONTENT_TYPE, "stuff");
+        response.addHeader(HttpHeaders.CONTENT_ENCODING, "identity");
         Mockito.when(session.channel()).thenReturn(channel);
 
         final HttpEntity entity = conn.prepareDecoder(response);
@@ -261,7 +261,7 @@ public class TestNHttpConnectionBase {
     @Test
     public void testPrepareLengthDelimitedEncoder() throws Exception {
         final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        response.addHeader(HTTP.CONTENT_LEN, "10");
+        response.addHeader(HttpHeaders.CONTENT_LENGTH, "10");
         Mockito.when(session.channel()).thenReturn(channel);
 
         conn.prepareEncoder(response);
@@ -271,7 +271,7 @@ public class TestNHttpConnectionBase {
     @Test
     public void testPrepareChunkEncoder() throws Exception {
         final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        response.addHeader(HTTP.TRANSFER_ENCODING, "chunked");
+        response.addHeader(HttpHeaders.TRANSFER_ENCODING, "chunked");
         Mockito.when(session.channel()).thenReturn(channel);
 
         conn.prepareEncoder(response);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java Fri Nov 14 17:17:52 2014
@@ -36,6 +36,7 @@ import java.util.concurrent.ConcurrentLi
 import java.util.concurrent.Future;
 
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
@@ -61,7 +62,6 @@ import org.apache.http.nio.reactor.IORea
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.testserver.HttpCoreNIOTestBase;
 import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
 import org.apache.http.protocol.HttpRequestHandler;
@@ -366,7 +366,7 @@ public class TestHttpAsyncHandlers exten
                     public void process(
                             final HttpRequest request,
                             final HttpContext context) throws HttpException, IOException {
-                        request.addHeader(HTTP.TRANSFER_ENCODING, "identity");
+                        request.addHeader(HttpHeaders.TRANSFER_ENCODING, "identity");
                     }
 
                 },

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java Fri Nov 14 17:17:52 2014
@@ -40,6 +40,7 @@ import java.net.Socket;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.entity.ContentType;
@@ -51,7 +52,6 @@ import org.apache.http.nio.protocol.UriH
 import org.apache.http.nio.reactor.IOReactorStatus;
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.testserver.HttpCoreNIOTestBase;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
 import org.apache.http.protocol.HttpRequestHandler;
@@ -102,7 +102,7 @@ public class TestServerSidePipelining ex
                 final String content = "and goodbye";
                 final NStringEntity entity = new NStringEntity(content, ContentType.DEFAULT_TEXT);
                 response.setEntity(entity);
-                response.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
+                response.setHeader(HttpHeaders.CONNECTION, "Close");
             }
 
         }));

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestErrorResponseProducer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestErrorResponseProducer.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestErrorResponseProducer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestErrorResponseProducer.java Fri Nov 14 17:17:52 2014
@@ -28,11 +28,11 @@
 package org.apache.http.nio.protocol;
 
 import org.apache.http.HttpEntity;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.message.BasicHttpResponse;
-import org.apache.http.protocol.HTTP;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -59,7 +59,7 @@ public class TestErrorResponseProducer {
         erp = new ErrorResponseProducer(response, entity, true);
         final HttpResponse res = erp.generateResponse();
 
-        Assert.assertEquals(HTTP.CONN_KEEP_ALIVE, res.getFirstHeader(HTTP.CONN_DIRECTIVE).getValue());
+        Assert.assertEquals("keep-alive", res.getFirstHeader(HttpHeaders.CONNECTION).getValue());
         Assert.assertEquals(entity, res.getEntity());
         Assert.assertEquals(200, res.getStatusLine().getStatusCode());
     }
@@ -69,7 +69,7 @@ public class TestErrorResponseProducer {
         erp = new ErrorResponseProducer(response, entity, false);
         final HttpResponse res = erp.generateResponse();
 
-        Assert.assertEquals(HTTP.CONN_CLOSE, res.getFirstHeader(HTTP.CONN_DIRECTIVE).getValue());
+        Assert.assertEquals("close", res.getFirstHeader(HttpHeaders.CONNECTION).getValue());
         Assert.assertEquals(entity, res.getEntity());
         Assert.assertEquals(200, res.getStatusLine().getStatusCode());
     }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java Fri Nov 14 17:17:52 2014
@@ -31,7 +31,9 @@ import java.io.IOException;
 import java.net.SocketTimeoutException;
 
 import org.apache.http.ConnectionClosedException;
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpStatus;
 import org.apache.http.HttpVersion;
@@ -46,7 +48,6 @@ import org.apache.http.nio.NHttpConnecti
 import org.apache.http.nio.entity.NStringEntity;
 import org.apache.http.nio.protocol.HttpAsyncRequestExecutor.State;
 import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.junit.After;
 import org.junit.Assert;
@@ -220,7 +221,7 @@ public class TestHttpAsyncRequestExecuto
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
         this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
         final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.setHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.setHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         Mockito.when(this.exchangeHandler.generateRequest()).thenReturn(request);
         Mockito.when(this.conn.getSocketTimeout()).thenReturn(1000);
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java Fri Nov 14 17:17:52 2014
@@ -32,8 +32,10 @@ import java.net.SocketTimeoutException;
 import java.util.Queue;
 
 import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseFactory;
@@ -55,7 +57,6 @@ import org.apache.http.nio.protocol.Http
 import org.apache.http.nio.protocol.HttpAsyncService.State;
 import org.apache.http.nio.reactor.SessionBufferStatus;
 import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpProcessor;
@@ -474,7 +475,7 @@ public class TestHttpAsyncService {
 
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/",
                 HttpVersion.HTTP_1_1);
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.setHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
         Mockito.when(this.requestHandler.processRequest(
                 Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
@@ -522,7 +523,7 @@ public class TestHttpAsyncService {
 
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/",
                 HttpVersion.HTTP_1_1);
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.setHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
         Mockito.when(this.requestHandler.processRequest(
                 Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
@@ -605,7 +606,7 @@ public class TestHttpAsyncService {
 
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/",
                 HttpVersion.HTTP_1_1);
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.setHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
 
         Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
         Mockito.when(this.requestHandler.processRequest(
@@ -637,7 +638,7 @@ public class TestHttpAsyncService {
 
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/",
                 HttpVersion.HTTP_1_1);
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.setHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
 
         Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
         Mockito.when(this.requestHandler.processRequest(
@@ -664,7 +665,7 @@ public class TestHttpAsyncService {
 
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/",
                 HttpVersion.HTTP_1_1);
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.setHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
 
         Mockito.when(this.conn.getContext()).thenReturn(this.connContext);
         Mockito.when(this.conn.getHttpRequest()).thenReturn(request);

Modified: httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalReverseProxy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalReverseProxy.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalReverseProxy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalReverseProxy.java Fri Nov 14 17:17:52 2014
@@ -36,6 +36,7 @@ import org.apache.http.ConnectionClosedE
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HttpClientConnection;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
@@ -46,7 +47,6 @@ import org.apache.http.impl.DefaultBHttp
 import org.apache.http.impl.DefaultBHttpServerConnection;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
 import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpProcessor;
@@ -123,23 +123,23 @@ public class ElementalReverseProxy {
             System.out.println(">> Request URI: " + request.getRequestLine().getUri());
 
             // Remove hop-by-hop headers
-            request.removeHeaders(HTTP.CONTENT_LEN);
-            request.removeHeaders(HTTP.TRANSFER_ENCODING);
-            request.removeHeaders(HTTP.CONN_DIRECTIVE);
+            request.removeHeaders(HttpHeaders.CONTENT_LENGTH);
+            request.removeHeaders(HttpHeaders.TRANSFER_ENCODING);
+            request.removeHeaders(HttpHeaders.CONNECTION);
             request.removeHeaders("Keep-Alive");
             request.removeHeaders("Proxy-Authenticate");
-            request.removeHeaders("TE");
-            request.removeHeaders("Trailers");
-            request.removeHeaders("Upgrade");
+            request.removeHeaders(HttpHeaders.TE);
+            request.removeHeaders(HttpHeaders.TRAILER);
+            request.removeHeaders(HttpHeaders.UPGRADE);
 
             this.httpexecutor.preProcess(request, this.httpproc, context);
             final HttpResponse targetResponse = this.httpexecutor.execute(request, conn, context);
             this.httpexecutor.postProcess(response, this.httpproc, context);
 
             // Remove hop-by-hop headers
-            targetResponse.removeHeaders(HTTP.CONTENT_LEN);
-            targetResponse.removeHeaders(HTTP.TRANSFER_ENCODING);
-            targetResponse.removeHeaders(HTTP.CONN_DIRECTIVE);
+            targetResponse.removeHeaders(HttpHeaders.CONTENT_LENGTH);
+            targetResponse.removeHeaders(HttpHeaders.TRANSFER_ENCODING);
+            targetResponse.removeHeaders(HttpHeaders.CONNECTION);
             targetResponse.removeHeaders("Keep-Alive");
             targetResponse.removeHeaders("TE");
             targetResponse.removeHeaders("Trailers");

Copied: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderElements.java (from r1638390, httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderElements.java?p2=httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderElements.java&p1=httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java&r1=1638390&r2=1639706&rev=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderElements.java Fri Nov 14 17:17:52 2014
@@ -25,45 +25,22 @@
  *
  */
 
-package org.apache.http.protocol;
-
-import java.io.IOException;
-
-import org.apache.http.HttpException;
-import org.apache.http.HttpRequest;
-import org.apache.http.HttpRequestInterceptor;
-import org.apache.http.annotation.Immutable;
-import org.apache.http.util.Args;
+package org.apache.http;
 
 /**
- * RequestUserAgent is responsible for adding {@code User-Agent} header.
- * This interceptor is recommended for client side protocol processors.
+ * Constants for frequently used Header elements.
  *
- * @since 4.0
+ * @since 5.0
  */
-@Immutable
-public class RequestUserAgent implements HttpRequestInterceptor {
-
-    private final String userAgent;
+public final class HeaderElements {
 
-    public RequestUserAgent(final String userAgent) {
-        super();
-        this.userAgent = userAgent;
+    private HeaderElements() {
     }
 
-    public RequestUserAgent() {
-        this(null);
-    }
-
-    @Override
-    public void process(final HttpRequest request, final HttpContext context)
-        throws HttpException, IOException {
-        Args.notNull(request, "HTTP request");
-        if (!request.containsHeader(HTTP.USER_AGENT)) {
-            if (this.userAgent != null) {
-                request.addHeader(HTTP.USER_AGENT, this.userAgent);
-            }
-        }
-    }
+    public static final String CHUNKED_ENCODING = "chunked";
+    public static final String IDENTITY_ENCODING = "identity";
+    public static final String CLOSE = "close";
+    public static final String KEEP_ALIVE = "keep-alive";
+    public static final String CONTINUE = "100-continue";
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java Fri Nov 14 17:17:52 2014
@@ -29,9 +29,9 @@ package org.apache.http.entity;
 
 import org.apache.http.Header;
 import org.apache.http.HttpEntity;
+import org.apache.http.HttpHeaders;
 import org.apache.http.annotation.NotThreadSafe;
 import org.apache.http.message.BasicHeader;
-import org.apache.http.protocol.HTTP;
 
 /**
  * Abstract base class for entities.
@@ -115,7 +115,7 @@ public abstract class AbstractHttpEntity
     public void setContentType(final String ctString) {
         Header h = null;
         if (ctString != null) {
-            h = new BasicHeader(HTTP.CONTENT_TYPE, ctString);
+            h = new BasicHeader(HttpHeaders.CONTENT_TYPE, ctString);
         }
         setContentType(h);
     }
@@ -143,7 +143,7 @@ public abstract class AbstractHttpEntity
     public void setContentEncoding(final String ceString) {
         Header h = null;
         if (ceString != null) {
-            h = new BasicHeader(HTTP.CONTENT_ENCODING, ceString);
+            h = new BasicHeader(HttpHeaders.CONTENT_ENCODING, ceString);
         }
         setContentEncoding(h);
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java Fri Nov 14 17:17:52 2014
@@ -32,6 +32,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.impl.io.EmptyInputStream;
 import org.apache.http.util.Args;
 import org.apache.http.util.Asserts;
 
@@ -124,7 +125,7 @@ public class BasicHttpEntity extends Abs
 
     @Override
     public boolean isStreaming() {
-        return this.content != null;
+        return this.content != null && this.content != EmptyInputStream.INSTANCE;
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java Fri Nov 14 17:17:52 2014
@@ -33,8 +33,8 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.charset.Charset;
 
+import org.apache.http.Consts;
 import org.apache.http.annotation.NotThreadSafe;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.util.Args;
 
 /**
@@ -64,7 +64,7 @@ public class StringEntity extends Abstra
         Args.notNull(string, "Source string");
         Charset charset = contentType != null ? contentType.getCharset() : null;
         if (charset == null) {
-            charset = HTTP.DEF_CONTENT_CHARSET;
+            charset = Consts.ISO_8859_1;
         }
         this.content = string.getBytes(charset);
         if (contentType != null) {
@@ -78,7 +78,7 @@ public class StringEntity extends Abstra
      *
      * @param string content to be used. Not {@code null}.
      * @param charset character set to be used. May be {@code null}, in which case the default
-     *   is {@link HTTP#DEF_CONTENT_CHARSET} is assumed
+     *   is {@link org.apache.http.Consts#ISO_8859_1} is assumed
      *
      * @throws IllegalArgumentException if the string parameter is null
      *

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java Fri Nov 14 17:17:52 2014
@@ -43,6 +43,7 @@ import org.apache.http.Header;
 import org.apache.http.HttpConnectionMetrics;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpMessage;
 import org.apache.http.annotation.NotThreadSafe;
 import org.apache.http.config.MessageConstraints;
@@ -54,6 +55,7 @@ import org.apache.http.impl.io.ChunkedIn
 import org.apache.http.impl.io.ChunkedOutputStream;
 import org.apache.http.impl.io.ContentLengthInputStream;
 import org.apache.http.impl.io.ContentLengthOutputStream;
+import org.apache.http.impl.io.EmptyInputStream;
 import org.apache.http.impl.io.HttpTransportMetricsImpl;
 import org.apache.http.impl.io.IdentityInputStream;
 import org.apache.http.impl.io.IdentityOutputStream;
@@ -61,7 +63,6 @@ import org.apache.http.impl.io.SessionIn
 import org.apache.http.impl.io.SessionOutputBufferImpl;
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.io.SessionOutputBuffer;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.util.Args;
 import org.apache.http.util.Asserts;
 import org.apache.http.util.NetUtils;
@@ -205,6 +206,8 @@ public class BHttpConnectionBase impleme
             return new ChunkedInputStream(inbuffer, this.messageConstraints);
         } else if (len == ContentLengthStrategy.IDENTITY) {
             return new IdentityInputStream(inbuffer);
+        } else if (len == 0L) {
+            return EmptyInputStream.INSTANCE;
         } else {
             return new ContentLengthInputStream(inbuffer, len);
         }
@@ -229,11 +232,11 @@ public class BHttpConnectionBase impleme
             entity.setContent(instream);
         }
 
-        final Header contentTypeHeader = message.getFirstHeader(HTTP.CONTENT_TYPE);
+        final Header contentTypeHeader = message.getFirstHeader(HttpHeaders.CONTENT_TYPE);
         if (contentTypeHeader != null) {
             entity.setContentType(contentTypeHeader);
         }
-        final Header contentEncodingHeader = message.getFirstHeader(HTTP.CONTENT_ENCODING);
+        final Header contentEncodingHeader = message.getFirstHeader(HttpHeaders.CONTENT_ENCODING);
         if (contentEncodingHeader != null) {
             entity.setContentEncoding(contentEncodingHeader);
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultConnectionReuseStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultConnectionReuseStrategy.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultConnectionReuseStrategy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultConnectionReuseStrategy.java Fri Nov 14 17:17:52 2014
@@ -31,13 +31,14 @@ import java.util.Iterator;
 
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.Header;
+import org.apache.http.HeaderElements;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.apache.http.HttpVersion;
 import org.apache.http.ProtocolVersion;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.message.BasicTokenIterator;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.util.Args;
 
@@ -83,14 +84,14 @@ public class DefaultConnectionReuseStrat
         // Check for a self-terminating entity. If the end of the entity will
         // be indicated by closing the connection, there is no keep-alive.
         final ProtocolVersion ver = response.getStatusLine().getProtocolVersion();
-        final Header teh = response.getFirstHeader(HTTP.TRANSFER_ENCODING);
+        final Header teh = response.getFirstHeader(HttpHeaders.TRANSFER_ENCODING);
         if (teh != null) {
-            if (!HTTP.CHUNK_CODING.equalsIgnoreCase(teh.getValue())) {
+            if (!HeaderElements.CHUNKED_ENCODING.equalsIgnoreCase(teh.getValue())) {
                 return false;
             }
         } else {
             if (canResponseHaveBody(response)) {
-                final Header[] clhs = response.getHeaders(HTTP.CONTENT_LEN);
+                final Header[] clhs = response.getHeaders(HttpHeaders.CONTENT_LENGTH);
                 // Do not reuse if not properly content-length delimited
                 if (clhs.length == 1) {
                     final Header clh = clhs[0];
@@ -111,7 +112,7 @@ public class DefaultConnectionReuseStrat
         // Check for the "Connection" header. If that is absent, check for
         // the "Proxy-Connection" header. The latter is an unspecified and
         // broken but unfortunately common extension of HTTP.
-        Iterator<Header> hit = response.headerIterator(HTTP.CONN_DIRECTIVE);
+        Iterator<Header> hit = response.headerIterator(HttpHeaders.CONNECTION);
         if (!hit.hasNext()) {
             hit = response.headerIterator("Proxy-Connection");
         }
@@ -144,9 +145,9 @@ public class DefaultConnectionReuseStrat
             boolean keepalive = false;
             while (ti.hasNext()) {
                 final String token = ti.next();
-                if (HTTP.CONN_CLOSE.equalsIgnoreCase(token)) {
+                if (HeaderElements.CLOSE.equalsIgnoreCase(token)) {
                     return false;
-                } else if (HTTP.CONN_KEEP_ALIVE.equalsIgnoreCase(token)) {
+                } else if (HeaderElements.KEEP_ALIVE.equalsIgnoreCase(token)) {
                     // continue the loop, there may be a "close" afterwards
                     keepalive = true;
                 }

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=1639706&r1=1639705&r2=1639706&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 Nov 14 17:17:52 2014
@@ -29,13 +29,14 @@ package org.apache.http.impl.entity;
 
 import org.apache.http.Header;
 import org.apache.http.HeaderElement;
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpMessage;
 import org.apache.http.ParseException;
 import org.apache.http.ProtocolException;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.entity.ContentLengthStrategy;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.util.Args;
 
 /**
@@ -79,7 +80,7 @@ public class LaxContentLengthStrategy im
     public long determineLength(final HttpMessage message) throws HttpException {
         Args.notNull(message, "HTTP message");
 
-        final Header transferEncodingHeader = message.getFirstHeader(HTTP.TRANSFER_ENCODING);
+        final Header transferEncodingHeader = message.getFirstHeader(HttpHeaders.TRANSFER_ENCODING);
         // We use Transfer-Encoding if present and ignore Content-Length.
         // RFC2616, 4.4 item number 3
         if (transferEncodingHeader != null) {
@@ -93,19 +94,19 @@ public class LaxContentLengthStrategy im
             }
             // The chunked encoding must be the last one applied RFC2616, 14.41
             final int len = encodings.length;
-            if (HTTP.IDENTITY_CODING.equalsIgnoreCase(transferEncodingHeader.getValue())) {
+            if (HeaderElements.IDENTITY_ENCODING.equalsIgnoreCase(
+                    transferEncodingHeader.getValue())) {
                 return IDENTITY;
-            } else if ((len > 0) && (HTTP.CHUNK_CODING.equalsIgnoreCase(
-                    encodings[len - 1].getName()))) {
+            } else if ((len > 0) && (HeaderElements.CHUNKED_ENCODING.equalsIgnoreCase
+                    (encodings[len - 1].getName()))) {
                 return CHUNKED;
             } else {
                 return IDENTITY;
             }
         }
-        final Header contentLengthHeader = message.getFirstHeader(HTTP.CONTENT_LEN);
-        if (contentLengthHeader != null) {
+        if (message.containsHeader(HttpHeaders.CONTENT_LENGTH)) {
             long contentlen = -1;
-            final Header[] headers = message.getHeaders(HTTP.CONTENT_LEN);
+            final Header[] headers = message.getHeaders(HttpHeaders.CONTENT_LENGTH);
             for (int i = headers.length - 1; i >= 0; i--) {
                 final Header header = headers[i];
                 try {

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=1639706&r1=1639705&r2=1639706&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 Nov 14 17:17:52 2014
@@ -28,13 +28,14 @@
 package org.apache.http.impl.entity;
 
 import org.apache.http.Header;
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpMessage;
 import org.apache.http.HttpVersion;
 import org.apache.http.ProtocolException;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.entity.ContentLengthStrategy;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.util.Args;
 
 /**
@@ -81,24 +82,24 @@ public class StrictContentLengthStrategy
         // Although Transfer-Encoding is specified as a list, in practice
         // it is either missing or has the single value "chunked". So we
         // treat it as a single-valued header here.
-        final Header transferEncodingHeader = message.getFirstHeader(HTTP.TRANSFER_ENCODING);
+        final Header transferEncodingHeader = message.getFirstHeader(HttpHeaders.TRANSFER_ENCODING);
         if (transferEncodingHeader != null) {
             final String s = transferEncodingHeader.getValue();
-            if (HTTP.CHUNK_CODING.equalsIgnoreCase(s)) {
+            if (HeaderElements.CHUNKED_ENCODING.equalsIgnoreCase(s)) {
                 if (message.getProtocolVersion().lessEquals(HttpVersion.HTTP_1_0)) {
                     throw new ProtocolException(
                             "Chunked transfer encoding not allowed for " +
                             message.getProtocolVersion());
                 }
                 return CHUNKED;
-            } else if (HTTP.IDENTITY_CODING.equalsIgnoreCase(s)) {
+            } else if (HeaderElements.IDENTITY_ENCODING.equalsIgnoreCase(s)) {
                 return IDENTITY;
             } else {
                 throw new ProtocolException(
                         "Unsupported transfer encoding: " + s);
             }
         }
-        final Header contentLengthHeader = message.getFirstHeader(HTTP.CONTENT_LEN);
+        final Header contentLengthHeader = message.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
         if (contentLengthHeader != null) {
             final String s = contentLengthHeader.getValue();
             try {

Copied: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/EmptyInputStream.java (from r1638390, httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/EmptyInputStream.java?p2=httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/EmptyInputStream.java&p1=httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java&r1=1638390&r2=1639706&rev=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/EmptyInputStream.java Fri Nov 14 17:17:52 2014
@@ -25,45 +25,56 @@
  *
  */
 
-package org.apache.http.protocol;
+package org.apache.http.impl.io;
 
-import java.io.IOException;
+import java.io.InputStream;
 
-import org.apache.http.HttpException;
-import org.apache.http.HttpRequest;
-import org.apache.http.HttpRequestInterceptor;
-import org.apache.http.annotation.Immutable;
-import org.apache.http.util.Args;
-
-/**
- * RequestUserAgent is responsible for adding {@code User-Agent} header.
- * This interceptor is recommended for client side protocol processors.
- *
- * @since 4.0
- */
-@Immutable
-public class RequestUserAgent implements HttpRequestInterceptor {
+public final class EmptyInputStream extends InputStream {
+    public static final EmptyInputStream INSTANCE = new EmptyInputStream();
+
+    private EmptyInputStream() {
+    }
+
+    @Override
+    public int available() {
+        return 0;
+    }
 
-    private final String userAgent;
+    @Override
+    public void close() {
+    }
 
-    public RequestUserAgent(final String userAgent) {
-        super();
-        this.userAgent = userAgent;
+    @Override
+    public void mark(final int readLimit) {
     }
 
-    public RequestUserAgent() {
-        this(null);
+    @Override
+    public boolean markSupported() {
+        return true;
     }
 
     @Override
-    public void process(final HttpRequest request, final HttpContext context)
-        throws HttpException, IOException {
-        Args.notNull(request, "HTTP request");
-        if (!request.containsHeader(HTTP.USER_AGENT)) {
-            if (this.userAgent != null) {
-                request.addHeader(HTTP.USER_AGENT, this.userAgent);
-            }
-        }
+    public int read() {
+        return -1;
     }
 
+    @Override
+    public int read(final byte[] buf) {
+        return -1;
+    }
+
+    @Override
+    public int read(final byte[] buf, final int off, final int len) {
+        return -1;
+    }
+
+    @Override
+    public void reset() {
+    }
+
+    @Override
+    public long skip(final long n) {
+        return 0L;
+    }
 }
+

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java Fri Nov 14 17:17:52 2014
@@ -34,13 +34,13 @@ import java.nio.CharBuffer;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CoderResult;
 
+import org.apache.http.Consts;
 import org.apache.http.MessageConstraintException;
 import org.apache.http.annotation.NotThreadSafe;
 import org.apache.http.config.MessageConstraints;
 import org.apache.http.io.BufferInfo;
 import org.apache.http.io.HttpTransportMetrics;
 import org.apache.http.io.SessionInputBuffer;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.util.Args;
 import org.apache.http.util.Asserts;
 import org.apache.http.util.ByteArrayBuffer;
@@ -250,7 +250,7 @@ public class SessionInputBufferImpl impl
             // attempt to find end of line (LF)
             int pos = -1;
             for (int i = this.bufferpos; i < this.bufferlen; i++) {
-                if (this.buffer[i] == HTTP.LF) {
+                if (this.buffer[i] == Consts.LF) {
                     pos = i;
                     break;
                 }
@@ -312,12 +312,12 @@ public class SessionInputBufferImpl impl
         // discard LF if found
         int len = this.linebuffer.length();
         if (len > 0) {
-            if (this.linebuffer.byteAt(len - 1) == HTTP.LF) {
+            if (this.linebuffer.byteAt(len - 1) == Consts.LF) {
                 len--;
             }
             // discard CR if found
             if (len > 0) {
-                if (this.linebuffer.byteAt(len - 1) == HTTP.CR) {
+                if (this.linebuffer.byteAt(len - 1) == Consts.CR) {
                     len--;
                 }
             }
@@ -338,7 +338,7 @@ public class SessionInputBufferImpl impl
         final int off = this.bufferpos;
         int len;
         this.bufferpos = pos + 1;
-        if (pos > off && this.buffer[pos - 1] == HTTP.CR) {
+        if (pos > off && this.buffer[pos - 1] == Consts.CR) {
             // skip CR if found
             pos--;
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java Fri Nov 14 17:17:52 2014
@@ -34,11 +34,11 @@ import java.nio.CharBuffer;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
 
+import org.apache.http.Consts;
 import org.apache.http.annotation.NotThreadSafe;
 import org.apache.http.io.BufferInfo;
 import org.apache.http.io.HttpTransportMetrics;
 import org.apache.http.io.SessionOutputBuffer;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.util.Args;
 import org.apache.http.util.Asserts;
 import org.apache.http.util.ByteArrayBuffer;
@@ -57,7 +57,7 @@ import org.apache.http.util.CharArrayBuf
 @NotThreadSafe
 public class SessionOutputBufferImpl implements SessionOutputBuffer, BufferInfo {
 
-    private static final byte[] CRLF = new byte[] {HTTP.CR, HTTP.LF};
+    private static final byte[] CRLF = new byte[] {Consts.CR, Consts.LF};
 
     private final HttpTransportMetricsImpl metrics;
     private final ByteArrayBuffer buffer;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpEntityEnclosingRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpEntityEnclosingRequest.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpEntityEnclosingRequest.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpEntityEnclosingRequest.java Fri Nov 14 17:17:52 2014
@@ -28,12 +28,13 @@
 package org.apache.http.message;
 
 import org.apache.http.Header;
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.HttpHeaders;
 import org.apache.http.ProtocolVersion;
 import org.apache.http.RequestLine;
 import org.apache.http.annotation.NotThreadSafe;
-import org.apache.http.protocol.HTTP;
 
 /**
  * Basic implementation of {@link HttpEntityEnclosingRequest}.
@@ -71,8 +72,8 @@ public class BasicHttpEntityEnclosingReq
 
     @Override
     public boolean expectContinue() {
-        final Header expect = getFirstHeader(HTTP.EXPECT_DIRECTIVE);
-        return expect != null && HTTP.EXPECT_CONTINUE.equalsIgnoreCase(expect.getValue());
+        final Header expect = getFirstHeader(HttpHeaders.EXPECT);
+        return expect != null && HeaderElements.CONTINUE.equalsIgnoreCase(expect.getValue());
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpExpectationVerifier.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpExpectationVerifier.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpExpectationVerifier.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpExpectationVerifier.java Fri Nov 14 17:17:52 2014
@@ -34,26 +34,6 @@ import org.apache.http.HttpResponse;
 /**
  * Defines an interface to verify whether an incoming HTTP request meets
  * the target server's expectations.
- *<p>
- * The Expect request-header field is used to indicate that particular
- * server behaviors are required by the client.
- *</p>
- *<pre>
- *    Expect       =  "Expect" ":" 1#expectation
- *
- *    expectation  =  "100-continue" | expectation-extension
- *    expectation-extension =  token [ "=" ( token | quoted-string )
- *                             *expect-params ]
- *    expect-params =  ";" token [ "=" ( token | quoted-string ) ]
- *</pre>
- *<p>
- * A server that does not understand or is unable to comply with any of
- * the expectation values in the Expect field of a request MUST respond
- * with appropriate error status. The server MUST respond with a 417
- * (Expectation Failed) status if any of the expectations cannot be met
- * or, if there are other problems with the request, some other 4xx
- * status.
- *</p>
  *
  * @since 4.0
  */

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestConnControl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestConnControl.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestConnControl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestConnControl.java Fri Nov 14 17:17:52 2014
@@ -29,7 +29,9 @@ package org.apache.http.protocol;
 
 import java.io.IOException;
 
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.annotation.Immutable;
@@ -60,10 +62,10 @@ public class RequestConnControl implemen
             return;
         }
 
-        if (!request.containsHeader(HTTP.CONN_DIRECTIVE)) {
+        if (!request.containsHeader(HttpHeaders.CONNECTION)) {
             // Default policy is to keep connection alive
             // whenever possible
-            request.addHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE);
+            request.addHeader(HttpHeaders.CONNECTION, HeaderElements.KEEP_ALIVE);
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestContent.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestContent.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestContent.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestContent.java Fri Nov 14 17:17:52 2014
@@ -29,9 +29,11 @@ package org.apache.http.protocol;
 
 import java.io.IOException;
 
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpVersion;
@@ -86,20 +88,20 @@ public class RequestContent implements H
         Args.notNull(request, "HTTP request");
         if (request instanceof HttpEntityEnclosingRequest) {
             if (this.overwrite) {
-                request.removeHeaders(HTTP.TRANSFER_ENCODING);
-                request.removeHeaders(HTTP.CONTENT_LEN);
+                request.removeHeaders(HttpHeaders.TRANSFER_ENCODING);
+                request.removeHeaders(HttpHeaders.CONTENT_LENGTH);
             } else {
-                if (request.containsHeader(HTTP.TRANSFER_ENCODING)) {
+                if (request.containsHeader(HttpHeaders.TRANSFER_ENCODING)) {
                     throw new ProtocolException("Transfer-encoding header already present");
                 }
-                if (request.containsHeader(HTTP.CONTENT_LEN)) {
+                if (request.containsHeader(HttpHeaders.CONTENT_LENGTH)) {
                     throw new ProtocolException("Content-Length header already present");
                 }
             }
             final ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
             final HttpEntity entity = ((HttpEntityEnclosingRequest)request).getEntity();
             if (entity == null) {
-                request.addHeader(HTTP.CONTENT_LEN, "0");
+                request.addHeader(HttpHeaders.CONTENT_LENGTH, "0");
                 return;
             }
             // Must specify a transfer encoding or a content length
@@ -108,18 +110,18 @@ public class RequestContent implements H
                     throw new ProtocolException(
                             "Chunked transfer encoding not allowed for " + ver);
                 }
-                request.addHeader(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
+                request.addHeader(HttpHeaders.TRANSFER_ENCODING, HeaderElements.CHUNKED_ENCODING);
             } else {
-                request.addHeader(HTTP.CONTENT_LEN, Long.toString(entity.getContentLength()));
+                request.addHeader(HttpHeaders.CONTENT_LENGTH, Long.toString(entity.getContentLength()));
             }
             // Specify a content type if known
             if (entity.getContentType() != null && !request.containsHeader(
-                    HTTP.CONTENT_TYPE )) {
+                    HttpHeaders.CONTENT_TYPE )) {
                 request.addHeader(entity.getContentType());
             }
             // Specify a content encoding if known
             if (entity.getContentEncoding() != null && !request.containsHeader(
-                    HTTP.CONTENT_ENCODING)) {
+                    HttpHeaders.CONTENT_ENCODING)) {
                 request.addHeader(entity.getContentEncoding());
             }
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestDate.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestDate.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestDate.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestDate.java Fri Nov 14 17:17:52 2014
@@ -31,6 +31,7 @@ import java.io.IOException;
 
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.annotation.ThreadSafe;
@@ -57,9 +58,9 @@ public class RequestDate implements Http
             throws HttpException, IOException {
         Args.notNull(request, "HTTP request");
         if ((request instanceof HttpEntityEnclosingRequest) &&
-            !request.containsHeader(HTTP.DATE_HEADER)) {
+            !request.containsHeader(HttpHeaders.DATE)) {
             final String httpdate = DATE_GENERATOR.getCurrentDate();
-            request.setHeader(HTTP.DATE_HEADER, httpdate);
+            request.setHeader(HttpHeaders.DATE, httpdate);
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestExpectContinue.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestExpectContinue.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestExpectContinue.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestExpectContinue.java Fri Nov 14 17:17:52 2014
@@ -29,9 +29,11 @@ package org.apache.http.protocol;
 
 import java.io.IOException;
 
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpVersion;
@@ -58,14 +60,14 @@ public class RequestExpectContinue imple
             throws HttpException, IOException {
         Args.notNull(request, "HTTP request");
 
-        if (!request.containsHeader(HTTP.EXPECT_DIRECTIVE)) {
+        if (!request.containsHeader(HttpHeaders.EXPECT)) {
             if (request instanceof HttpEntityEnclosingRequest) {
                 final ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
                 final HttpEntity entity = ((HttpEntityEnclosingRequest)request).getEntity();
                 // Do not send the expect header if request body is known to be empty
                 if (entity != null
                         && entity.getContentLength() != 0 && !ver.lessEquals(HttpVersion.HTTP_1_0)) {
-                    request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+                    request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
                 }
             }
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java Fri Nov 14 17:17:52 2014
@@ -32,6 +32,7 @@ import java.net.InetSocketAddress;
 
 import org.apache.http.HttpConnection;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
@@ -67,7 +68,7 @@ public class RequestTargetHost implement
             return;
         }
 
-        if (!request.containsHeader(HTTP.TARGET_HOST)) {
+        if (!request.containsHeader(HttpHeaders.HOST)) {
             HttpHost targethost = corecontext.getTargetHost();
             if (targethost == null) {
                 // Populate the context with a default HTTP host based on the
@@ -87,7 +88,7 @@ public class RequestTargetHost implement
                     }
                 }
             }
-            request.addHeader(HTTP.TARGET_HOST, targethost.toHostString());
+            request.addHeader(HttpHeaders.HOST, targethost.toHostString());
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/RequestUserAgent.java Fri Nov 14 17:17:52 2014
@@ -30,6 +30,7 @@ package org.apache.http.protocol;
 import java.io.IOException;
 
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.annotation.Immutable;
@@ -59,9 +60,9 @@ public class RequestUserAgent implements
     public void process(final HttpRequest request, final HttpContext context)
         throws HttpException, IOException {
         Args.notNull(request, "HTTP request");
-        if (!request.containsHeader(HTTP.USER_AGENT)) {
+        if (!request.containsHeader(HttpHeaders.USER_AGENT)) {
             if (this.userAgent != null) {
-                request.addHeader(HTTP.USER_AGENT, this.userAgent);
+                request.addHeader(HttpHeaders.USER_AGENT, this.userAgent);
             }
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseConnControl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseConnControl.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseConnControl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseConnControl.java Fri Nov 14 17:17:52 2014
@@ -30,8 +30,10 @@ package org.apache.http.protocol;
 import java.io.IOException;
 
 import org.apache.http.Header;
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseInterceptor;
@@ -72,11 +74,11 @@ public class ResponseConnControl impleme
                 status == HttpStatus.SC_REQUEST_URI_TOO_LONG ||
                 status == HttpStatus.SC_SERVICE_UNAVAILABLE ||
                 status == HttpStatus.SC_NOT_IMPLEMENTED) {
-            response.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
+            response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
             return;
         }
-        final Header explicit = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
-        if (explicit != null && HTTP.CONN_CLOSE.equalsIgnoreCase(explicit.getValue())) {
+        final Header explicit = response.getFirstHeader(HttpHeaders.CONNECTION);
+        if (explicit != null && HeaderElements.CLOSE.equalsIgnoreCase(explicit.getValue())) {
             // Connection persistence explicitly disabled
             return;
         }
@@ -87,18 +89,18 @@ public class ResponseConnControl impleme
             final ProtocolVersion ver = response.getStatusLine().getProtocolVersion();
             if (entity.getContentLength() < 0 &&
                     (!entity.isChunked() || ver.lessEquals(HttpVersion.HTTP_1_0))) {
-                response.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
+                response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
                 return;
             }
         }
         // Drop connection if requested by the client or request was <= 1.0
         final HttpRequest request = corecontext.getRequest();
         if (request != null) {
-            final Header header = request.getFirstHeader(HTTP.CONN_DIRECTIVE);
+            final Header header = request.getFirstHeader(HttpHeaders.CONNECTION);
             if (header != null) {
-                response.setHeader(HTTP.CONN_DIRECTIVE, header.getValue());
+                response.setHeader(HttpHeaders.CONNECTION, header.getValue());
             } else if (request.getProtocolVersion().lessEquals(HttpVersion.HTTP_1_0)) {
-                response.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
+                response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
             }
         }
     }



Mime
View raw message