HTTPCLIENT-746: Refactored URLUtils into URLEncodedUtils and URIUtils
Contributed by Stojce Dimski <sdmiski at yahoo.it> Reviewed by Oleg Kalnichevski git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@645072 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e1ac27569a
commit
e8923010c7
|
@ -34,7 +34,7 @@ import java.net.URISyntaxException;
|
|||
|
||||
import org.apache.http.HttpHost;
|
||||
|
||||
public class URLUtils {
|
||||
public class URIUtils {
|
||||
|
||||
public static URI createURI(
|
||||
final String scheme,
|
||||
|
@ -81,7 +81,7 @@ public class URLUtils {
|
|||
throw new IllegalArgumentException("URI may nor be null");
|
||||
}
|
||||
if (target != null) {
|
||||
return URLUtils.createURI(
|
||||
return URIUtils.createURI(
|
||||
target.getSchemeName(),
|
||||
target.getHostName(),
|
||||
target.getPort(),
|
||||
|
@ -89,7 +89,7 @@ public class URLUtils {
|
|||
uri.getRawQuery(),
|
||||
dropFragment ? null : uri.getRawFragment());
|
||||
} else {
|
||||
return URLUtils.createURI(
|
||||
return URIUtils.createURI(
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
|
@ -114,7 +114,7 @@ public class URLUtils {
|
|||
* @return the resulting URI
|
||||
*/
|
||||
public static URI resolve(final URI baseURI, final String reference) {
|
||||
return URLUtils.resolve(baseURI, URI.create(reference));
|
||||
return URIUtils.resolve(baseURI, URI.create(reference));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,7 +148,7 @@ public class URLUtils {
|
|||
/**
|
||||
* This class should not be instantiated.
|
||||
*/
|
||||
private URLUtils() {
|
||||
private URIUtils() {
|
||||
}
|
||||
|
||||
}
|
|
@ -67,7 +67,7 @@ import org.apache.http.client.methods.HttpGet;
|
|||
import org.apache.http.client.params.ClientPNames;
|
||||
import org.apache.http.client.params.HttpClientParams;
|
||||
import org.apache.http.client.protocol.ClientContext;
|
||||
import org.apache.http.client.utils.URLUtils;
|
||||
import org.apache.http.client.utils.URIUtils;
|
||||
import org.apache.http.conn.BasicManagedEntity;
|
||||
import org.apache.http.conn.ClientConnectionManager;
|
||||
import org.apache.http.conn.ClientConnectionRequest;
|
||||
|
@ -241,13 +241,13 @@ public class DefaultClientRequestDirector
|
|||
// Make sure the request URI is absolute
|
||||
if (!uri.isAbsolute()) {
|
||||
HttpHost target = route.getTargetHost();
|
||||
uri = URLUtils.rewriteURI(uri, target);
|
||||
uri = URIUtils.rewriteURI(uri, target);
|
||||
request.setURI(uri);
|
||||
}
|
||||
} else {
|
||||
// Make sure the request URI is relative
|
||||
if (uri.isAbsolute()) {
|
||||
uri = URLUtils.rewriteURI(uri, null);
|
||||
uri = URIUtils.rewriteURI(uri, null);
|
||||
request.setURI(uri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ import org.apache.http.ProtocolException;
|
|||
import org.apache.http.client.CircularRedirectException;
|
||||
import org.apache.http.client.RedirectHandler;
|
||||
import org.apache.http.client.params.ClientPNames;
|
||||
import org.apache.http.client.utils.URLUtils;
|
||||
import org.apache.http.client.utils.URIUtils;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.ExecutionContext;
|
||||
|
@ -137,8 +137,8 @@ public class DefaultRedirectHandler implements RedirectHandler {
|
|||
|
||||
try {
|
||||
URI requestURI = new URI(request.getRequestLine().getUri());
|
||||
URI absoluteRequestURI = URLUtils.rewriteURI(requestURI, target, true);
|
||||
uri = URLUtils.resolve(absoluteRequestURI, uri);
|
||||
URI absoluteRequestURI = URIUtils.rewriteURI(requestURI, target, true);
|
||||
uri = URIUtils.resolve(absoluteRequestURI, uri);
|
||||
} catch (URISyntaxException ex) {
|
||||
throw new ProtocolException(ex.getMessage(), ex);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public class DefaultRedirectHandler implements RedirectHandler {
|
|||
uri.getHost(),
|
||||
uri.getPort(),
|
||||
uri.getScheme());
|
||||
redirectURI = URLUtils.rewriteURI(uri, target, true);
|
||||
redirectURI = URIUtils.rewriteURI(uri, target, true);
|
||||
} catch (URISyntaxException ex) {
|
||||
throw new ProtocolException(ex.getMessage(), ex);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue