|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mmhttp.server.Expediter
public class Expediter
This class fills a role in the restaurant metaphore. In a restaurant, the expediter is a person who stands at the window of the kitchen where she puts in orders, organizes, and adds the final touch on all the orders before they get served. The Expediter in this context takes a socket connection, oversees the parsing of the request, the building of the response, and the sending of data.
Field Summary | |
---|---|
protected long |
requestParsingTimeLimit
|
Constructor Summary | |
---|---|
Expediter(java.net.Socket socket,
Server server)
Constructs an Expediter with a fresh socket connection, and the Server from whence it came. |
Method Summary | |
---|---|
void |
close()
Logs the request and closes the socket. |
Response |
createGoodResponse(Request request)
Creates the correct response object based on the request and authentication settings. |
long |
getRequestParsingTimeLimit()
|
java.net.Socket |
getSocket()
|
void |
log(java.net.Socket s,
Request request,
Response response)
Constructs the LogData and sends it to the Server's Logger for logging. |
static LogData |
makeLogData(java.net.Socket socket,
Request request,
Response response)
Constructs a LogData object representing the loggable data of this request. |
Request |
makeRequest()
Instantiates the request. |
void |
send(byte[] bytes)
Writes the given bytes to the socket output stream. |
void |
sendResponse()
Initiated the delivery of the response. |
void |
setRequestParsingTimeLimit(long millis)
Sets the time, in milliseconds, to wait for the request to be parsed. |
void |
start()
Expedites the request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected long requestParsingTimeLimit
Constructor Detail |
---|
public Expediter(java.net.Socket socket, Server server) throws java.lang.Exception
socket
- server
-
java.lang.Exception
Method Detail |
---|
public void start() throws java.lang.Exception
java.lang.Exception
public void setRequestParsingTimeLimit(long millis)
millis
- public long getRequestParsingTimeLimit()
public void send(byte[] bytes) throws java.lang.Exception
send
in interface ResponseSender
bytes
-
java.lang.Exception
public void close() throws java.lang.Exception
close
in interface ResponseSender
java.lang.Exception
public java.net.Socket getSocket() throws java.lang.Exception
java.lang.Exception
public Request makeRequest() throws java.lang.Exception
java.lang.Exception
public void sendResponse() throws java.lang.Exception
java.lang.Exception
public Response createGoodResponse(Request request) throws java.lang.Exception
request
-
java.lang.Exception
public static LogData makeLogData(java.net.Socket socket, Request request, Response response)
socket
- request
- response
-
public void log(java.net.Socket s, Request request, Response response) throws java.lang.Exception
s
- request
- response
-
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |