|
SRJRCFrames v0.1.296 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.schwarzrot.net.http.service.AbstractProtocolHandler
public abstract class AbstractProtocolHandler
base class for protocol handler, where protocol is the response format of HTTP requests. Main purpose is a general handling of error- and help-messages.
| Field Summary | |
|---|---|
protected static String |
HELP
|
protected static String |
STD_MSG_404
|
| Constructor Summary | |
|---|---|
AbstractProtocolHandler()
|
|
| Method Summary | |
|---|---|
protected boolean |
checkGlobalCommands(PrintWriter out,
Map<String,String> header,
Map<String,String> request)
|
void |
doHelp(PrintWriter out)
prints the help about the service, the supported calls and their parameters. |
void |
err404(PrintWriter out,
String command)
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)
|
protected abstract String |
usage()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String STD_MSG_404
protected static final String HELP
| Constructor Detail |
|---|
public AbstractProtocolHandler()
| Method Detail |
|---|
public void doHelp(PrintWriter out)
ProtocolHandlerRequestHandler on invalid/incomplete
calls.
doHelp in interface ProtocolHandlerout - - the printwriter to used to send a message to client
public void err404(PrintWriter out,
String command)
ProtocolHandler
err404 in interface ProtocolHandlerout - - the PrintWriter used to write a client responsecommand - - specify the requested location, that could not be resolvedpublic Map<String,RequestHandler> getRequestHandlers()
ProtocolHandlerRequestHandler. The request handlers are
plugged in by application context configuration
getRequestHandlers in interface ProtocolHandlerpublic HTTPServer<?> getServer()
ProtocolHandler
getServer in interface ProtocolHandler
public void processRequest(Socket clientSocket,
Map<String,String> header,
Map<String,String> request)
throws Exception
ProtocolHandler
processRequest in interface ProtocolHandlerclientSocket - - the socket for client communicationheader - - the parameters from HTTP headerrequest - - the request parameters
Exception - - if anything goes wrongpublic void setRequestHandlers(Map<String,RequestHandler> requestHandlerMap)
ProtocolHandlerRequestHandler. The request handlers
are plugged in by application context configuration
setRequestHandlers in interface ProtocolHandlerrequestHandlerMap - - the map of RequestHandlerpublic void setup(HTTPServer<?> srv)
ProtocolHandlerHTTPServer
will start the rest of configuration, before accepting connections from
clients.
setup in interface ProtocolHandlersrv - - the HTTPServer instance
public void status(PrintWriter out,
HttpStatusCode status)
status in interface ProtocolHandler
public void status(PrintWriter out,
HttpStatusCode status,
String message)
status in interface ProtocolHandler
protected boolean checkGlobalCommands(PrintWriter out,
Map<String,String> header,
Map<String,String> request)
throws Exception
Exceptionprotected abstract String usage()
|
SRJRCFrames v0.1.296 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||