com.prolixtech.jaminid
Class Request

java.lang.Object
  extended by com.prolixtech.jaminid.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.

Author:
Constantinos Michael TODO

Constructor Summary
Request(Daemon activeDaemon, Connection connx)
          Creates a new request object
 
Method Summary
 void addRequestLines(java.lang.String requestMessage)
          Method Adds Request Lines
 void appendToBody(java.lang.String body)
          appends more stuff to body of request
 boolean checkParam(java.lang.String param, java.lang.String possvalue)
           
 java.lang.String getBody()
          Used in POST to return the body of the request
 Daemon getDaemon()
          Returns the master daemon
 java.util.Map getHeader()
          Returns header
 java.lang.String getIPAddressString()
           
 java.lang.String getLocation()
          Return the location sought
 java.lang.String getMessage()
          Returns the entire request message
 java.lang.String getParam(java.lang.String key)
           
 java.util.Map<java.lang.String,java.lang.String> getParamMap()
           
 java.lang.String getParamOrNull(java.lang.String key)
           
 java.lang.String getParamString()
           
 java.lang.String getURI()
          Returns the Uniform Resource Identifier
 boolean isRequestBad()
           
 void setMethodLine(java.lang.String methodLine)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

isRequestBad

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

getURI

public java.lang.String getURI()
Returns the Uniform Resource Identifier

Returns:
the URI Uniform Resource Identifier

getMessage

public java.lang.String getMessage()
Returns the entire request message

Returns:
the entire request message

getBody

public java.lang.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 java.util.Map getHeader()
Returns header

Returns:
the header of this request

getParamMap

public java.util.Map<java.lang.String,java.lang.String> getParamMap()
Returns:
a param map of the request (like Perl)

getLocation

public java.lang.String getLocation()
Return the location sought

Returns:
the location sought (URL)

setMethodLine

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

appendToBody

public void appendToBody(java.lang.String body)
appends more stuff to body of request

Parameters:
body - what to append

addRequestLines

public void addRequestLines(java.lang.String requestMessage)
Method Adds Request Lines

Parameters:
requestMessage - the message to add

getIPAddressString

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

getParamString

public java.lang.String getParamString()
Returns:
the param string

getParam

public java.lang.String getParam(java.lang.String key)

getParamOrNull

public java.lang.String getParamOrNull(java.lang.String key)

checkParam

public boolean checkParam(java.lang.String param,
                          java.lang.String possvalue)