hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1639706 [2/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
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseContent.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseContent.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseContent.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseContent.java Fri Nov 14 17:17:52 2014
@@ -29,8 +29,10 @@ package org.apache.http.protocol;
 
 import java.io.IOException;
 
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseInterceptor;
 import org.apache.http.HttpStatus;
@@ -92,13 +94,13 @@ public class ResponseContent implements 
             throws HttpException, IOException {
         Args.notNull(response, "HTTP response");
         if (this.overwrite) {
-            response.removeHeaders(HTTP.TRANSFER_ENCODING);
-            response.removeHeaders(HTTP.CONTENT_LEN);
+            response.removeHeaders(HttpHeaders.TRANSFER_ENCODING);
+            response.removeHeaders(HttpHeaders.CONTENT_LENGTH);
         } else {
-            if (response.containsHeader(HTTP.TRANSFER_ENCODING)) {
+            if (response.containsHeader(HttpHeaders.TRANSFER_ENCODING)) {
                 throw new ProtocolException("Transfer-encoding header already present");
             }
-            if (response.containsHeader(HTTP.CONTENT_LEN)) {
+            if (response.containsHeader(HttpHeaders.CONTENT_LENGTH)) {
                 throw new ProtocolException("Content-Length header already present");
             }
         }
@@ -107,18 +109,18 @@ public class ResponseContent implements 
         if (entity != null) {
             final long len = entity.getContentLength();
             if (entity.isChunked() && !ver.lessEquals(HttpVersion.HTTP_1_0)) {
-                response.addHeader(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
+                response.addHeader(HttpHeaders.TRANSFER_ENCODING, HeaderElements.CHUNKED_ENCODING);
             } else if (len >= 0) {
-                response.addHeader(HTTP.CONTENT_LEN, Long.toString(entity.getContentLength()));
+                response.addHeader(HttpHeaders.CONTENT_LENGTH, Long.toString(entity.getContentLength()));
             }
             // Specify a content type if known
             if (entity.getContentType() != null && !response.containsHeader(
-                    HTTP.CONTENT_TYPE )) {
+                    HttpHeaders.CONTENT_TYPE)) {
                 response.addHeader(entity.getContentType());
             }
             // Specify a content encoding if known
             if (entity.getContentEncoding() != null && !response.containsHeader(
-                    HTTP.CONTENT_ENCODING)) {
+                    HttpHeaders.CONTENT_ENCODING)) {
                 response.addHeader(entity.getContentEncoding());
             }
         } else {
@@ -126,7 +128,7 @@ public class ResponseContent implements 
             if (status != HttpStatus.SC_NO_CONTENT
                     && status != HttpStatus.SC_NOT_MODIFIED
                     && status != HttpStatus.SC_RESET_CONTENT) {
-                response.addHeader(HTTP.CONTENT_LEN, "0");
+                response.addHeader(HttpHeaders.CONTENT_LENGTH, "0");
             }
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseDate.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseDate.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseDate.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseDate.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.HttpResponse;
 import org.apache.http.HttpResponseInterceptor;
 import org.apache.http.HttpStatus;
@@ -58,9 +59,9 @@ public class ResponseDate implements Htt
         Args.notNull(response, "HTTP response");
         final int status = response.getStatusLine().getStatusCode();
         if ((status >= HttpStatus.SC_OK) &&
-            !response.containsHeader(HTTP.DATE_HEADER)) {
+            !response.containsHeader(HttpHeaders.DATE)) {
             final String httpdate = DATE_GENERATOR.getCurrentDate();
-            response.setHeader(HTTP.DATE_HEADER, httpdate);
+            response.setHeader(HttpHeaders.DATE, httpdate);
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseServer.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ResponseServer.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.HttpResponse;
 import org.apache.http.HttpResponseInterceptor;
 import org.apache.http.annotation.Immutable;
@@ -62,9 +63,9 @@ public class ResponseServer implements H
     public void process(final HttpResponse response, final HttpContext context)
             throws HttpException, IOException {
         Args.notNull(response, "HTTP response");
-        if (!response.containsHeader(HTTP.SERVER_HEADER)) {
+        if (!response.containsHeader(HttpHeaders.SERVER)) {
             if (this.originServer != null) {
-                response.addHeader(HTTP.SERVER_HEADER, this.originServer);
+                response.addHeader(HttpHeaders.SERVER, this.originServer);
             }
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java Fri Nov 14 17:17:52 2014
@@ -30,8 +30,8 @@ package org.apache.http.util;
 import java.io.Serializable;
 import java.nio.CharBuffer;
 
+import org.apache.http.Consts;
 import org.apache.http.annotation.NotThreadSafe;
-import org.apache.http.protocol.HTTP;
 
 /**
  * A resizable char array.
@@ -429,6 +429,10 @@ public final class CharArrayBuffer imple
         return new String(this.buffer, beginIndex, endIndex - beginIndex);
     }
 
+    private static boolean isWhitespace(final char ch) {
+        return ch == Consts.SP || ch == Consts.HT || ch == Consts.CR || ch == Consts.LF;
+    }
+
     /**
      * Returns a substring of this buffer with leading and trailing whitespace
      * omitted. The substring begins with the first non-whitespace character
@@ -457,10 +461,10 @@ public final class CharArrayBuffer imple
         }
         int beginIndex0 = beginIndex;
         int endIndex0 = endIndex;
-        while (beginIndex0 < endIndex && HTTP.isWhitespace(this.buffer[beginIndex0])) {
+        while (beginIndex0 < endIndex && isWhitespace(this.buffer[beginIndex0])) {
             beginIndex0++;
         }
-        while (endIndex0 > beginIndex0 && HTTP.isWhitespace(this.buffer[endIndex0 - 1])) {
+        while (endIndex0 > beginIndex0 && isWhitespace(this.buffer[endIndex0 - 1])) {
             endIndex0--;
         }
         return new String(this.buffer, beginIndex0, endIndex0 - beginIndex0);

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java Fri Nov 14 17:17:52 2014
@@ -35,11 +35,11 @@ import java.io.UnsupportedEncodingExcept
 import java.nio.charset.Charset;
 import java.nio.charset.UnsupportedCharsetException;
 
+import org.apache.http.Consts;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.ParseException;
 import org.apache.http.entity.ContentType;
-import org.apache.http.protocol.HTTP;
 
 /**
  * Static helpers for dealing with {@link HttpEntity}s.
@@ -185,7 +185,7 @@ public final class EntityUtils {
                 charset = defaultCharset;
             }
             if (charset == null) {
-                charset = HTTP.DEF_CONTENT_CHARSET;
+                charset = Consts.ISO_8859_1;
             }
             final Reader reader = new InputStreamReader(instream, charset);
             final CharArrayBuffer buffer = new CharArrayBuffer(i);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestAbstractHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestAbstractHttpEntity.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestAbstractHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestAbstractHttpEntity.java Fri Nov 14 17:17:52 2014
@@ -28,8 +28,8 @@
 package org.apache.http.entity;
 
 import org.apache.http.Header;
+import org.apache.http.HttpHeaders;
 import org.apache.http.message.BasicHeader;
-import org.apache.http.protocol.HTTP;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -42,12 +42,12 @@ public class TestAbstractHttpEntity {
     @Test
     public void testContentType() throws Exception {
         final BasicHttpEntity httpentity = new BasicHttpEntity();
-        httpentity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "blah"));
-        Assert.assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
+        httpentity.setContentType(new BasicHeader(HttpHeaders.CONTENT_TYPE, "blah"));
+        Assert.assertEquals(HttpHeaders.CONTENT_TYPE, httpentity.getContentType().getName());
         Assert.assertEquals("blah", httpentity.getContentType().getValue());
 
         httpentity.setContentType("blah");
-        Assert.assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
+        Assert.assertEquals(HttpHeaders.CONTENT_TYPE, httpentity.getContentType().getName());
         Assert.assertEquals("blah", httpentity.getContentType().getValue());
 
         httpentity.setContentType((Header)null);
@@ -59,12 +59,12 @@ public class TestAbstractHttpEntity {
     @Test
     public void testContentEncoding() throws Exception {
         final BasicHttpEntity httpentity = new BasicHttpEntity();
-        httpentity.setContentEncoding(new BasicHeader(HTTP.CONTENT_ENCODING, "gzip"));
-        Assert.assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
+        httpentity.setContentEncoding(new BasicHeader(HttpHeaders.CONTENT_ENCODING, "gzip"));
+        Assert.assertEquals(HttpHeaders.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
         Assert.assertEquals("gzip", httpentity.getContentEncoding().getValue());
 
         httpentity.setContentEncoding("gzip");
-        Assert.assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
+        Assert.assertEquals(HttpHeaders.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
         Assert.assertEquals("gzip", httpentity.getContentEncoding().getValue());
 
         httpentity.setContentEncoding((Header)null);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestHttpEntityWrapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestHttpEntityWrapper.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestHttpEntityWrapper.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestHttpEntityWrapper.java Fri Nov 14 17:17:52 2014
@@ -30,7 +30,6 @@ package org.apache.http.entity;
 import java.io.ByteArrayOutputStream;
 
 import org.apache.http.Consts;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.util.EntityUtils;
 import org.junit.Assert;
 import org.junit.Test;
@@ -45,7 +44,7 @@ public class TestHttpEntityWrapper {
     public void testBasics() throws Exception {
         final String s = "Message content";
         final StringEntity httpentity = new StringEntity(s, ContentType.TEXT_PLAIN);
-        httpentity.setContentEncoding(HTTP.IDENTITY_CODING);
+        httpentity.setContentEncoding("identity");
         final HttpEntityWrapper wrapped = new HttpEntityWrapper(httpentity);
 
         Assert.assertEquals(httpentity.getContentLength(), wrapped.getContentLength());

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java Fri Nov 14 17:17:52 2014
@@ -36,7 +36,9 @@ import java.net.SocketException;
 import java.net.SocketTimeoutException;
 
 import org.apache.http.Header;
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpEntity;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
 import org.apache.http.config.MessageConstraints;
@@ -190,7 +192,7 @@ public class TestBHttpConnectionBase {
     @Test
     public void testPrepareInputChunked() throws Exception {
         final HttpResponse message = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        message.addHeader("Transfer-Encoding", "chunked");
+        message.addHeader(HttpHeaders.TRANSFER_ENCODING, HeaderElements.CHUNKED_ENCODING);
         final HttpEntity entity = conn.prepareInput(message);
         Assert.assertNotNull(entity);
         Assert.assertTrue(entity.isChunked());
@@ -224,7 +226,7 @@ public class TestBHttpConnectionBase {
     @Test
     public void testPrepareOutputChunked() throws Exception {
         final HttpResponse message = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        message.addHeader("Transfer-Encoding", "chunked");
+        message.addHeader(HttpHeaders.TRANSFER_ENCODING, HeaderElements.CHUNKED_ENCODING);
         final OutputStream outstream = conn.prepareOutput(message);
         Assert.assertNotNull(outstream);
         Assert.assertTrue((outstream instanceof ChunkedOutputStream));

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java Fri Nov 14 17:17:52 2014
@@ -37,11 +37,13 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 
+import org.apache.http.Consts;
 import org.apache.http.Header;
 import org.apache.http.HttpConnectionMetrics;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
 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;
@@ -55,7 +57,6 @@ import org.apache.http.entity.StringEnti
 import org.apache.http.impl.DefaultBHttpClientConnection;
 import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpExpectationVerifier;
 import org.apache.http.protocol.HttpRequestHandler;
@@ -700,7 +701,7 @@ public class TestSyncHttp {
                     final ContentType contentType = ContentType.getOrDefault(incoming);
                     Charset charset = contentType.getCharset();
                     if (charset == null) {
-                        charset = HTTP.DEF_CONTENT_CHARSET;
+                        charset = Consts.ISO_8859_1;
                     }
                     final RepeatingEntity outgoing = new RepeatingEntity(line, charset, n);
                     outgoing.setChunked(n % 2 == 0);
@@ -736,7 +737,7 @@ public class TestSyncHttp {
                     final ContentType contentType = ContentType.getOrDefault(incoming);
                     Charset charset = contentType.getCharset();
                     if (charset == null) {
-                        charset = HTTP.DEF_CONTENT_CHARSET;
+                        charset = Consts.ISO_8859_1;
                     }
                     Assert.assertNotNull(instream);
                     final BufferedReader reader = new BufferedReader(new InputStreamReader(instream, charset));
@@ -895,21 +896,20 @@ public class TestSyncHttp {
             post.setEntity(null);
 
             this.client = new HttpClient(new ImmutableHttpProcessor(
-                    new HttpRequestInterceptor[] {
-                            new HttpRequestInterceptor() {
+                    new HttpRequestInterceptor() {
 
-                                @Override
-                                public void process(
-                                        final HttpRequest request,
-                                        final HttpContext context) throws HttpException, IOException {
-                                    request.addHeader(HTTP.TRANSFER_ENCODING, "identity");
-                                }
+                        @Override
+                        public void process(
+                                final HttpRequest request,
+                                final HttpContext context) throws HttpException, IOException {
+                            request.addHeader(HttpHeaders.TRANSFER_ENCODING, "identity");
+                        }
 
-                            },
-                            new RequestTargetHost(),
-                            new RequestConnControl(),
-                            new RequestUserAgent(),
-                            new RequestExpectContinue() }));
+                    },
+                    new RequestTargetHost(),
+                    new RequestConnControl(),
+                    new RequestUserAgent(),
+                    new RequestExpectContinue()));
 
             final HttpResponse response = this.client.execute(post, host, conn);
             Assert.assertEquals(HttpStatus.SC_BAD_REQUEST, response.getStatusLine().getStatusCode());

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.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.HttpClientConnection;
 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;
@@ -297,7 +299,7 @@ public class TestHttpRequestExecutor {
 
         final HttpCoreContext context = HttpCoreContext.create();
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final HttpEntity entity = Mockito.mock(HttpEntity.class);
         request.setEntity(entity);
 
@@ -331,7 +333,7 @@ public class TestHttpRequestExecutor {
 
         final HttpCoreContext context = HttpCoreContext.create();
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final HttpEntity entity = Mockito.mock(HttpEntity.class);
         request.setEntity(entity);
 
@@ -362,7 +364,7 @@ public class TestHttpRequestExecutor {
 
         final HttpCoreContext context = HttpCoreContext.create();
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final HttpEntity entity = Mockito.mock(HttpEntity.class);
         request.setEntity(entity);
 
@@ -390,7 +392,7 @@ public class TestHttpRequestExecutor {
 
         final HttpCoreContext context = HttpCoreContext.create();
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final HttpEntity entity = Mockito.mock(HttpEntity.class);
         request.setEntity(entity);
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java Fri Nov 14 17:17:52 2014
@@ -30,8 +30,10 @@ package org.apache.http.protocol;
 import java.io.InputStream;
 
 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;
@@ -210,7 +212,7 @@ public class TestHttpService {
         final HttpCoreContext context = HttpCoreContext.create();
         final HttpServerConnection conn = Mockito.mock(HttpServerConnection.class);
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final InputStream instream = Mockito.mock(InputStream.class);
         final InputStreamEntity entity = new InputStreamEntity(instream, -1);
         request.setEntity(entity);
@@ -269,7 +271,7 @@ public class TestHttpService {
         final HttpCoreContext context = HttpCoreContext.create();
         final HttpServerConnection conn = Mockito.mock(HttpServerConnection.class);
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final InputStream instream = Mockito.mock(InputStream.class);
         final InputStreamEntity entity = new InputStreamEntity(instream, -1);
         request.setEntity(entity);
@@ -313,7 +315,7 @@ public class TestHttpService {
         final HttpCoreContext context = HttpCoreContext.create();
         final HttpServerConnection conn = Mockito.mock(HttpServerConnection.class);
         final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final InputStream instream = Mockito.mock(InputStream.class);
         final InputStreamEntity entity = new InputStreamEntity(instream, -1);
         request.setEntity(entity);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java?rev=1639706&r1=1639705&r2=1639706&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java Fri Nov 14 17:17:52 2014
@@ -32,7 +32,9 @@ import java.net.InetSocketAddress;
 
 import org.apache.http.Consts;
 import org.apache.http.Header;
+import org.apache.http.HeaderElements;
 import org.apache.http.HttpConnection;
+import org.apache.http.HttpHeaders;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
@@ -56,9 +58,9 @@ public class TestStandardInterceptors {
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         final RequestConnControl interceptor = new RequestConnControl();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = request.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNotNull(header);
-        Assert.assertEquals(HTTP.CONN_KEEP_ALIVE, header.getValue());
+        Assert.assertEquals("keep-alive", header.getValue());
     }
 
     @Test
@@ -67,7 +69,7 @@ public class TestStandardInterceptors {
         final BasicHttpRequest request = new BasicHttpRequest("CONNECT", "/");
         final RequestConnControl interceptor = new RequestConnControl();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = request.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNull(header);
     }
 
@@ -75,13 +77,13 @@ public class TestStandardInterceptors {
     public void testRequestConnControlCustom() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        final Header myheader = new BasicHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
+        final Header myheader = new BasicHeader(HttpHeaders.CONNECTION, "close");
         request.addHeader(myheader);
         final RequestConnControl interceptor = new RequestConnControl();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = request.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNotNull(header);
-        Assert.assertEquals(HTTP.CONN_CLOSE, header.getValue());
+        Assert.assertEquals("close", header.getValue());
         Assert.assertTrue(header == myheader);
     }
 
@@ -100,9 +102,9 @@ public class TestStandardInterceptors {
     public void testRequestContentProtocolException() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
         final BasicHttpRequest request1 = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request1.addHeader(new BasicHeader(HTTP.TRANSFER_ENCODING, "chunked"));
+        request1.addHeader(new BasicHeader(HttpHeaders.TRANSFER_ENCODING, "chunked"));
         final BasicHttpRequest request2 = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request2.addHeader(new BasicHeader(HTTP.CONTENT_LEN, "12"));
+        request2.addHeader(new BasicHeader(HttpHeaders.CONTENT_LENGTH, "12"));
 
         final RequestContent interceptor = new RequestContent();
         try {
@@ -126,10 +128,10 @@ public class TestStandardInterceptors {
 
         final RequestContent interceptor = new RequestContent();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.CONTENT_LEN);
+        final Header header = request.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
         Assert.assertNotNull(header);
         Assert.assertEquals("0", header.getValue());
-        Assert.assertNull(request.getFirstHeader(HTTP.TRANSFER_ENCODING));
+        Assert.assertNull(request.getFirstHeader(HttpHeaders.TRANSFER_ENCODING));
    }
 
     @Test
@@ -142,10 +144,10 @@ public class TestStandardInterceptors {
 
         final RequestContent interceptor = new RequestContent();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.CONTENT_LEN);
+        final Header header = request.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
         Assert.assertNotNull(header);
         Assert.assertEquals(s.length(), Integer.parseInt(header.getValue()));
-        Assert.assertNull(request.getFirstHeader(HTTP.TRANSFER_ENCODING));
+        Assert.assertNull(request.getFirstHeader(HttpHeaders.TRANSFER_ENCODING));
    }
 
     @Test
@@ -159,10 +161,10 @@ public class TestStandardInterceptors {
 
         final RequestContent interceptor = new RequestContent();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.TRANSFER_ENCODING);
+        final Header header = request.getFirstHeader(HttpHeaders.TRANSFER_ENCODING);
         Assert.assertNotNull(header);
         Assert.assertEquals("chunked", header.getValue());
-        Assert.assertNull(request.getFirstHeader(HTTP.CONTENT_LEN));
+        Assert.assertNull(request.getFirstHeader(HttpHeaders.CONTENT_LENGTH));
    }
 
     @Test
@@ -176,10 +178,10 @@ public class TestStandardInterceptors {
 
         final RequestContent interceptor = new RequestContent();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.TRANSFER_ENCODING);
+        final Header header = request.getFirstHeader(HttpHeaders.TRANSFER_ENCODING);
         Assert.assertNotNull(header);
         Assert.assertEquals("chunked", header.getValue());
-        Assert.assertNull(request.getFirstHeader(HTTP.CONTENT_LEN));
+        Assert.assertNull(request.getFirstHeader(HttpHeaders.CONTENT_LENGTH));
     }
 
     @Test
@@ -212,10 +214,10 @@ public class TestStandardInterceptors {
 
         final RequestContent interceptor = new RequestContent();
         interceptor.process(request, context);
-        final Header h1 = request.getFirstHeader(HTTP.CONTENT_TYPE);
+        final Header h1 = request.getFirstHeader(HttpHeaders.CONTENT_TYPE);
         Assert.assertNotNull(h1);
         Assert.assertEquals("whatever", h1.getValue());
-        final Header h2 = request.getFirstHeader(HTTP.CONTENT_ENCODING);
+        final Header h2 = request.getFirstHeader(HttpHeaders.CONTENT_ENCODING);
         Assert.assertNotNull(h2);
         Assert.assertEquals("whatever", h2.getValue());
     }
@@ -229,8 +231,8 @@ public class TestStandardInterceptors {
 
         final RequestContent interceptor = new RequestContent();
         interceptor.process(request, context);
-        Assert.assertNull(request.getFirstHeader(HTTP.CONTENT_TYPE));
-        Assert.assertNull(request.getFirstHeader(HTTP.CONTENT_ENCODING));
+        Assert.assertNull(request.getFirstHeader(HttpHeaders.CONTENT_TYPE));
+        Assert.assertNull(request.getFirstHeader(HttpHeaders.CONTENT_ENCODING));
     }
 
     @Test
@@ -277,10 +279,10 @@ public class TestStandardInterceptors {
         final RequestContent interceptor = new RequestContent(true);
         final HttpContext context = new BasicHttpContext(null);
         final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.addHeader(new BasicHeader(HTTP.CONTENT_LEN, "10"));
-        request.addHeader(new BasicHeader(HTTP.TRANSFER_ENCODING, "whatever"));
+        request.addHeader(new BasicHeader(HttpHeaders.CONTENT_LENGTH, "10"));
+        request.addHeader(new BasicHeader(HttpHeaders.TRANSFER_ENCODING, "whatever"));
         interceptor.process(request, context);
-        Assert.assertEquals("0", request.getFirstHeader(HTTP.CONTENT_LEN).getValue());
+        Assert.assertEquals("0", request.getFirstHeader(HttpHeaders.CONTENT_LENGTH).getValue());
     }
 
     @Test
@@ -289,8 +291,8 @@ public class TestStandardInterceptors {
         final HttpContext context = new BasicHttpContext(null);
         final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
         interceptor.process(request, context);
-        Assert.assertEquals("0", request.getFirstHeader(HTTP.CONTENT_LEN).getValue());
-        Assert.assertNull(request.getFirstHeader(HTTP.TRANSFER_ENCODING));
+        Assert.assertEquals("0", request.getFirstHeader(HttpHeaders.CONTENT_LENGTH).getValue());
+        Assert.assertNull(request.getFirstHeader(HttpHeaders.TRANSFER_ENCODING));
     }
 
     @Test
@@ -302,9 +304,9 @@ public class TestStandardInterceptors {
         request.setEntity(entity);
         final RequestExpectContinue interceptor = new RequestExpectContinue();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.EXPECT_DIRECTIVE);
+        final Header header = request.getFirstHeader(HttpHeaders.EXPECT);
         Assert.assertNotNull(header);
-        Assert.assertEquals(HTTP.EXPECT_CONTINUE, header.getValue());
+        Assert.assertEquals(HeaderElements.CONTINUE, header.getValue());
     }
 
     @Test
@@ -317,7 +319,7 @@ public class TestStandardInterceptors {
         request.setEntity(entity);
         final RequestExpectContinue interceptor = new RequestExpectContinue();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.EXPECT_DIRECTIVE);
+        final Header header = request.getFirstHeader(HttpHeaders.EXPECT);
         Assert.assertNull(header);
     }
 
@@ -330,7 +332,7 @@ public class TestStandardInterceptors {
         request.setEntity(entity);
         final RequestExpectContinue interceptor = new RequestExpectContinue();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.EXPECT_DIRECTIVE);
+        final Header header = request.getFirstHeader(HttpHeaders.EXPECT);
         Assert.assertNull(header);
     }
 
@@ -362,7 +364,7 @@ public class TestStandardInterceptors {
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.TARGET_HOST);
+        final Header header = request.getFirstHeader(HttpHeaders.HOST);
         Assert.assertNotNull(header);
         Assert.assertEquals("somehost:8080", header.getValue());
     }
@@ -379,7 +381,7 @@ public class TestStandardInterceptors {
         context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.TARGET_HOST);
+        final Header header = request.getFirstHeader(HttpHeaders.HOST);
         Assert.assertNotNull(header);
         Assert.assertEquals("somehost:1234", header.getValue());
     }
@@ -402,10 +404,10 @@ public class TestStandardInterceptors {
         final HttpHost host = new HttpHost("somehost", 8080, "http");
         context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, host);
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new BasicHeader(HTTP.TARGET_HOST, "whatever"));
+        request.addHeader(new BasicHeader(HttpHeaders.HOST, "whatever"));
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.TARGET_HOST);
+        final Header header = request.getFirstHeader(HttpHeaders.HOST);
         Assert.assertNotNull(header);
         Assert.assertEquals("whatever", header.getValue());
     }
@@ -417,7 +419,7 @@ public class TestStandardInterceptors {
                 "GET", "/", HttpVersion.HTTP_1_0);
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.TARGET_HOST);
+        final Header header = request.getFirstHeader(HttpHeaders.HOST);
         Assert.assertNull(header);
     }
 
@@ -459,7 +461,7 @@ public class TestStandardInterceptors {
         final BasicHttpRequest request = new BasicHttpRequest("CONNECT", "/");
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.TARGET_HOST);
+        final Header header = request.getFirstHeader(HttpHeaders.HOST);
         Assert.assertNotNull(header);
         Assert.assertEquals("somehost:8080", header.getValue());
     }
@@ -472,7 +474,7 @@ public class TestStandardInterceptors {
         final BasicHttpRequest request = new BasicHttpRequest("CONNECT", "/", HttpVersion.HTTP_1_0);
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.TARGET_HOST);
+        final Header header = request.getFirstHeader(HttpHeaders.HOST);
         Assert.assertNull(header);
     }
 
@@ -482,7 +484,7 @@ public class TestStandardInterceptors {
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         final RequestUserAgent interceptor = new RequestUserAgent("some agent");
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.USER_AGENT);
+        final Header header = request.getFirstHeader(HttpHeaders.USER_AGENT);
         Assert.assertNotNull(header);
         Assert.assertEquals("some agent", header.getValue());
     }
@@ -491,10 +493,10 @@ public class TestStandardInterceptors {
     public void testRequestUserAgentNotGenerated() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new BasicHeader(HTTP.USER_AGENT, "whatever"));
+        request.addHeader(new BasicHeader(HttpHeaders.USER_AGENT, "whatever"));
         final RequestUserAgent interceptor = new RequestUserAgent("some agent");
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.USER_AGENT);
+        final Header header = request.getFirstHeader(HttpHeaders.USER_AGENT);
         Assert.assertNotNull(header);
         Assert.assertEquals("whatever", header.getValue());
     }
@@ -505,7 +507,7 @@ public class TestStandardInterceptors {
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         final RequestUserAgent interceptor = new RequestUserAgent();
         interceptor.process(request, context);
-        final Header header = request.getFirstHeader(HTTP.USER_AGENT);
+        final Header header = request.getFirstHeader(HttpHeaders.USER_AGENT);
         Assert.assertNull(header);
     }
 
@@ -526,7 +528,7 @@ public class TestStandardInterceptors {
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
         final ResponseConnControl interceptor = new ResponseConnControl();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNull(header);
     }
 
@@ -538,7 +540,7 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNull(header);
     }
 
@@ -546,16 +548,16 @@ public class TestStandardInterceptors {
     public void testResponseConnControlEntityUnknownContentLength() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new BasicHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
+        request.addHeader(new BasicHeader(HttpHeaders.CONNECTION, "keep-alive"));
         context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
         final BasicHttpEntity entity = new BasicHttpEntity();
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNotNull(header);
-        Assert.assertEquals(HTTP.CONN_CLOSE, header.getValue());
+        Assert.assertEquals("close", header.getValue());
     }
 
     @Test
@@ -567,7 +569,7 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNull(header);
     }
 
@@ -575,7 +577,7 @@ public class TestStandardInterceptors {
     public void testResponseConnControlEntityUnknownContentLengthHTTP10() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new BasicHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
+        request.addHeader(new BasicHeader(HttpHeaders.CONNECTION, "keep-alive"));
         context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
 
         final BasicHttpResponse response = new BasicHttpResponse(
@@ -584,16 +586,16 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNotNull(header);
-        Assert.assertEquals(HTTP.CONN_CLOSE, header.getValue());
+        Assert.assertEquals("close", header.getValue());
     }
 
     @Test
     public void testResponseConnControlClientRequest() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new BasicHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
+        request.addHeader(new BasicHeader(HttpHeaders.CONNECTION, "keep-alive"));
         context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
 
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
@@ -601,9 +603,9 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNotNull(header);
-        Assert.assertEquals(HTTP.CONN_KEEP_ALIVE, header.getValue());
+        Assert.assertEquals("keep-alive", header.getValue());
     }
 
     @Test
@@ -617,7 +619,7 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNull(header);
     }
 
@@ -632,16 +634,16 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNotNull(header);
-        Assert.assertEquals(HTTP.CONN_CLOSE, header.getValue());
+        Assert.assertEquals("close", header.getValue());
     }
 
     @Test
     public void testResponseConnControlStatusCode() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new BasicHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
+        request.addHeader(new BasicHeader(HttpHeaders.CONNECTION, "keep-alive"));
         context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
 
         final ResponseConnControl interceptor = new ResponseConnControl();
@@ -659,9 +661,9 @@ public class TestStandardInterceptors {
             final BasicHttpResponse response = new BasicHttpResponse(
                     HttpVersion.HTTP_1_1, statusCode, "Unreasonable");
             interceptor.process(response, context);
-            final Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
+            final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
             Assert.assertNotNull(header);
-            Assert.assertEquals(HTTP.CONN_CLOSE, header.getValue());
+            Assert.assertEquals("close", header.getValue());
         }
 
     }
@@ -670,18 +672,18 @@ public class TestStandardInterceptors {
     public void testResponseConnControlExplicitClose() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new BasicHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
+        request.addHeader(new BasicHeader(HttpHeaders.CONNECTION, "keep-alive"));
         context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
 
         final ResponseConnControl interceptor = new ResponseConnControl();
 
         final BasicHttpResponse response = new BasicHttpResponse(
                 HttpVersion.HTTP_1_1, 200, "OK");
-        response.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
+        response.setHeader(HttpHeaders.CONNECTION, "close");
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
+        final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
         Assert.assertNotNull(header);
-        Assert.assertEquals(HTTP.CONN_CLOSE, header.getValue());
+        Assert.assertEquals("close", header.getValue());
     }
 
     @Test
@@ -708,7 +710,7 @@ public class TestStandardInterceptors {
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONTENT_LEN);
+        final Header header = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
         Assert.assertNotNull(header);
         Assert.assertEquals("0", header.getValue());
     }
@@ -720,7 +722,7 @@ public class TestStandardInterceptors {
         response.setStatusCode(HttpStatus.SC_NO_CONTENT);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONTENT_LEN);
+        final Header header = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
         Assert.assertNull(header);
     }
 
@@ -731,7 +733,7 @@ public class TestStandardInterceptors {
         response.setStatusCode(HttpStatus.SC_RESET_CONTENT);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONTENT_LEN);
+        final Header header = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
         Assert.assertNull(header);
     }
 
@@ -742,7 +744,7 @@ public class TestStandardInterceptors {
         response.setStatusCode(HttpStatus.SC_NOT_MODIFIED);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
-        final Header header = response.getFirstHeader(HTTP.CONTENT_LEN);
+        final Header header = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
         Assert.assertNull(header);
     }
 
@@ -755,10 +757,10 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
-        final Header h1 = response.getFirstHeader(HTTP.TRANSFER_ENCODING);
+        final Header h1 = response.getFirstHeader(HttpHeaders.TRANSFER_ENCODING);
         Assert.assertNotNull(h1);
-        Assert.assertEquals(HTTP.CHUNK_CODING, h1.getValue());
-        final Header h2 = response.getFirstHeader(HTTP.CONTENT_LEN);
+        Assert.assertEquals("chunked", h1.getValue());
+        final Header h2 = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
         Assert.assertNull(h2);
     }
 
@@ -771,10 +773,10 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
-        final Header h1 = response.getFirstHeader(HTTP.CONTENT_LEN);
+        final Header h1 = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
         Assert.assertNotNull(h1);
         Assert.assertEquals("10", h1.getValue());
-        final Header h2 = response.getFirstHeader(HTTP.TRANSFER_ENCODING);
+        final Header h2 = response.getFirstHeader(HttpHeaders.TRANSFER_ENCODING);
         Assert.assertNull(h2);
     }
 
@@ -786,9 +788,9 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
-        final Header h1 = response.getFirstHeader(HTTP.TRANSFER_ENCODING);
+        final Header h1 = response.getFirstHeader(HttpHeaders.TRANSFER_ENCODING);
         Assert.assertNull(h1);
-        final Header h2 = response.getFirstHeader(HTTP.CONTENT_LEN);
+        final Header h2 = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
         Assert.assertNull(h2);
     }
 
@@ -801,9 +803,9 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
-        final Header h1 = response.getFirstHeader(HTTP.TRANSFER_ENCODING);
+        final Header h1 = response.getFirstHeader(HttpHeaders.TRANSFER_ENCODING);
         Assert.assertNull(h1);
-        final Header h2 = response.getFirstHeader(HTTP.CONTENT_LEN);
+        final Header h2 = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
         Assert.assertNull(h2);
     }
 
@@ -815,9 +817,9 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
-        final Header h1 = response.getFirstHeader(HTTP.CONTENT_TYPE);
+        final Header h1 = response.getFirstHeader(HttpHeaders.CONTENT_TYPE);
         Assert.assertNull(h1);
-        final Header h2 = response.getFirstHeader(HTTP.CONTENT_ENCODING);
+        final Header h2 = response.getFirstHeader(HttpHeaders.CONTENT_ENCODING);
         Assert.assertNull(h2);
     }
 
@@ -831,10 +833,10 @@ public class TestStandardInterceptors {
         response.setEntity(entity);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
-        final Header h1 = response.getFirstHeader(HTTP.CONTENT_TYPE);
+        final Header h1 = response.getFirstHeader(HttpHeaders.CONTENT_TYPE);
         Assert.assertNotNull(h1);
         Assert.assertEquals("whatever", h1.getValue());
-        final Header h2 = response.getFirstHeader(HTTP.CONTENT_ENCODING);
+        final Header h2 = response.getFirstHeader(HttpHeaders.CONTENT_ENCODING);
         Assert.assertNotNull(h2);
         Assert.assertEquals("whatever", h2.getValue());
     }
@@ -856,7 +858,7 @@ public class TestStandardInterceptors {
         final HttpContext context = new BasicHttpContext(null);
         try {
             final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
-            response.addHeader(new BasicHeader(HTTP.CONTENT_LEN, "10"));
+            response.addHeader(new BasicHeader(HttpHeaders.CONTENT_LENGTH, "10"));
             interceptor.process(response, context);
             Assert.fail("ProtocolException should have been thrown");
         } catch (final ProtocolException ex) {
@@ -864,7 +866,7 @@ public class TestStandardInterceptors {
         }
         try {
             final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
-            response.addHeader(new BasicHeader(HTTP.TRANSFER_ENCODING, "stuff"));
+            response.addHeader(new BasicHeader(HttpHeaders.TRANSFER_ENCODING, "stuff"));
             interceptor.process(response, context);
             Assert.fail("ProtocolException should have been thrown");
         } catch (final ProtocolException ex) {
@@ -877,10 +879,10 @@ public class TestStandardInterceptors {
         final ResponseContent interceptor = new ResponseContent(true);
         final HttpContext context = new BasicHttpContext(null);
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
-        response.addHeader(new BasicHeader(HTTP.CONTENT_LEN, "10"));
-        response.addHeader(new BasicHeader(HTTP.TRANSFER_ENCODING, "whatever"));
+        response.addHeader(new BasicHeader(HttpHeaders.CONTENT_LENGTH, "10"));
+        response.addHeader(new BasicHeader(HttpHeaders.TRANSFER_ENCODING, "whatever"));
         interceptor.process(response, context);
-        Assert.assertEquals("0", response.getFirstHeader(HTTP.CONTENT_LEN).getValue());
+        Assert.assertEquals("0", response.getFirstHeader(HttpHeaders.CONTENT_LENGTH).getValue());
     }
 
     @Test
@@ -889,8 +891,8 @@ public class TestStandardInterceptors {
         final HttpContext context = new BasicHttpContext(null);
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
         interceptor.process(response, context);
-        Assert.assertEquals("0", response.getFirstHeader(HTTP.CONTENT_LEN).getValue());
-        Assert.assertNull(response.getFirstHeader(HTTP.TRANSFER_ENCODING));
+        Assert.assertEquals("0", response.getFirstHeader(HttpHeaders.CONTENT_LENGTH).getValue());
+        Assert.assertNull(response.getFirstHeader(HttpHeaders.TRANSFER_ENCODING));
     }
 
     @Test
@@ -899,10 +901,10 @@ public class TestStandardInterceptors {
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
         final ResponseDate interceptor = new ResponseDate();
         interceptor.process(response, context);
-        final Header h1 = response.getFirstHeader(HTTP.DATE_HEADER);
+        final Header h1 = response.getFirstHeader(HttpHeaders.DATE);
         Assert.assertNotNull(h1);
         interceptor.process(response, context);
-        final Header h2 = response.getFirstHeader(HTTP.DATE_HEADER);
+        final Header h2 = response.getFirstHeader(HttpHeaders.DATE);
         Assert.assertNotNull(h2);
     }
 
@@ -913,7 +915,7 @@ public class TestStandardInterceptors {
         response.setStatusCode(199);
         final ResponseDate interceptor = new ResponseDate();
         interceptor.process(response, context);
-        final Header h1 = response.getFirstHeader(HTTP.DATE_HEADER);
+        final Header h1 = response.getFirstHeader(HttpHeaders.DATE);
         Assert.assertNull(h1);
     }
 
@@ -937,10 +939,10 @@ public class TestStandardInterceptors {
 
         final RequestDate interceptor = new RequestDate();
         interceptor.process(request, context);
-        final Header h1 = request.getFirstHeader(HTTP.DATE_HEADER);
+        final Header h1 = request.getFirstHeader(HttpHeaders.DATE);
         Assert.assertNotNull(h1);
         interceptor.process(request, context);
-        final Header h2 = request.getFirstHeader(HTTP.DATE_HEADER);
+        final Header h2 = request.getFirstHeader(HttpHeaders.DATE);
         Assert.assertNotNull(h2);
     }
 
@@ -951,7 +953,7 @@ public class TestStandardInterceptors {
 
         final RequestDate interceptor = new RequestDate();
         interceptor.process(request, context);
-        final Header h1 = request.getFirstHeader(HTTP.DATE_HEADER);
+        final Header h1 = request.getFirstHeader(HttpHeaders.DATE);
         Assert.assertNull(h1);
     }
 
@@ -972,7 +974,7 @@ public class TestStandardInterceptors {
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
         final ResponseServer interceptor = new ResponseServer("some server");
         interceptor.process(response, context);
-        final Header h1 = response.getFirstHeader(HTTP.SERVER_HEADER);
+        final Header h1 = response.getFirstHeader(HttpHeaders.SERVER);
         Assert.assertNotNull(h1);
         Assert.assertEquals("some server", h1.getValue());
     }
@@ -981,10 +983,10 @@ public class TestStandardInterceptors {
     public void testResponseServerNotGenerated() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
-        response.addHeader(new BasicHeader(HTTP.SERVER_HEADER, "whatever"));
+        response.addHeader(new BasicHeader(HttpHeaders.SERVER, "whatever"));
         final ResponseServer interceptor = new ResponseServer("some server");
         interceptor.process(response, context);
-        final Header h1 = response.getFirstHeader(HTTP.SERVER_HEADER);
+        final Header h1 = response.getFirstHeader(HttpHeaders.SERVER);
         Assert.assertNotNull(h1);
         Assert.assertEquals("whatever", h1.getValue());
     }
@@ -995,7 +997,7 @@ public class TestStandardInterceptors {
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
         final ResponseServer interceptor = new ResponseServer();
         interceptor.process(response, context);
-        final Header h1 = response.getFirstHeader(HTTP.SERVER_HEADER);
+        final Header h1 = response.getFirstHeader(HttpHeaders.SERVER);
         Assert.assertNull(h1);
     }
 



Mime
View raw message