HTTPCLIENT-930: Added protected #createLocationURI method to the DefaultRedirectStrategy
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@930560 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ba748bf20c
commit
9b7b9c9ce1
|
@ -61,7 +61,7 @@ public class DefaultRedirectStrategy implements RedirectStrategy {
|
|||
|
||||
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 implements RedirectStrategy {
|
|||
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 implements RedirectStrategy {
|
|||
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue