Class RestUtil


  • public final class RestUtil
    extends java.lang.Object
    • Field Detail

      • HEADER_CACHE_CONTROL

        public static final java.lang.String HEADER_CACHE_CONTROL
        See Also:
        Constant Field Values
      • HEADER_CONTENT_DISPOSITION

        public static final java.lang.String HEADER_CONTENT_DISPOSITION
        See Also:
        Constant Field Values
      • HEADER_CONTENT_ENCODING

        public static final java.lang.String HEADER_CONTENT_ENCODING
        See Also:
        Constant Field Values
      • HEADER_CONTENT_LENGTH

        public static final java.lang.String HEADER_CONTENT_LENGTH
        See Also:
        Constant Field Values
      • HEADER_CONTENT_MD5

        public static final java.lang.String HEADER_CONTENT_MD5
        See Also:
        Constant Field Values
      • HEADER_CONTENT_TYPE

        public static final java.lang.String HEADER_CONTENT_TYPE
        See Also:
        Constant Field Values
      • HEADER_IF_MODIFIED_SINCE

        public static final java.lang.String HEADER_IF_MODIFIED_SINCE
        See Also:
        Constant Field Values
      • HEADER_IF_NONE_MATCH

        public static final java.lang.String HEADER_IF_NONE_MATCH
        See Also:
        Constant Field Values
      • HEADER_IF_UNMODIFIED_SINCE

        public static final java.lang.String HEADER_IF_UNMODIFIED_SINCE
        See Also:
        Constant Field Values
      • HEADER_LAST_MODIFIED

        public static final java.lang.String HEADER_LAST_MODIFIED
        See Also:
        Constant Field Values
      • HEADER_USER_AGENT

        public static final java.lang.String HEADER_USER_AGENT
        See Also:
        Constant Field Values
      • EMC_APPEND_OFFSET

        public static final java.lang.String EMC_APPEND_OFFSET
        See Also:
        Constant Field Values
      • EMC_STALE_READ_ALLOWED

        public static final java.lang.String EMC_STALE_READ_ALLOWED
        See Also:
        Constant Field Values
      • EMC_ENCRYPTION_ENABLED

        public static final java.lang.String EMC_ENCRYPTION_ENABLED
        See Also:
        Constant Field Values
      • EMC_RETENTION_PERIOD

        public static final java.lang.String EMC_RETENTION_PERIOD
        See Also:
        Constant Field Values
      • EMC_RETENTION_POLICY

        public static final java.lang.String EMC_RETENTION_POLICY
        See Also:
        Constant Field Values
      • EMC_METADATA_SEARCH

        public static final java.lang.String EMC_METADATA_SEARCH
        See Also:
        Constant Field Values
      • EMC_MULTIPART_COPY

        public static final java.lang.String EMC_MULTIPART_COPY
        See Also:
        Constant Field Values
      • EMC_EMPTY_BUCKET

        public static final java.lang.String EMC_EMPTY_BUCKET
        See Also:
        Constant Field Values
      • TYPE_APPLICATION_OCTET_STREAM

        public static final java.lang.String TYPE_APPLICATION_OCTET_STREAM
        See Also:
        Constant Field Values
      • TYPE_APPLICATION_XML

        public static final java.lang.String TYPE_APPLICATION_XML
        See Also:
        Constant Field Values
      • TYPE_APPLICATION_JSON

        public static final java.lang.String TYPE_APPLICATION_JSON
        See Also:
        Constant Field Values
      • PROPERTY_NAMESPACE

        public static final java.lang.String PROPERTY_NAMESPACE
        See Also:
        Constant Field Values
      • PROPERTY_USER_METADATA

        public static final java.lang.String PROPERTY_USER_METADATA
        See Also:
        Constant Field Values
      • PROPERTY_ENCODE_ENTITY

        public static final java.lang.String PROPERTY_ENCODE_ENTITY
        See Also:
        Constant Field Values
      • PROPERTY_DECODE_ENTITY

        public static final java.lang.String PROPERTY_DECODE_ENTITY
        See Also:
        Constant Field Values
      • PROPERTY_KEEP_ENCODE_HEADERS

        public static final java.lang.String PROPERTY_KEEP_ENCODE_HEADERS
        See Also:
        Constant Field Values
      • PROPERTY_VERIFY_READ_CHECKSUM

        public static final java.lang.String PROPERTY_VERIFY_READ_CHECKSUM
        See Also:
        Constant Field Values
      • PROPERTY_VERIFY_WRITE_CHECKSUM

        public static final java.lang.String PROPERTY_VERIFY_WRITE_CHECKSUM
        See Also:
        Constant Field Values
      • PROPERTY_GENERATE_CONTENT_MD5

        public static final java.lang.String PROPERTY_GENERATE_CONTENT_MD5
        See Also:
        Constant Field Values
      • DEFAULT_CONTENT_TYPE

        public static final java.lang.String DEFAULT_CONTENT_TYPE
        See Also:
        Constant Field Values
      • iso8601MillisecondFormatter

        public static final java.time.format.DateTimeFormatter iso8601MillisecondFormatter
    • Method Detail

      • getFirstAsString

        public static <T> java.lang.String getFirstAsString​(java.util.Map<java.lang.String,​java.util.List<T>> multiValueMap,
                                                            java.lang.String key)
      • getFirstAsString

        public static <T> java.lang.String getFirstAsString​(java.util.Map<java.lang.String,​java.util.List<T>> multiValueMap,
                                                            java.lang.String key,
                                                            boolean stripQuotes)
      • stripQuotes

        public static java.lang.String stripQuotes​(java.lang.String value)
      • putSingle

        public static void putSingle​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> multiValueMap,
                                     java.lang.String key,
                                     java.lang.Object value)
      • add

        public static void add​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> multiValueMap,
                               java.lang.String key,
                               java.lang.Object value)
      • getQueryParameterMap

        public static java.util.Map<java.lang.String,​java.lang.String> getQueryParameterMap​(java.lang.String queryString)
        URL-decodes names and values
      • generateQueryString

        public static java.lang.String generateQueryString​(java.util.Map<java.lang.String,​java.lang.String> parameterMap)
        Deprecated.
        (2.0.4) use generateRawQueryString(Map) instead
      • generateRawQueryString

        public static java.lang.String generateRawQueryString​(java.util.Map<java.lang.String,​java.lang.String> parameterMap)
        URL-encodes names and values
      • getRequestDate

        public static java.lang.String getRequestDate​(long clockSkew)
      • headerFormat

        public static java.lang.String headerFormat​(java.util.Date date)
      • headerParse

        public static java.util.Date headerParse​(java.lang.String dateString)
      • amzHeaderParse

        public static java.util.Date amzHeaderParse​(java.lang.String dateString)
      • getEncodedPath

        public static java.lang.String getEncodedPath​(java.net.URI uri)
      • urlEncode

        public static java.lang.String urlEncode​(java.lang.String value)
      • urlDecode

        public static java.lang.String urlDecode​(java.lang.String value)
      • urlDecode

        public static java.lang.String urlDecode​(java.lang.String value,
                                                 boolean preservePlus)
      • buildUri

        public static java.net.URI buildUri​(java.lang.String scheme,
                                            java.lang.String host,
                                            int port,
                                            java.lang.String path,
                                            java.lang.String rawQuery,
                                            java.lang.String rawFragment)
                                     throws java.net.URISyntaxException
        Note the rawQuery and rawFragment must already be encoded. No URL-encoding will be done for parameters here. This is the only way ampersands (&) can be encoded into a parameter value.
        Throws:
        java.net.URISyntaxException
      • toASCIIString

        public static java.lang.String toASCIIString​(java.net.URI u)
        Returns the content of this URI as a US-ASCII string.

        Note: this starts our customized version of URI's toASCIIString. We differ in only one aspect: we do NOT normalize Unicode characters. This is because certain Unicode characters may have different compositions and normalization may change the UTF-8 sequence represented by a character. We must maintain the same UTF-8 sequence in and out and therefore we cannot normalize the sequences.

        If this URI does not contain any characters in the other category then an invocation of this method will return the same value as an invocation of the toString method. Otherwise this method works as if by invoking that method and then encoding the result.

        Returns:
        The string form of this URI, encoded as needed so that it only contains characters in the US-ASCII charset
      • replaceHost

        public static java.net.URI replaceHost​(java.net.URI uri,
                                               java.lang.String host)
                                        throws java.net.URISyntaxException
        Throws:
        java.net.URISyntaxException
      • replacePath

        public static java.net.URI replacePath​(java.net.URI uri,
                                               java.lang.String path)
                                        throws java.net.URISyntaxException
        Throws:
        java.net.URISyntaxException
      • join

        public static java.lang.String join​(java.lang.String separator,
                                            java.lang.Iterable<java.lang.String> items)