public class HttpUtils extends Object
构造器和说明 |
---|
HttpUtils() |
限定符和类型 | 方法和说明 |
---|---|
static String |
appendUri(String baseUri,
String path)
Append the given path to the given baseUri.
|
static String |
appendUri(String baseUri,
String path,
boolean escapeDoubleSlash)
Append the given path to the given baseUri.
|
static String |
encodeParameters(Request<?> request)
Creates an encoded query string from all the parameters in the specified
request.
|
static boolean |
isUsingNonDefaultPort(URI uri)
Returns true if the specified URI is using a non-standard port (i.e. any
port other than 80 for HTTP URIs or any port other than 443 for HTTPS
URIs).
|
static String |
stringToAscii(String value) |
static String |
urlEncode(String value,
boolean path)
Encode a string for use in the path of a URL; uses URLEncoder.encode,
(which encodes a string for use in the query portion of a URL), then
applies some postfilters to fix things up per the RFC.
|
static boolean |
usePayloadForQueryParameters(Request<?> request) |
public static String urlEncode(String value, boolean path)
value
- the value to encodepath
- true if the value is intended to represent a pathpublic static boolean isUsingNonDefaultPort(URI uri)
uri
- public static boolean usePayloadForQueryParameters(Request<?> request)
public static String encodeParameters(Request<?> request)
request
- The request containing the parameters to encode.public static String appendUri(String baseUri, String path)
public static String appendUri(String baseUri, String path, boolean escapeDoubleSlash)
This method will encode the given path but not the given baseUri.
baseUri
- The URI to append to (required, may be relative)path
- The path to append (may be null or empty)escapeDoubleSlash
- Whether double-slash in the path should be escaped to "/%2F"Copyright © 2016. All rights reserved.