|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ProtocolHandler
defines the common interface of HTTP request handler. The
HTTPRequestProcessor
uses ProtocolHandler
like plugins. That
way the format of the responses can be changed, without changing the clients
command interface.
Method Summary | |
---|---|
void |
doHelp(PrintWriter out)
prints the help about the service, the supported calls and their parameters. |
void |
err404(PrintWriter out,
String target)
sends an error message to the client |
Map<String,RequestHandler> |
getRequestHandlers()
accessor to the map of RequestHandler . |
HTTPServer<?> |
getServer()
accessor the the HTTP server engine. |
void |
processRequest(Socket clientSocket,
Map<String,String> header,
Map<String,String> request)
the entrypoint for request processing. |
void |
setRequestHandlers(Map<String,RequestHandler> requestHandlerMap)
accessor to set the map of RequestHandler . |
void |
setup(HTTPServer<?> srv)
used for asynchronous setup. |
void |
status(PrintWriter out,
HttpStatusCode status)
|
void |
status(PrintWriter out,
HttpStatusCode status,
String message)
|
Method Detail |
---|
void doHelp(PrintWriter out)
RequestHandler
on invalid/incomplete
calls.
out
- - the printwriter to used to send a message to clientvoid err404(PrintWriter out, String target)
out
- - the PrintWriter
used to write a client responsetarget
- - specify the requested location, that could not be resolvedMap<String,RequestHandler> getRequestHandlers()
RequestHandler
. The request handlers are
plugged in by application context configuration
HTTPServer<?> getServer()
void processRequest(Socket clientSocket, Map<String,String> header, Map<String,String> request) throws Exception
clientSocket
- - the socket for client communicationheader
- - the parameters from HTTP headerrequest
- - the request parameters
Exception
- - if anything goes wrongvoid setRequestHandlers(Map<String,RequestHandler> requestHandlerMap)
RequestHandler
. The request handlers
are plugged in by application context configuration
requestHandlerMap
- - the map of RequestHandler
void setup(HTTPServer<?> srv)
HTTPServer
will start the rest of configuration, before accepting connections from
clients.
srv
- - the HTTPServer instancevoid status(PrintWriter out, HttpStatusCode status)
void status(PrintWriter out, HttpStatusCode status, String message)
|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |