org.apache.openejb.server.httpd
Class HttpRequestImpl

java.lang.Object
  extended by org.apache.openejb.server.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.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.openejb.server.httpd.HttpRequest
HttpRequest.Method
 
Field Summary
protected static java.lang.String EJBSESSIONID
           
 
Fields inherited from interface org.apache.openejb.server.httpd.HttpRequest
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, SERVLET_CONTEXT, SERVLET_REQUEST, SERVLET_RESPONSE
 
Constructor Summary
HttpRequestImpl(java.net.URI socketURI)
           
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
           
 int getContentLength()
           
 java.lang.String getContentType()
           
protected  java.lang.String getCookie(java.lang.String name)
           
protected  java.util.Map getCookies()
           
 java.lang.String getFormParameter(java.lang.String name)
          Gets a form parameter based on the name passed in.
 java.util.Map<java.lang.String,java.lang.String> getFormParameters()
           
 java.lang.String getHeader(java.lang.String name)
          Gets a header based the header name passed in.
 java.io.InputStream getInputStream()
           
 HttpRequest.Method getMethod()
          Gets the request method.
 java.lang.String getParameter(java.lang.String name)
          Gets a form or URL query parameter based on the name passed in.
 java.util.Map<java.lang.String,java.lang.String> getParameters()
          Gets all the form and URL query parameters
 java.lang.String getQueryParameter(java.lang.String name)
          Gets a URL (or query) parameter based on the name passed in.
 java.util.Map<java.lang.String,java.lang.String> getQueryParameters()
           
 java.lang.String getRemoteAddr()
           
 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.URI 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
 void setAttribute(java.lang.String name, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EJBSESSIONID

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

HttpRequestImpl

public HttpRequestImpl(java.net.URI socketURI)
Method Detail

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.

Parameters:
name - The name of the form parameter to get
Returns:
The value of the parameter

getFormParameters

public java.util.Map<java.lang.String,java.lang.String> getFormParameters()

getQueryParameters

public java.util.Map<java.lang.String,java.lang.String> getQueryParameters()

getQueryParameter

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

Parameters:
name - The name of the URL (or query) parameter
Returns:
The value of the URL (or query) parameter

getMethod

public HttpRequest.Method getMethod()
Gets the request method.

Specified by:
getMethod in interface HttpRequest
Returns:
the request method

getURI

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

Specified by:
getURI in interface HttpRequest
Returns:
the URI

getContentLength

public int getContentLength()
Specified by:
getContentLength in interface HttpRequest

getContentType

public java.lang.String getContentType()
Specified by:
getContentType in interface HttpRequest

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Specified by:
getInputStream in interface HttpRequest
Throws:
java.io.IOException

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

getCookies

protected java.util.Map getCookies()

getCookie

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

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()

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)

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Specified by:
getAttribute in interface HttpRequest

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Specified by:
setAttribute in interface HttpRequest

getParameter

public java.lang.String getParameter(java.lang.String name)
Description copied from interface: HttpRequest
Gets a form or URL query parameter based on the name passed in.

Specified by:
getParameter in interface HttpRequest

getParameters

public java.util.Map<java.lang.String,java.lang.String> getParameters()
Description copied from interface: HttpRequest
Gets all the form and URL query parameters

Specified by:
getParameters in interface HttpRequest
Returns:
All the form and URL query parameters

getRemoteAddr

public java.lang.String getRemoteAddr()
Specified by:
getRemoteAddr in interface HttpRequest


Copyright © 1999-2011 The Apache OpenEJB development community. All Rights Reserved.