net.sf.j2ep.requesthandlers
Class RequestHandlerBase

java.lang.Object
  extended by net.sf.j2ep.requesthandlers.RequestHandlerBase
All Implemented Interfaces:
RequestHandler
Direct Known Subclasses:
BasicRequestHandler, EntityEnclosingRequestHandler, MaxForwardRequestHandler

public abstract class RequestHandlerBase
extends java.lang.Object
implements RequestHandler

A basic implementation of the RequestHandler. Includes a method to set the headers with.

Author:
Anders Nyman

Constructor Summary
RequestHandlerBase()
           
 
Method Summary
static void addBannedHeader(java.lang.String header)
          Adds a headers to the list of banned headers.
static void addBannedHeaders(java.lang.String headers)
          Adds all the headers in the input to the list of banned headers.
abstract  org.apache.commons.httpclient.HttpMethod process(HttpServletRequest request, java.lang.String url)
          Creates a new HttpMethod for this request.
protected  void setHeaders(org.apache.commons.httpclient.HttpMethod method, HttpServletRequest request)
          Will write all request headers stored in the request to the method that are not in the set of banned headers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestHandlerBase

public RequestHandlerBase()
Method Detail

process

public abstract org.apache.commons.httpclient.HttpMethod process(HttpServletRequest request,
                                                                 java.lang.String url)
                                                          throws java.io.IOException
Description copied from interface: RequestHandler
Creates a new HttpMethod for this request. Will then set the headers and any other information needed for this request.

Specified by:
process in interface RequestHandler
Parameters:
request - The request we are processing
url - URL to bind the method to
Returns:
The method we have created
Throws:
java.io.IOException - An exception is thrown when there is a problem with the input supplied by the request
See Also:
net.sf.j2ep.model.RequestHandler#process(javax.servlet.http.HttpServletRequest, java.lang.String)

setHeaders

protected void setHeaders(org.apache.commons.httpclient.HttpMethod method,
                          HttpServletRequest request)
                   throws org.apache.commons.httpclient.HttpException
Will write all request headers stored in the request to the method that are not in the set of banned headers. The Accept-Endocing header is also changed to allow compressed content connection to the server even if the end client doesn't support that. A Via headers is created as well in compliance with the RFC.

Parameters:
method - The HttpMethod used for this connection
request - The incoming request
Throws:
org.apache.commons.httpclient.HttpException

addBannedHeader

public static void addBannedHeader(java.lang.String header)
Adds a headers to the list of banned headers.

Parameters:
header - The header to add

addBannedHeaders

public static void addBannedHeaders(java.lang.String headers)
Adds all the headers in the input to the list of banned headers. The input string should be comma separated e.g. "Server,Connection,Via" This method is normally called by the factory that is using this request handler.

Parameters:
headers - The headers that are banned