org.tranche.httpd
Class AbstractHttpHandler

java.lang.Object
  extended by org.tranche.httpd.AbstractHttpHandler
All Implemented Interfaces:
IFileResources, IHttpHandler
Direct Known Subclasses:
GetHandler

public abstract class AbstractHttpHandler
extends java.lang.Object
implements IHttpHandler, IFileResources

Abstract class for handling HTTP requests. All classes handling a specific HTTP requests e.g. GET, will derive from this class.

Author:
Takis Papoulias

Field Summary
static boolean DEBUG
          Debug flag reserved for midium level of stdout vebrocity.
static boolean DEBUG_VERBOSE
          Debug flag reserver for a higher level of stdout vebrocity.
static boolean ECHO
          Flag for debugging an input stream.
protected  java.lang.String httpVersion
           
protected  java.io.BufferedReader is
           
protected  java.io.PrintStream os
           
protected  java.util.HashMap<java.lang.String,java.lang.String> pvMap
           
static int READ_AHEAD
          Size to be used in marking an input stream.
protected  java.lang.String requestCode
           
protected  java.lang.String requestName
           
 
Fields inherited from interface org.tranche.httpd.IFileResources
HTTP_PAGE_DIRECTORY, HTTP_PROPERTIES_DIRECTORY, HTTP_RESPONSE_MESSAGES_PROP_FILE, LOCALE
 
Constructor Summary
AbstractHttpHandler()
           
 
Method Summary
protected  void send(HttpConstant contentType, byte[] content)
           
protected  void sendError(HttpConstant errorNumber, java.lang.String errorDetails)
          Helper method for sending an error message for the specified locale.
 void setHeaderPV(java.util.HashMap<java.lang.String,java.lang.String> paramValMap)
          Setter method for the param value pair send by the browser.
 void setHttpVersion(java.lang.String ver)
          The browsers http version
 void setIn(java.io.BufferedReader br)
          Setter method for the input stream to the browser.
 void setOut(java.io.PrintStream os)
          Setter method for the output stream to the browser.
 void setRequestCode(java.lang.String rc)
          The request code send by the browser.
 void setRequestName(java.lang.String rn)
          The request name send by the browser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tranche.httpd.IHttpHandler
handle
 

Field Detail

is

protected java.io.BufferedReader is

os

protected java.io.PrintStream os

pvMap

protected java.util.HashMap<java.lang.String,java.lang.String> pvMap

requestCode

protected java.lang.String requestCode

requestName

protected java.lang.String requestName

httpVersion

protected java.lang.String httpVersion

DEBUG

public static final boolean DEBUG
Debug flag reserved for midium level of stdout vebrocity.

See Also:
Constant Field Values

DEBUG_VERBOSE

public static final boolean DEBUG_VERBOSE
Debug flag reserver for a higher level of stdout vebrocity.

See Also:
Constant Field Values

ECHO

public static final boolean ECHO
Flag for debugging an input stream. Usually used to activate a block of code that marks an input stream.

See Also:
Constant Field Values

READ_AHEAD

public static final int READ_AHEAD
Size to be used in marking an input stream.

See Also:
Constant Field Values
Constructor Detail

AbstractHttpHandler

public AbstractHttpHandler()
Method Detail

sendError

protected void sendError(HttpConstant errorNumber,
                         java.lang.String errorDetails)
                  throws java.io.IOException
Helper method for sending an error message for the specified locale.

Parameters:
errorNumber -
errorDetails -
Throws:
java.io.IOException

send

protected void send(HttpConstant contentType,
                    byte[] content)
             throws java.io.IOException
Parameters:
contentType -
content -
Throws:
java.io.IOException

setOut

public void setOut(java.io.PrintStream os)
Setter method for the output stream to the browser.

Specified by:
setOut in interface IHttpHandler
Parameters:
os -

setIn

public void setIn(java.io.BufferedReader br)
Setter method for the input stream to the browser.

Specified by:
setIn in interface IHttpHandler
Parameters:
br -

setHeaderPV

public void setHeaderPV(java.util.HashMap<java.lang.String,java.lang.String> paramValMap)
Setter method for the param value pair send by the browser.

Specified by:
setHeaderPV in interface IHttpHandler
Parameters:
paramValMap - Map containing the param value pair

setRequestCode

public void setRequestCode(java.lang.String rc)
The request code send by the browser.

Specified by:
setRequestCode in interface IHttpHandler
Parameters:
rc - The request code

setRequestName

public void setRequestName(java.lang.String rn)
The request name send by the browser

Specified by:
setRequestName in interface IHttpHandler
Parameters:
rn - The request name

setHttpVersion

public void setHttpVersion(java.lang.String ver)
The browsers http version

Specified by:
setHttpVersion in interface IHttpHandler
Parameters:
ver - The http version


This code is free for use both commercially and non-commercially as stated in the project's license