|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--context.arch.comm.protocol.TCPClientSocket
|
+--context.arch.comm.protocol.HTTPClientSocket
This class subclasses TCPClientSocket, creating and sending HTTP requests. It implements the CommunicationsClient interface
TCPClientSocket,
CommunicationsClient| Field Summary | |
static int |
DEFAULT_PORT
Default port to use is 5555 |
static java.lang.String |
GET
HTTP GET request type |
static java.lang.String |
POST
HTTP POST request type |
static java.lang.String |
PROTOCOL
The protocol being used is HTTP |
| Fields inherited from class context.arch.comm.protocol.TCPClientSocket |
DEFAULT_PORT,
DEFAULT_SERVER,
portNumber,
remoteServer |
| Constructor Summary | |
HTTPClientSocket(CommunicationsObject object)
Basic constructor for HTTPClientSocket that calls TCPClientSocket |
|
HTTPClientSocket(CommunicationsObject object,
java.lang.String server,
java.lang.Integer port)
Constructor for HTTPClientSocket that calls TCPClientSocket with the given port |
|
| Method Summary | |
java.lang.String |
addRequestProtocol(java.lang.String data,
java.lang.String url)
This method adds the HTTP protocol for a POST request (POST is the default) |
java.lang.String |
addRequestProtocol(java.lang.String data,
java.lang.String url,
java.lang.String type)
Method that adds the HTTP protocol to a request message |
DataObject |
getErrorMessage()
This method generates an error message if a request can't be handled properly, to the point where a contextual error message can still be sent as the reply. |
java.lang.String |
getFatalMessage()
This method generates an fatal message if a request can't be handled properly, to the point where no contextual error message can be sent as the reply. |
java.lang.String |
getProtocol()
Method to get the communications protocol being used |
java.net.Socket |
sendRequest(java.lang.String content)
This method sends a request to a remote server |
RequestData |
stripReplyProtocol(java.net.Socket data)
Method that strips away the HTTP protocol from a reply message |
| Methods inherited from class context.arch.comm.protocol.TCPClientSocket |
getPort,
getServer,
setPort,
setServer |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final java.lang.String PROTOCOL
public static final java.lang.String GET
public static final java.lang.String POST
public static final int DEFAULT_PORT
| Constructor Detail |
public HTTPClientSocket(CommunicationsObject object)
object - Handle of the generic instantiating communications objectDEFAULT_PORT,
TCPClientSocket
public HTTPClientSocket(CommunicationsObject object,
java.lang.String server,
java.lang.Integer port)
object - Handle of the generic instantiating communications objectserver - Hostname of the remote server to connect toport - Port to use to receive communications onTCPServerSocket| Method Detail |
public java.lang.String addRequestProtocol(java.lang.String data,
java.lang.String url)
throws ProtocolException
content - The request to send
public java.lang.String addRequestProtocol(java.lang.String data,
java.lang.String url,
java.lang.String type)
throws ProtocolException
data - Request message to add HTTP protocol tourl - Tag/URL to add to message
public RequestData stripReplyProtocol(java.net.Socket data)
throws ProtocolException
socket - Socket on which reply is coming frompublic DataObject getErrorMessage()
getFatalMessage()public java.lang.String getFatalMessage()
getErrorMessage()public java.net.Socket sendRequest(java.lang.String content)
content - The request to sendpublic java.lang.String getProtocol()
PROTOCOL
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||