Package com.amazonaws.util
Class SdkHttpUtils
- java.lang.Object
-
- com.amazonaws.util.SdkHttpUtils
-
public class SdkHttpUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description SdkHttpUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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(SignableRequest<?> 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.static String
urlDecode(String value)
Decode a string for use in the path of a URL; uses URLDecoder.decode, which decodes a string for use in the query portion of a URL.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(SignableRequest<?> request)
-
-
-
Method Detail
-
urlEncode
public 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. Can optionally handle strings which are meant to encode a path (ie include '/'es which should NOT be escaped).- Parameters:
value
- the value to encodepath
- true if the value is intended to represent a path- Returns:
- the encoded value
-
urlDecode
public static String urlDecode(String value)
Decode a string for use in the path of a URL; uses URLDecoder.decode, which decodes a string for use in the query portion of a URL.- Parameters:
value
- The value to decode- Returns:
- The decoded value if parameter is not null, otherwise, null is returned.
-
isUsingNonDefaultPort
public 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).- Parameters:
uri
-- Returns:
- True if the specified URI is using a non-standard port, otherwise false.
-
usePayloadForQueryParameters
public static boolean usePayloadForQueryParameters(SignableRequest<?> request)
-
encodeParameters
public static String encodeParameters(SignableRequest<?> request)
Creates an encoded query string from all the parameters in the specified request.- Parameters:
request
- The request containing the parameters to encode.- Returns:
- Null if no parameters were present, otherwise the encoded query string for the parameters present in the specified request.
-
appendUri
public static String appendUri(String baseUri, String path)
Append the given path to the given baseUri. By default, all slash characters in path will not be url-encoded.
-
appendUri
public static String appendUri(String baseUri, String path, boolean escapeDoubleSlash)
Append the given path to the given baseUri.- Parameters:
baseUri
- The URI to append to (required, may be relative)path
- The path to append (may be null or empty). Path should be pre-encoded.escapeDoubleSlash
- Whether double-slash in the path should be escaped to "/%2F"- Returns:
- The baseUri with the path appended
-
-