SRJRCFrames
v0.1.296

de.schwarzrot.net.http.service
Interface RequestHandler

All Known Implementing Classes:
AbstractJSONRequestHandler, AbstractRequestHandler, FileHandler

public interface RequestHandler

describes the public interface for classes, that want to handle HTTP requests

Author:
Reinhard Mantey

Field Summary
static String HTTP_CONTENT_LENGTH
           
static String HTTP_LANGUAGE
           
static String MIME_CSS
           
static String MIME_GIF
           
static String MIME_HTML
           
static String MIME_ICON
           
static String MIME_JPEG
           
static String MIME_JS
           
static String MIME_JSON
           
static String MIME_PNG
           
static String MIME_TIFF
           
static String MIME_UNKNOWN
           
static String QUERY_STRING
           
static String REQUEST_DEFAULT_HANDLER
           
static String REQUEST_DEFAULT_URL
           
static String REQUEST_GET_METHOD
           
static String REQUEST_HELP_URL
           
static String REQUEST_JSON_CHECK
           
static String REQUEST_LOCATION
           
static String REQUEST_METHOD
           
static String REQUEST_OPTIONS_METHOD
           
static String REQUEST_POST_METHOD
           
static String REQUEST_TIME
           
static String REQUEST_URI
           
static String REQUEST_WEBIF_BASE
           
static String REQUEST_WEBIF_EXT
           
static String REQUEST_WEBIF_ROOT
           
static String RESPONSE_HEADER
           
static String RESPONSE_LEN_HEADER
           
static String RESPONSE_STATUS_HEADER
           
static String SERVER_PROTOCOL
           
 
Method Summary
 ProtocolHandler getProtocolHandler()
          getter for the ProtocolHandler, which is used for general error or help message handling
 TransactionFactory getTransactionFactory()
          getter for the TransactionFactory - just to avoid synthetic accessors for anonymous classes
 void process(Socket clientSocket, Map<String,String> header, Map<String,String> request)
          this is the entrypoint for request processing.
 boolean replySuccess(PrintWriter writer)
          centralized message creator service.
 boolean replySuccess(PrintWriter writer, HttpStatusCode status, String errorMessage)
          centralized message creator service
 void setup(String handlerID, ProtocolHandler ph)
          start the second stage of configuration.
 String usage()
          tells about the services and their parameters
 

Field Detail

HTTP_CONTENT_LENGTH

static final String HTTP_CONTENT_LENGTH
See Also:
Constant Field Values

HTTP_LANGUAGE

static final String HTTP_LANGUAGE
See Also:
Constant Field Values

QUERY_STRING

static final String QUERY_STRING
See Also:
Constant Field Values

REQUEST_DEFAULT_HANDLER

static final String REQUEST_DEFAULT_HANDLER
See Also:
Constant Field Values

REQUEST_DEFAULT_URL

static final String REQUEST_DEFAULT_URL
See Also:
Constant Field Values

REQUEST_GET_METHOD

static final String REQUEST_GET_METHOD
See Also:
Constant Field Values

REQUEST_HELP_URL

static final String REQUEST_HELP_URL
See Also:
Constant Field Values

REQUEST_JSON_CHECK

static final String REQUEST_JSON_CHECK
See Also:
Constant Field Values

REQUEST_LOCATION

static final String REQUEST_LOCATION
See Also:
Constant Field Values

REQUEST_METHOD

static final String REQUEST_METHOD
See Also:
Constant Field Values

REQUEST_OPTIONS_METHOD

static final String REQUEST_OPTIONS_METHOD
See Also:
Constant Field Values

REQUEST_POST_METHOD

static final String REQUEST_POST_METHOD
See Also:
Constant Field Values

REQUEST_TIME

static final String REQUEST_TIME
See Also:
Constant Field Values

REQUEST_URI

static final String REQUEST_URI
See Also:
Constant Field Values

REQUEST_WEBIF_ROOT

static final String REQUEST_WEBIF_ROOT
See Also:
Constant Field Values

REQUEST_WEBIF_BASE

static final String REQUEST_WEBIF_BASE
See Also:
Constant Field Values

REQUEST_WEBIF_EXT

static final String REQUEST_WEBIF_EXT
See Also:
Constant Field Values

SERVER_PROTOCOL

static final String SERVER_PROTOCOL
See Also:
Constant Field Values

MIME_CSS

static final String MIME_CSS
See Also:
Constant Field Values

MIME_GIF

static final String MIME_GIF
See Also:
Constant Field Values

MIME_ICON

static final String MIME_ICON
See Also:
Constant Field Values

MIME_JPEG

static final String MIME_JPEG
See Also:
Constant Field Values

MIME_PNG

static final String MIME_PNG
See Also:
Constant Field Values

MIME_TIFF

static final String MIME_TIFF
See Also:
Constant Field Values

MIME_JS

static final String MIME_JS
See Also:
Constant Field Values

MIME_JSON

static final String MIME_JSON
See Also:
Constant Field Values

MIME_HTML

static final String MIME_HTML
See Also:
Constant Field Values

MIME_UNKNOWN

static final String MIME_UNKNOWN
See Also:
Constant Field Values

RESPONSE_STATUS_HEADER

static final String RESPONSE_STATUS_HEADER
See Also:
Constant Field Values

RESPONSE_LEN_HEADER

static final String RESPONSE_LEN_HEADER
See Also:
Constant Field Values

RESPONSE_HEADER

static final String RESPONSE_HEADER
See Also:
Constant Field Values
Method Detail

getProtocolHandler

ProtocolHandler getProtocolHandler()
getter for the ProtocolHandler, which is used for general error or help message handling

Returns:
- the ProtocolHandler instance

getTransactionFactory

TransactionFactory getTransactionFactory()
getter for the TransactionFactory - just to avoid synthetic accessors for anonymous classes

Returns:
the transaction factory

process

void process(Socket clientSocket,
             Map<String,String> header,
             Map<String,String> request)
             throws Exception
this is the entrypoint for request processing. Will be called by the ProtocolHandler. The request handler that decides, what to do, based on request parameters.

Parameters:
clientSocket - - the socket for client communication
header - - a map that contains all requests header parameters
request - - a map that contains all request parameters
Throws:
Exception - - type of exception varies depending on the protocol used

replySuccess

boolean replySuccess(PrintWriter writer)
                     throws Exception
centralized message creator service. This is a shorthand for reply success

Parameters:
writer - - the communication channel to the client
Throws:
Exception - - type of exception varies depending on the protocol used

replySuccess

boolean replySuccess(PrintWriter writer,
                     HttpStatusCode status,
                     String errorMessage)
                     throws Exception
centralized message creator service

Parameters:
writer - - the communication channel to the client
status - - the status code of the last request
errorMessage - - the error message for the client
Throws:
Exception - - type of exception varies depending on the protocol used

setup

void setup(String handlerID,
           ProtocolHandler ph)
start the second stage of configuration. Instances will be created by application context, but those instances are not configured completely. HTTPServer starts the second stage of configuration, before accepting any client requests.

Parameters:
handlerID - - the identifier this handler acts upon. The identifier typically is the first name after the domain/port-part.
ph - - the ProtocolHandler instance

usage

String usage()
tells about the services and their parameters

Returns:
- the description 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.