|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbase.connection.ConnectionKey
public class ConnectionKey
Manages a connection with a secret access key.
| Field Summary | |
|---|---|
protected java.lang.String |
accessId
Identifies the user's account. |
protected java.lang.String |
accessKey
The account user's secret key/password. |
protected Driver |
driver
References the driver that owns this connection. |
protected java.lang.String |
host
The host server. |
org.apache.http.impl.client.DefaultHttpClient |
httpClient
Client used to make requests to the server. |
protected java.lang.String |
method
HTTP operation (i.e. |
protected java.lang.String |
path
Path to the resource being accessed (e.g. |
protected int |
port
The server's port. |
protected boolean |
secure
Indicates if the connection is secure. |
| Constructor Summary | |
|---|---|
ConnectionKey(java.lang.String accessKey,
boolean secure,
java.lang.String host,
Driver driver)
Constructs this connection with the default port. |
|
ConnectionKey(java.lang.String accessKey,
boolean secure,
java.lang.String host,
int port,
Driver driver)
Constructs this connection. |
|
| Method Summary | |
|---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
addDefaultHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
|
protected java.util.Map<java.lang.String,java.lang.String> |
addDefaultParams(java.util.Map<java.lang.String,java.lang.String> params)
|
void |
connect()
Connects to the host with the already-defined host & port. |
void |
connect(java.lang.String host)
Connects to the given host with the default port. |
void |
connect(java.lang.String host,
int port)
Connects to the given host at the given port. |
protected java.lang.String |
encodeData(java.lang.String data)
|
Response |
request(java.lang.String method,
java.lang.String path,
java.util.Map<java.lang.String,java.lang.String> headers,
java.util.Map<java.lang.String,java.lang.String> params,
java.lang.Object data)
Makes a request to this connection. |
static java.lang.String |
urlEncodeMap(java.util.Map<java.lang.String,java.lang.String> map)
Utility that performs UTF-8 encoding of a map of Strings. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String host
protected int port
protected java.lang.String accessId
protected java.lang.String accessKey
protected boolean secure
protected Driver driver
protected java.lang.String method
protected java.lang.String path
public org.apache.http.impl.client.DefaultHttpClient httpClient
| Constructor Detail |
|---|
public ConnectionKey(java.lang.String accessKey,
boolean secure,
java.lang.String host,
Driver driver)
accessKey - is the user's secret key used for authenticationsecure - indicates if this connection is secure or nothost - is the host to connect todriver - references the driver that owns this connection
public ConnectionKey(java.lang.String accessKey,
boolean secure,
java.lang.String host,
int port,
Driver driver)
accessKey - is the user's secret key used for authenticationsecure - indicates if this connection is securehost - is the host to connect toport - is the host's port to connect todriver - references the driver that owns this connection| Method Detail |
|---|
public void connect()
IConnection
connect in interface IConnectionpublic void connect(java.lang.String host)
IConnection
connect in interface IConnectionhost - is the host to connect to
public void connect(java.lang.String host,
int port)
IConnection
connect in interface IConnectionhost - is the host to connect toport - is the host's port to connect to
public Response request(java.lang.String method,
java.lang.String path,
java.util.Map<java.lang.String,java.lang.String> headers,
java.util.Map<java.lang.String,java.lang.String> params,
java.lang.Object data)
IConnection
request in interface IConnectionmethod - defines the operation to perform (i.e. GET, DELETE, PUT, POST)path - path is the resource path (e.g. /john.doe/images/1)headers - are the headers to include with the requestparams - are the parameters to include with the requestdata - is the body data to include with the request
public static java.lang.String urlEncodeMap(java.util.Map<java.lang.String,java.lang.String> map)
map - is the map of String values to format as a UTF-8 String
protected java.util.Map<java.lang.String,java.lang.String> addDefaultHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
protected java.util.Map<java.lang.String,java.lang.String> addDefaultParams(java.util.Map<java.lang.String,java.lang.String> params)
protected java.lang.String encodeData(java.lang.String data)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||