public class HttpUtils extends Object
| Constructor and Description |
|---|
HttpUtils() |
| Modifier and Type | Method and Description |
|---|---|
static URI |
appendUri(URI baseUri,
String... pathComponents)
Append the given path to the given baseUri.
|
static String |
generateHostHeader(URI uri)
Returns a host header according to the specified URI.
|
static String |
getCanonicalQueryString(Map<String,String> parameters,
boolean forSignature) |
static boolean |
isUsingNonDefaultPort(URI uri)
Returns true if the specified URI is using a non-standard port (i.e.
|
static String |
normalize(String value)
Normalize a string for use in BCE web service APIs.
|
static String |
normalizePath(String path)
Normalize a string for use in url path.
|
static void |
printRequest(org.apache.http.client.methods.HttpRequestBase request) |
static void |
printResponse(org.apache.http.client.methods.CloseableHttpResponse response) |
public static String normalizePath(String path)
Bos object key can contain arbitrary characters, which may result double slash in the url path. Apache http client will replace "//" in the path with a single '/', which makes the object key incorrect. Thus we replace "//" with "/%2F" here.
path - the path string to normalize.normalize(String)public static String normalize(String value)
All letters used in the percent-encoding are in uppercase.
value - the string to normalize.public static String generateHostHeader(URI uri)
uri - the URIpublic static boolean isUsingNonDefaultPort(URI uri)
uri - the URIpublic static String getCanonicalQueryString(Map<String,String> parameters, boolean forSignature)
public static URI appendUri(URI baseUri, String... pathComponents)
This method will encode the given path but not the given baseUri.
baseUri - pathComponents - public static void printRequest(org.apache.http.client.methods.HttpRequestBase request)
public static void printResponse(org.apache.http.client.methods.CloseableHttpResponse response)
Copyright © 2020. All rights reserved.