SRJRCFrames
v0.1.296

de.schwarzrot.net.http.service
Interface ProtocolHandler

All Known Implementing Classes:
AbstractProtocolHandler

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.

Author:
Reinhard Mantey

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

doHelp

void doHelp(PrintWriter out)
prints the help about the service, the supported calls and their parameters. Will be used by RequestHandler on invalid/incomplete calls.

Parameters:
out - - the printwriter to used to send a message to client

err404

void err404(PrintWriter out,
            String target)
sends an error message to the client

Parameters:
out - - the PrintWriter used to write a client response
target - - specify the requested location, that could not be resolved

getRequestHandlers

Map<String,RequestHandler> getRequestHandlers()
accessor to the map of RequestHandler. The request handlers are plugged in by application context configuration

Returns:
- the map of request handlers

getServer

HTTPServer<?> getServer()
accessor the the HTTP server engine. Will be used for message-handling or the like

Returns:
- the server instance

processRequest

void processRequest(Socket clientSocket,
                    Map<String,String> header,
                    Map<String,String> request)
                    throws Exception
the entrypoint for request processing.

Parameters:
clientSocket - - the socket for client communication
header - - the parameters from HTTP header
request - - the request parameters
Throws:
Exception - - if anything goes wrong

setRequestHandlers

void setRequestHandlers(Map<String,RequestHandler> requestHandlerMap)
accessor to set the map of RequestHandler. The request handlers are plugged in by application context configuration

Parameters:
requestHandlerMap - - the map of RequestHandler

setup

void setup(HTTPServer<?> srv)
used for asynchronous setup. The instances will be created by application context, but are not configured completely. So the HTTPServer will start the rest of configuration, before accepting connections from clients.

Parameters:
srv - - the HTTPServer instance

status

void status(PrintWriter out,
            HttpStatusCode status)

status

void status(PrintWriter out,
            HttpStatusCode status,
            String message)

SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.