hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1483848 - in /httpcomponents/httpclient/trunk: ./ httpclient/src/main/java/org/apache/http/client/protocol/ httpclient/src/main/java/org/apache/http/impl/execchain/ httpclient/src/test/java/org/apache/http/impl/client/integration/
Date Fri, 17 May 2013 15:13:55 GMT
Author: olegk
Date: Fri May 17 15:13:55 2013
New Revision: 1483848

URL: http://svn.apache.org/r1483848
Log:
HTTPCLIENT-1351: Preserve last request URI in the execution context)
Contributed by James Leigh <james at 3roundstones.com>

Modified:
    httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientRequestExecution.java

Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=1483848&r1=1483847&r2=1483848&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Fri May 17 15:13:55 2013
@@ -1,8 +1,8 @@
 Changes since release 4.3 BETA1
 -------------------
 
-* [HTTPCLIENT-1351] Preserve last request URI fragment in the execution context. 
-  Contributed by Oleg Kalnichevski <olegk at apache.org>
+* [HTTPCLIENT-1351] Preserve last request URI in the execution context. 
+  Contributed by James Leigh <james at 3roundstones.com> 
 
 * [HTTPCLIENT-1344] Userinfo credentials in URI should not default to preemptive BASIC 
   authentication. 

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java?rev=1483848&r1=1483847&r2=1483848&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java
Fri May 17 15:13:55 2013
@@ -27,6 +27,8 @@
 
 package org.apache.http.client.protocol;
 
+import java.net.URI;
+
 import org.apache.http.annotation.NotThreadSafe;
 import org.apache.http.auth.AuthSchemeProvider;
 import org.apache.http.auth.AuthState;
@@ -55,10 +57,10 @@ import org.apache.http.protocol.HttpCore
 public class HttpClientContext extends HttpCoreContext {
 
     /**
-     * Attribute name of a {@link String} object that represents
-     * request URI fragment of the actual request.
+     * Attribute name of a {@link URI} object that represents
+     * request URI location (relative or absolute) of the last request target.
      */
-    public static final String URI_FRAGMENT   = "http.uri-fragment";
+    public static final String HTTP_LOCATION   = "http.location";
 
     /**
      * Attribute name of a {@link org.apache.http.conn.routing.RouteInfo}
@@ -158,8 +160,8 @@ public class HttpClientContext extends H
         super();
     }
 
-    public String getUriFragemnt() {
-        return getAttribute(URI_FRAGMENT, String.class);
+    public URI getHttpLocation() {
+        return getAttribute(HTTP_LOCATION, URI.class);
     }
 
     public RouteInfo getHttpRoute() {

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java?rev=1483848&r1=1483847&r2=1483848&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
Fri May 17 15:13:55 2013
@@ -79,10 +79,7 @@ public class ProtocolExec implements Cli
         try {
             URI uri = request.getURI();
             if (uri != null) {
-                final String fragment = uri.getFragment();
-                if (fragment != null) {
-                    context.setAttribute(HttpClientContext.URI_FRAGMENT, fragment);
-                }
+                context.setAttribute(HttpClientContext.HTTP_LOCATION, uri);
                 if (route.getProxyHost() != null && !route.isTunnelled()) {
                     // Make sure the request URI is absolute
                     if (!uri.isAbsolute()) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientRequestExecution.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientRequestExecution.java?rev=1483848&r1=1483847&r2=1483848&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientRequestExecution.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientRequestExecution.java
Fri May 17 15:13:55 2013
@@ -258,6 +258,9 @@ public class TestClientRequestExecution 
 
         final HttpRequest request = (HttpRequest) context.getAttribute(HttpCoreContext.HTTP_REQUEST);
         Assert.assertEquals("/stuff", request.getRequestLine().getUri());
+
+        final URI location = (URI) context.getAttribute(HttpClientContext.HTTP_LOCATION);
+        Assert.assertEquals(uri, location);
     }
 
 }



Mime
View raw message