|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.funambol.util.HttpTransportAgent
public final class HttpTransportAgent
Represents a HTTP client implementation
Nested Class Summary | |
---|---|
protected class |
HttpTransportAgent.ConnectionTimer
This class is used (with a Timer) to monitor a connection and interrupt it if it hangs for more than command timeout. |
Constructor Summary | |
---|---|
HttpTransportAgent(java.lang.String requestURL,
boolean compress,
boolean forceCookies)
Create a new HttpTransportAgent. |
|
HttpTransportAgent(java.lang.String requestURL,
java.lang.String userAgent,
boolean compress,
boolean forceCookies)
Create a new HttpTransportAgent using the default charset. |
|
HttpTransportAgent(java.lang.String requestURL,
java.lang.String userAgent,
java.lang.String charset,
boolean compress,
boolean forceCookies)
Initialize a new HttpTransportAgent with a URL and a charset to use. |
Method Summary | |
---|---|
void |
enableCompression(boolean enable)
Enable the http "gzip" compression parameter usage |
java.lang.String |
getRequestContentType()
|
java.lang.String |
getResponseDate()
Get the last response date |
byte[] |
sendMessage(byte[] request)
Send the http request and read the response. |
java.lang.String |
sendMessage(java.lang.String request)
Send a message using the default (UTF-8) charset. |
java.lang.String |
sendMessage(java.lang.String request,
java.lang.String charset)
Send the http request specifying the required encoding charset for the http headers. |
void |
setAuthentication(HttpAuthentication newAuth)
Set the authentication object to use to authenticate requests made with this transport agent. |
void |
setRequestContentType(java.lang.String type)
Set the content type used for http requests |
void |
setRequestURL(java.lang.String requestURL)
Set the request's url |
void |
setResendMessageOnErrors(boolean resendMessageOnErrors)
Set if the messages should be resent in case of errors |
void |
setRetryOnWrite(int retryOnWrite)
Set the number of http writing attempts |
void |
setThreshold(int threshold)
Set the http "Size-Threshold" header parameter |
void |
setTimeoutConnection(long timeout)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpTransportAgent(java.lang.String requestURL, boolean compress, boolean forceCookies)
requestURL
- is the url where to send the request; must not be nullcompress
- if true the http compression is enabled, disabled
otherwiseforceCookies
- public HttpTransportAgent(java.lang.String requestURL, java.lang.String userAgent, boolean compress, boolean forceCookies)
requestURL
- is the url where to send the request; must not be nulluserAgent
- the user agent parameter to be filled into the http
headerscompress
- if true the http compression is enabled, disabled
otherwiseforceCookies
- if true sets http headers to force the use of cookies
instead of Url Rewriting to manage the current http session.public HttpTransportAgent(java.lang.String requestURL, java.lang.String userAgent, java.lang.String charset, boolean compress, boolean forceCookies)
requestURL
- must be non-nulluserAgent
- a string to be used as userAgent.charset
- a valid charset, the device charset is used by default.Method Detail |
---|
public java.lang.String sendMessage(java.lang.String request) throws CodedException
sendMessage
in interface TransportAgent
requestURL
- must be non-null
CodedException
- when the connection cannot be established with the
server because the implementation tries to access a not existent url
or when there are network coverage problemspublic java.lang.String sendMessage(java.lang.String request, java.lang.String charset) throws CodedException
sendMessage
in interface TransportAgent
request
- the http request bodycharset
- the charset to be included into the http headers
CodedException
- when the connection cannot be established with the
server because the implementation tries to access a not existent url
or when there are network coverage problemspublic byte[] sendMessage(byte[] request) throws CodedException
request
- the http request body
CodedException
- when the connection cannot be established with the
server because the implementation tries to access a not existent url
or when there are network coverage problemspublic void enableCompression(boolean enable)
enable
- enables "gzip" http header parameter to be written if truepublic void setThreshold(int threshold)
threshold
- is the "Size-Threshold" value to be added to http
headerspublic void setRequestURL(java.lang.String requestURL)
setRequestURL
in interface TransportAgent
requestURL
- the request's destination urlpublic java.lang.String getResponseDate()
getResponseDate
in interface TransportAgent
public void setRequestContentType(java.lang.String type)
type
- public java.lang.String getRequestContentType()
public void setRetryOnWrite(int retryOnWrite)
setRetryOnWrite
in interface TransportAgent
retryOnWrite
- the number of attempts to write http requestspublic void setResendMessageOnErrors(boolean resendMessageOnErrors)
public void setTimeoutConnection(long timeout)
public void setAuthentication(HttpAuthentication newAuth)
HttpAuthentication
- The authentication that contains the username, password, and uri
to authenticate with.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |