You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2010/04/03 20:36:31 UTC
svn commit: r930560 -
/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java
Author: olegk
Date: Sat Apr 3 18:36:31 2010
New Revision: 930560
URL: http://svn.apache.org/viewvc?rev=930560&view=rev
Log:
HTTPCLIENT-930: Added protected #createLocationURI method to the DefaultRedirectStrategy
Modified:
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java?rev=930560&r1=930559&r2=930560&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java Sat Apr 3 18:36:31 2010
@@ -61,7 +61,7 @@ public class DefaultRedirectStrategy imp
private final Log log = LogFactory.getLog(getClass());
- private static final String REDIRECT_LOCATIONS = "http.protocol.redirect-locations";
+ public static final String REDIRECT_LOCATIONS = "http.protocol.redirect-locations";
public DefaultRedirectStrategy() {
super();
@@ -110,12 +110,7 @@ public class DefaultRedirectStrategy imp
this.log.debug("Redirect requested to location '" + location + "'");
}
- URI uri;
- try {
- uri = new URI(location);
- } catch (URISyntaxException ex) {
- throw new ProtocolException("Invalid redirect URI: " + location, ex);
- }
+ URI uri = createLocationURI(location);
HttpParams params = response.getParams();
// rfc2616 demands the location value be a complete URI
@@ -176,6 +171,17 @@ public class DefaultRedirectStrategy imp
return uri;
}
+
+ /**
+ * @since 4.1
+ */
+ protected URI createLocationURI(final String location) throws ProtocolException {
+ try {
+ return new URI(location);
+ } catch (URISyntaxException ex) {
+ throw new ProtocolException("Invalid redirect URI: " + location, ex);
+ }
+ }
public HttpUriRequest getRedirect(
final HttpRequest request,