Class SdkHttpUtils

java.lang.Object
com.amazonaws.util.SdkHttpUtils

public class SdkHttpUtils extends Object
  • Constructor Details

    • SdkHttpUtils

      public SdkHttpUtils()
  • Method Details

    • 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 encode
      path - 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