|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--context.arch.comm.protocol.TCPServerSocket
|
+--context.arch.comm.protocol.HTTPServerSocket
This class subclasses TCPServerSocket, listening for and handling HTTP requests. It implements the CommunicationsServer interface
TCPServerSocket,
CommunicationsServer| Field Summary | |
static int |
DEFAULT_PORT
Default port for HTTP communications is 80 |
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.TCPServerSocket |
DEFAULT_PORT |
| Constructor Summary | |
HTTPServerSocket(CommunicationsObject object)
Basic constructor for HTTPServerSocket that calls TCPServerSocket |
|
HTTPServerSocket(CommunicationsObject object,
java.lang.Integer port)
Constructor for HTTPServerSocket that calls TCPServerSocket with the given port |
|
| Method Summary | |
java.lang.String |
addReplyProtocol(java.lang.String data)
Method that takes a reply message and adds the necessary HTTP protocol |
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 |
void |
handleIncomingRequest(java.net.Socket dataSocket)
Stub method that handles incoming HTTP requests. |
void |
quit()
This method stops the server from receiving more data |
RequestData |
stripRequestProtocol(java.net.Socket data)
Method that strips the HTTP protocol from a request message. |
| Methods inherited from class context.arch.comm.protocol.TCPServerSocket |
run,
start,
stopServer |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final int DEFAULT_PORT
public static final java.lang.String PROTOCOL
public static final java.lang.String GET
public static final java.lang.String POST
| Constructor Detail |
public HTTPServerSocket(CommunicationsObject object)
object - Handle of the generic instantiating communications objectDEFAULT_PORT,
TCPServerSocket
public HTTPServerSocket(CommunicationsObject object,
java.lang.Integer port)
object - Handle of the generic instantiating communications objectport - Port to use to receive communications onTCPServerSocket| Method Detail |
public void handleIncomingRequest(java.net.Socket dataSocket)
dataSocket - Socket to receive HTTP data fromCommunicationsObject.handleIncomingRequest(java.net.Socket)
public java.lang.String addReplyProtocol(java.lang.String data)
throws ProtocolException
data - Reply to a received request
public RequestData stripRequestProtocol(java.net.Socket data)
throws ProtocolException
data - Socket the request is coming frompublic DataObject getErrorMessage()
getFatalMessage()public java.lang.String getFatalMessage()
getErrorMessage()public void quit()
TCPServerSocket.stopServer()public java.lang.String getProtocol()
PROTOCOL
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||