|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jets3t.service.utils.RestUtils
public class RestUtils
Utilities useful for REST/HTTP S3Service implementations.
Field Summary | |
---|---|
static List |
HTTP_HEADER_METADATA_NAMES
A list of HTTP-specific header names, that may be present in S3Objects as metadata but which should be treated as plain HTTP headers during transmission (ie not converted into S3 Object metadata items). |
Constructor Summary | |
---|---|
RestUtils()
|
Method Summary | |
---|---|
static Map |
convertHeadersToMap(org.apache.commons.httpclient.Header[] headers)
|
static String |
encodeUrlPath(String path,
String delimiter)
Encodes a URL string but leaves a delimiter string unencoded. |
static String |
encodeUrlString(String path)
Encodes a URL string, and ensures that spaces are encoded as "%20" instead of "+" to keep fussy web browsers happier. |
static long |
getAWSTimeAdjustment()
Calculates a time offset value to reflect the time difference between your computer's clock and the current time according to an AWS server, and returns the calculated time difference. |
static HttpClientAndConnectionManager |
initHttpConnection(AWSRequestAuthorizer awsRequestAuthorizer,
org.apache.commons.httpclient.HostConfiguration hostConfig,
Jets3tProperties jets3tProperties,
String userAgentDescription,
org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider)
Initialises, or re-initialises, the underlying HttpConnectionManager and HttpClient objects a service will use to communicate with an AWS service. |
static void |
initHttpProxy(org.apache.commons.httpclient.HttpClient httpClient,
Jets3tProperties jets3tProperties)
Initialises this service's HTTP proxy by auto-detecting the proxy settings. |
static void |
initHttpProxy(org.apache.commons.httpclient.HttpClient httpClient,
Jets3tProperties jets3tProperties,
String proxyHostAddress,
int proxyPort,
String proxyUser,
String proxyPassword,
String proxyDomain)
Initialises this service's HTTP proxy for authentication using the given proxy settings. |
static void |
initHttpProxy(org.apache.commons.httpclient.HttpClient httpClient,
String proxyHostAddress,
int proxyPort,
Jets3tProperties jets3tProperties)
Initialises this service's HTTP proxy with the given proxy settings. |
static String |
makeS3CanonicalString(String method,
String resource,
Map headersMap,
String expires)
Calculate the canonical string for a REST/HTTP request to S3. |
static Map |
renameMetadataKeys(Map metadata)
Renames metadata property names to be suitable for use as HTTP Headers. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final List HTTP_HEADER_METADATA_NAMES
This list includes the items:
Unchanged metadata names |
---|
content-type |
content-md5 |
content-length |
content-language |
expires |
cache-control |
content-disposition |
content-encoding |
Constructor Detail |
---|
public RestUtils()
Method Detail |
---|
public static String encodeUrlString(String path) throws S3ServiceException
path
-
S3ServiceException
public static String encodeUrlPath(String path, String delimiter) throws S3ServiceException
path
- delimiter
-
S3ServiceException
public static String makeS3CanonicalString(String method, String resource, Map headersMap, String expires)
public static Map renameMetadataKeys(Map metadata)
x-amz-meta-
and leaving the
HTTP header names unchanged. The HTTP header names left unchanged are those found in
HTTP_HEADER_METADATA_NAMES
metadata
-
public static HttpClientAndConnectionManager initHttpConnection(AWSRequestAuthorizer awsRequestAuthorizer, org.apache.commons.httpclient.HostConfiguration hostConfig, Jets3tProperties jets3tProperties, String userAgentDescription, org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider)
Jets3tProperties
object,
these settings will also be passed on to the underlying objects.
hostConfig
- Custom HTTP host configuration; e.g to register a custom Protocol Socket Factory.
This parameter may be null, in which case a default host configuration will be
used.public static void initHttpProxy(org.apache.commons.httpclient.HttpClient httpClient, Jets3tProperties jets3tProperties)
public static void initHttpProxy(org.apache.commons.httpclient.HttpClient httpClient, String proxyHostAddress, int proxyPort, Jets3tProperties jets3tProperties)
proxyHostAddress
- proxyPort
- public static void initHttpProxy(org.apache.commons.httpclient.HttpClient httpClient, Jets3tProperties jets3tProperties, String proxyHostAddress, int proxyPort, String proxyUser, String proxyPassword, String proxyDomain)
proxyHostAddress
- proxyPort
- proxyUser
- proxyPassword
- proxyDomain
- if a proxy domain is provided, an NTCredentials
credential provider
will be used. If the proxy domain is null, a
UsernamePasswordCredentials
credentials provider will be used.public static long getAWSTimeAdjustment() throws Exception
Exception
public static Map convertHeadersToMap(org.apache.commons.httpclient.Header[] headers)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |