org.openejb.webadmin.httpd
Class HttpRequestImpl

java.lang.Object
  extended by org.openejb.webadmin.httpd.HttpRequestImpl
All Implemented Interfaces:
java.io.Serializable, HttpRequest

public class HttpRequestImpl
extends java.lang.Object
implements HttpRequest

A class to take care of HTTP Requests. It parses headers, content, form and url parameters.

Author:
David Blevins, Tim Urberg
See Also:
Serialized Form

Field Summary
protected static java.lang.String EJBSESSIONID
           
static java.lang.String FILENAME
           
static java.lang.String FORM_URL_ENCODED
           
static java.lang.String MULITPART_FORM_DATA
           
static java.lang.String NAME
           
 
Fields inherited from interface org.openejb.webadmin.HttpRequest
CONNECT, DELETE, GET, HEAD, HEADER_ACCEPT, HEADER_ACCEPT_ENCODING, HEADER_ACCEPT_LANGUAGE, HEADER_CACHE_CONTROL, HEADER_CONNECTION, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_COOKIE, HEADER_HOST, HEADER_SET_COOKIE, HEADER_USER_AGENT, OPTIONS, POST, PUT, TRACE, UNSUPPORTED
 
Constructor Summary
HttpRequestImpl()
           
 
Method Summary
protected  java.lang.String getCookie(java.lang.String name)
           
protected  java.util.HashMap getCookies()
           
 java.lang.String getFormParameter(java.lang.String name)
          Gets a form parameter based on the name passed in.
 java.lang.String[][] getFormParameters()
          Gets all the form parameters in the form of a two-dimentional array The second dimention has two indexes which contain the key and value for example: for(int i=0; i All values are strings
 java.lang.String getHeader(java.lang.String name)
          Gets a header based the header name passed in.
 int getMethod()
          Gets an integer value of the request method.
 java.lang.String getMethodString()
           
 java.lang.String getPathString()
           
 java.lang.String getQueryParameter(java.lang.String name)
          Gets a URL (or query) parameter based on the name passed in.
protected  java.lang.String getRequestLine()
           
 HttpSession getSession()
          Returns the current session associated with this request, or if the request does not have a session, creates one.
 HttpSession getSession(boolean create)
          Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.
 java.net.URL getURI()
          Gets the URI for the current URL page.
protected  void readMessage(java.io.InputStream input)
          parses the request into the 3 different parts, request, headers, and body
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORM_URL_ENCODED

public static final java.lang.String FORM_URL_ENCODED
See Also:
Constant Field Values

MULITPART_FORM_DATA

public static final java.lang.String MULITPART_FORM_DATA
See Also:
Constant Field Values

FILENAME

public static final java.lang.String FILENAME
See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

EJBSESSIONID

protected static final java.lang.String EJBSESSIONID
See Also:
Constant Field Values
Constructor Detail

HttpRequestImpl

public HttpRequestImpl()
Method Detail

getMethodString

public java.lang.String getMethodString()
Returns:
Returns the methodString.

getPathString

public java.lang.String getPathString()
Returns:
Returns the pathString.

getHeader

public java.lang.String getHeader(java.lang.String name)
Gets a header based the header name passed in.

Specified by:
getHeader in interface HttpRequest
Parameters:
name - The name of the header to get
Returns:
The value of the header

getFormParameter

public java.lang.String getFormParameter(java.lang.String name)
Gets a form parameter based on the name passed in.

Specified by:
getFormParameter in interface HttpRequest
Parameters:
name - The name of the form parameter to get
Returns:
The value of the parameter

getFormParameters

public java.lang.String[][] getFormParameters()
Gets all the form parameters in the form of a two-dimentional array The second dimention has two indexes which contain the key and value for example: for(int i=0; i All values are strings

Specified by:
getFormParameters in interface HttpRequest
Returns:
All the form parameters

getQueryParameter

public java.lang.String getQueryParameter(java.lang.String name)
Gets a URL (or query) parameter based on the name passed in.

Specified by:
getQueryParameter in interface HttpRequest
Parameters:
name - The name of the URL (or query) parameter
Returns:
The value of the URL (or query) parameter

getMethod

public int getMethod()
Gets an integer value of the request method. These values are: OPTIONS = 0 GET = 1 HEAD = 2 POST = 3 PUT = 4 DELETE = 5 TRACE = 6 CONNECT = 7 UNSUPPORTED = 8

Specified by:
getMethod in interface HttpRequest
Returns:
The integer value of the method

getURI

public java.net.URL getURI()
Gets the URI for the current URL page.

Specified by:
getURI in interface HttpRequest
Returns:
The URI

readMessage

protected void readMessage(java.io.InputStream input)
                    throws java.io.IOException
parses the request into the 3 different parts, request, headers, and body

Parameters:
input - the data input for this page
Throws:
java.io.IOException - if an exception is thrown

getRequestLine

protected java.lang.String getRequestLine()

getCookies

protected java.util.HashMap getCookies()

getCookie

protected java.lang.String getCookie(java.lang.String name)

getSession

public HttpSession getSession()
Description copied from interface: HttpRequest
Returns the current session associated with this request, or if the request does not have a session, creates one.

Specified by:
getSession in interface HttpRequest
Returns:
the HttpSession associated with this request
See Also:
HttpRequest.getSession(boolean)

getSession

public HttpSession getSession(boolean create)
Description copied from interface: HttpRequest
Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.

If create is false and the request has no valid HttpSession, this method returns null.

Specified by:
getSession in interface HttpRequest
Parameters:
create - true to create a new session for this request if necessary; false to return null if there's no current session
Returns:
the HttpSession associated with this request or null if create is false and the request has no valid session
See Also:
HttpRequest.getSession()


Copyright © 1999-2011 OpenEJB. All Rights Reserved.