|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--superwaba.ext.xplat.webservice.StandardHttpClient
Provides client-side HTTP communication
| Field Summary | |
protected java.lang.String |
auth
|
protected java.lang.String |
host
|
protected java.lang.String |
hostname
|
Hashtable |
htHeader
The header contents, with both key and value lowercased. |
boolean |
keepAlive
Sets the keep-alive flag. |
protected int |
port
|
protected static java.lang.StringBuffer |
sb
|
protected Socket |
socket
|
protected java.lang.String |
uri
|
| Constructor Summary | |
StandardHttpClient(java.lang.String hostname,
int port,
java.lang.String uri)
|
|
| Method Summary | |
protected void |
checkResponse()
Checks if the response of the server has status 200 |
protected void |
closeConnection()
Terminates the server connection |
java.lang.String |
execute(byte[] requestBody)
Executes a HTTP request to the connected server |
protected void |
parseHeader()
Places all the returning values frm the header in a hashtable for easy access. |
java.lang.String |
readLine()
Reads a line from the socket, retrying up to four times, with a 250ms delay between the tries. |
protected java.lang.String |
readResponse()
Reads all the lines and place them in a single contiguous String. |
void |
setBasicAuthentication(java.lang.String user,
java.lang.String password)
Base64 encodes the username and password given for basic server authentication |
protected void |
writeRequest(byte[] requestBody,
int len)
Writes the header followed by the given request body |
protected java.lang.StringBuffer |
writeRequestHeader(int requestLength)
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected int port
protected java.lang.String uri
protected java.lang.String host
protected java.lang.String auth
protected Socket socket
protected java.lang.String hostname
public Hashtable htHeader
public boolean keepAlive
protected static java.lang.StringBuffer sb
| Constructor Detail |
public StandardHttpClient(java.lang.String hostname,
int port,
java.lang.String uri)
throws XmlRpcException
hostname - The server address to connect toport - The port on the server we want to connect touri - The connecting URI. Defaults to "/RPC2"| Method Detail |
public void setBasicAuthentication(java.lang.String user,
java.lang.String password)
user - The username for the server. Passing null disables authentication.password - The password for the username account on the server. Passing null disables authentication.
protected void writeRequest(byte[] requestBody,
int len)
public java.lang.String readLine()
protected void checkResponse()
throws XmlRpcException
protected void parseHeader()
protected java.lang.String readResponse()
throws XmlRpcException
public java.lang.String execute(byte[] requestBody)
throws XmlRpcException
requestBody - The contents of the HTTP request. Headers are added
appropriately by this methodprotected void closeConnection()
protected java.lang.StringBuffer writeRequestHeader(int requestLength)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||