Package com.emc.object.util
Class RestUtil
- java.lang.Object
-
- com.emc.object.util.RestUtil
-
public final class RestUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_CONTENT_TYPE
static java.lang.String
EMC_APPEND_OFFSET
static java.lang.String
EMC_CONTENT_MD5
static java.lang.String
EMC_COPY_MODE
static java.lang.String
EMC_EMPTY_BUCKET
static java.lang.String
EMC_ENCRYPTION_ENABLED
static java.lang.String
EMC_FS_ENABLED
static java.lang.String
EMC_METADATA_SEARCH
static java.lang.String
EMC_MTIME
static java.lang.String
EMC_MULTIPART_COPY
static java.lang.String
EMC_NAMESPACE
static java.lang.String
EMC_PREFIX
static java.lang.String
EMC_RETENTION_PERIOD
static java.lang.String
EMC_RETENTION_POLICY
static java.lang.String
EMC_STALE_READ_ALLOWED
static java.lang.String
EMC_VPOOL
static java.lang.String
HEADER_CACHE_CONTROL
static java.lang.String
HEADER_CONTENT_DISPOSITION
static java.lang.String
HEADER_CONTENT_ENCODING
static java.lang.String
HEADER_CONTENT_LENGTH
static java.lang.String
HEADER_CONTENT_MD5
static java.lang.String
HEADER_CONTENT_TYPE
static java.lang.String
HEADER_DATE
static java.lang.String
HEADER_ETAG
static java.lang.String
HEADER_EXPIRES
static java.lang.String
HEADER_HOST
static java.lang.String
HEADER_IF_MATCH
static java.lang.String
HEADER_IF_MODIFIED_SINCE
static java.lang.String
HEADER_IF_NONE_MATCH
static java.lang.String
HEADER_IF_UNMODIFIED_SINCE
static java.lang.String
HEADER_LAST_MODIFIED
static java.lang.String
HEADER_RANGE
static java.lang.String
HEADER_USER_AGENT
static java.time.format.DateTimeFormatter
iso8601MillisecondFormatter
static java.lang.String
PROPERTY_DECODE_ENTITY
static java.lang.String
PROPERTY_ENCODE_ENTITY
static java.lang.String
PROPERTY_GENERATE_CONTENT_MD5
static java.lang.String
PROPERTY_KEEP_ENCODE_HEADERS
static java.lang.String
PROPERTY_NAMESPACE
static java.lang.String
PROPERTY_USER_METADATA
static java.lang.String
PROPERTY_VERIFY_READ_CHECKSUM
static java.lang.String
PROPERTY_VERIFY_WRITE_CHECKSUM
static int
STATUS_NOT_FOUND
static int
STATUS_REDIRECT
static int
STATUS_UNAUTHORIZED
static java.lang.String
TYPE_APPLICATION_JSON
static java.lang.String
TYPE_APPLICATION_OCTET_STREAM
static java.lang.String
TYPE_APPLICATION_XML
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
add(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> multiValueMap, java.lang.String key, java.lang.Object value)
static java.util.Date
amzHeaderParse(java.lang.String dateString)
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)
Note the rawQuery and rawFragment must already be encoded.static java.lang.String
generateQueryString(java.util.Map<java.lang.String,java.lang.String> parameterMap)
Deprecated.(2.0.4) usegenerateRawQueryString(Map)
insteadstatic java.lang.String
generateRawQueryString(java.util.Map<java.lang.String,java.lang.String> parameterMap)
URL-encodes names and valuesstatic java.lang.String
getEncodedPath(java.net.URI uri)
static <T> java.lang.String
getFirstAsString(java.util.Map<java.lang.String,java.util.List<T>> multiValueMap, java.lang.String key)
static <T> java.lang.String
getFirstAsString(java.util.Map<java.lang.String,java.util.List<T>> multiValueMap, java.lang.String key, boolean stripQuotes)
static java.util.Map<java.lang.String,java.lang.String>
getQueryParameterMap(java.lang.String queryString)
URL-decodes names and valuesstatic java.lang.String
getRequestDate(long clockSkew)
static java.lang.String
headerFormat(java.util.Date date)
static java.util.Date
headerParse(java.lang.String dateString)
static java.lang.String
join(java.lang.String separator, java.lang.Iterable<java.lang.String> items)
static void
putSingle(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> multiValueMap, java.lang.String key, java.lang.Object value)
static java.net.URI
replaceHost(java.net.URI uri, java.lang.String host)
static java.net.URI
replacePath(java.net.URI uri, java.lang.String path)
static java.lang.String
stripQuotes(java.lang.String value)
static java.lang.String
toASCIIString(java.net.URI u)
Returns the content of this URI as a US-ASCII string.static java.lang.String
urlDecode(java.lang.String value)
static java.lang.String
urlDecode(java.lang.String value, boolean preservePlus)
static java.lang.String
urlEncode(java.lang.String value)
-
-
-
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_DATE
public static final java.lang.String HEADER_DATE
- See Also:
- Constant Field Values
-
HEADER_ETAG
public static final java.lang.String HEADER_ETAG
- See Also:
- Constant Field Values
-
HEADER_EXPIRES
public static final java.lang.String HEADER_EXPIRES
- See Also:
- Constant Field Values
-
HEADER_IF_MATCH
public static final java.lang.String HEADER_IF_MATCH
- 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_RANGE
public static final java.lang.String HEADER_RANGE
- See Also:
- Constant Field Values
-
HEADER_USER_AGENT
public static final java.lang.String HEADER_USER_AGENT
- See Also:
- Constant Field Values
-
HEADER_HOST
public static final java.lang.String HEADER_HOST
- See Also:
- Constant Field Values
-
EMC_PREFIX
public static final java.lang.String EMC_PREFIX
- See Also:
- Constant Field Values
-
EMC_APPEND_OFFSET
public static final java.lang.String EMC_APPEND_OFFSET
- See Also:
- Constant Field Values
-
EMC_CONTENT_MD5
public static final java.lang.String EMC_CONTENT_MD5
- See Also:
- Constant Field Values
-
EMC_FS_ENABLED
public static final java.lang.String EMC_FS_ENABLED
- See Also:
- Constant Field Values
-
EMC_MTIME
public static final java.lang.String EMC_MTIME
- See Also:
- Constant Field Values
-
EMC_NAMESPACE
public static final java.lang.String EMC_NAMESPACE
- See Also:
- Constant Field Values
-
EMC_VPOOL
public static final java.lang.String EMC_VPOOL
- 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_COPY_MODE
public static final java.lang.String EMC_COPY_MODE
- 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
-
STATUS_REDIRECT
public static final int STATUS_REDIRECT
- See Also:
- Constant Field Values
-
STATUS_UNAUTHORIZED
public static final int STATUS_UNAUTHORIZED
- See Also:
- Constant Field Values
-
STATUS_NOT_FOUND
public static final int STATUS_NOT_FOUND
- 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) usegenerateRawQueryString(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)
-
-