SRJRCFrames
v0.1.296

de.schwarzrot.net.http.service
Class AbstractRequestHandler

java.lang.Object
  extended by de.schwarzrot.net.http.service.AbstractRequestHandler
All Implemented Interfaces:
RequestHandler
Direct Known Subclasses:
AbstractJSONRequestHandler, FileHandler

public abstract class AbstractRequestHandler
extends Object
implements RequestHandler

base class for request handlers.

Author:
Reinhard Mantey

Field Summary
 
Fields inherited from interface de.schwarzrot.net.http.service.RequestHandler
HTTP_CONTENT_LENGTH, HTTP_LANGUAGE, MIME_CSS, MIME_GIF, MIME_HTML, MIME_ICON, MIME_JPEG, MIME_JS, MIME_JSON, MIME_PNG, MIME_TIFF, MIME_UNKNOWN, QUERY_STRING, REQUEST_DEFAULT_HANDLER, REQUEST_DEFAULT_URL, REQUEST_GET_METHOD, REQUEST_HELP_URL, REQUEST_JSON_CHECK, REQUEST_LOCATION, REQUEST_METHOD, REQUEST_OPTIONS_METHOD, REQUEST_POST_METHOD, REQUEST_TIME, REQUEST_URI, REQUEST_WEBIF_BASE, REQUEST_WEBIF_EXT, REQUEST_WEBIF_ROOT, RESPONSE_HEADER, RESPONSE_LEN_HEADER, RESPONSE_STATUS_HEADER, SERVER_PROTOCOL
 
Constructor Summary
AbstractRequestHandler()
           
 
Method Summary
protected
<E extends Entity>
void
doIDAction(PrintWriter writer, Map<String,String> args, Class<E> clazz, RequestHandlerAction<E> action)
           
protected  String getHandlerIdentifier()
           
protected  org.apache.commons.logging.Log getLogger()
           
 ProtocolHandler getProtocolHandler()
          getter for the ProtocolHandler, which is used for general error or help message handling
protected  HTTPServer<?> getServer()
           
 TransactionFactory getTransactionFactory()
          getter for the TransactionFactory - just to avoid synthetic accessors for anonymous classes
protected  void initResponse(OutputStream os, String mimeType, Date lastModificationTime, long contentLength, String lang)
           
protected  void initResponse(PrintWriter writer, String mimeType, Date lastModificationTime, long contentLength, String lang)
           
 boolean replySuccess(PrintWriter writer)
          centralized message creator service.
abstract  boolean replySuccess(PrintWriter writer, HttpStatusCode status, String errorMessage)
          centralized message creator service
 void setup(String handlerID, ProtocolHandler ph)
          start the second stage of configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.schwarzrot.net.http.service.RequestHandler
process, usage
 

Constructor Detail

AbstractRequestHandler

public AbstractRequestHandler()
Method Detail

getProtocolHandler

public final ProtocolHandler getProtocolHandler()
Description copied from interface: RequestHandler
getter for the ProtocolHandler, which is used for general error or help message handling

Specified by:
getProtocolHandler in interface RequestHandler
Returns:
- the ProtocolHandler instance

getTransactionFactory

public final TransactionFactory getTransactionFactory()
Description copied from interface: RequestHandler
getter for the TransactionFactory - just to avoid synthetic accessors for anonymous classes

Specified by:
getTransactionFactory in interface RequestHandler
Returns:
the transaction factory

replySuccess

public boolean replySuccess(PrintWriter writer)
                     throws Exception
Description copied from interface: RequestHandler
centralized message creator service. This is a shorthand for reply success

Specified by:
replySuccess in interface RequestHandler
Parameters:
writer - - the communication channel to the client
Throws:
Exception - - type of exception varies depending on the protocol used

replySuccess

public abstract boolean replySuccess(PrintWriter writer,
                                     HttpStatusCode status,
                                     String errorMessage)
                              throws Exception
Description copied from interface: RequestHandler
centralized message creator service

Specified by:
replySuccess in interface RequestHandler
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

public void setup(String handlerID,
                  ProtocolHandler ph)
Description copied from interface: RequestHandler
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.

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

doIDAction

protected <E extends Entity> void doIDAction(PrintWriter writer,
                                             Map<String,String> args,
                                             Class<E> clazz,
                                             RequestHandlerAction<E> action)
                   throws Exception
Throws:
Exception

getHandlerIdentifier

protected String getHandlerIdentifier()

getLogger

protected org.apache.commons.logging.Log getLogger()

getServer

protected final HTTPServer<?> getServer()

initResponse

protected void initResponse(OutputStream os,
                            String mimeType,
                            Date lastModificationTime,
                            long contentLength,
                            String lang)

initResponse

protected void initResponse(PrintWriter writer,
                            String mimeType,
                            Date lastModificationTime,
                            long contentLength,
                            String lang)

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.