com.prolixtech.jaminid

Class Request


public class Request
extends java.lang.Object

The request class encapsulates an HTTP request. It is responsible for splitting up the query, processing POST forms, splitting to URI and URL, and once it is created, it is essentially a data struct for all this information.

Constructor Summary

Request(Daemon activeDaemon, Connection connx)
Creates a new request object

Method Summary

void
addRequestLines(String requestMessage)
Method Adds Request Lines
void
appendToBody(String body)
appends more stuff to body of request
boolean
checkParam(String param, String possvalue)
String
getBody()
Used in POST to return the body of the request
Daemon
getDaemon()
Returns the master daemon
Map
getHeader()
Returns header
String
getIPAddressString()
String
getLocation()
Return the location sought
String
getMessage()
Returns the entire request message
String
getParam(String key)
Map
getParamMap()
String
getParamOrNull(String key)
String
getParamString()
String
getURI()
Returns the Uniform Resource Identifier
boolean
isRequestBad()
void
setMethodLine(String methodLine)
protected int
switchToBody()
protected void
switchToCompleted()

Constructor Details

Request

public Request(Daemon activeDaemon,
               Connection connx)
Creates a new request object
Parameters:
activeDaemon - the daemon that spawned the request
connx - the connection that produced this request

Method Details

addRequestLines

public void addRequestLines(String requestMessage)
Method Adds Request Lines
Parameters:
requestMessage - the message to add

appendToBody

public void appendToBody(String body)
appends more stuff to body of request
Parameters:
body - what to append

checkParam

public boolean checkParam(String param,
                          String possvalue)

getBody

public String getBody()
Used in POST to return the body of the request
Returns:
the body of the request (useful in POST)

getDaemon

public Daemon getDaemon()
Returns the master daemon
Returns:
the master daemon where this request was spawned

getHeader

public Map getHeader()
Returns header
Returns:
the header of this request

getIPAddressString

public String getIPAddressString()
Returns:
the ip address of the request

getLocation

public String getLocation()
Return the location sought
Returns:
the location sought (URL)

getMessage

public String getMessage()
Returns the entire request message
Returns:
the entire request message

getParam

public String getParam(String key)

getParamMap

public Map getParamMap()
Returns:
a param map of the request (like Perl)

getParamOrNull

public String getParamOrNull(String key)

getParamString

public String getParamString()
Returns:
the param string

getURI

public String getURI()
Returns the Uniform Resource Identifier
Returns:
the URI Uniform Resource Identifier

isRequestBad

public boolean isRequestBad()
Returns:
if the request was malformed

setMethodLine

public void setMethodLine(String methodLine)
Parameters:
methodLine - the method line of the request

switchToBody

protected int switchToBody()

switchToCompleted

protected void switchToCompleted()