com.caucho.server.http
Class HttpRequest

java.lang.Object
  |
  +--com.caucho.server.http.AbstractRequest
        |
        +--com.caucho.server.http.Request
              |
              +--com.caucho.server.http.HttpRequest
All Implemented Interfaces:
CauchoRequest, HttpServletRequest, SecurityContextProvider, com.caucho.server.ServerRequest, ServletRequest

public class HttpRequest
extends Request

Handles a new request from an HTTP connection.


Fields inherited from class com.caucho.server.http.Request
bogusSecure, cb, closeOnExit, conn, currentTransaction, filterStream, hasInputStream, invocationKey, isSecure, rawStream, response, server, sessionGroup, version
 
Fields inherited from class com.caucho.server.http.AbstractRequest
cache, calendar, CONTEXT_PATH, ERROR_URI, EXCEPTION, invocation, JSP_EXCEPTION, MESSAGE, PATH_INFO, QUERY_STRING, REQUEST_URI, SERVLET_PATH, STATUS_CODE
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Method Summary
 java.lang.String findSessionIdFromConnection()
          For SSL connections, use the SSL identifier.
 java.lang.Object getAttribute(java.lang.String name)
          Returns the named attribute.
 java.util.Enumeration getAttributeNames()
          Returns an enumeration of the attribute names.
 CharSegment getHeaderBuffer(char[] testBuf, int length)
          Returns the matching header.
 CharSegment getHeaderBuffer(java.lang.String key)
          Returns the header value for the key, returned as a CharSegment.
 void getHeaderBuffers(java.util.ArrayList values, java.lang.String key)
          Fills an ArrayList with the header values matching the key.
 java.util.Enumeration getHeaderNames()
          Returns an enumeration of all the header keys.
 java.util.Enumeration getHeaders(java.lang.String key)
          Return an enumeration of headers matching a key.
 CharSegment getMethodBuffer()
          Returns a buffer containing the request method.
 CharSegment getProtocolBuffer()
          Returns a char segment containing the protocol.
 java.lang.String getRemoteAddr()
          Returns the address of the remote client.
 java.lang.String getRemoteHost()
          Returns the client's remote host name.
 java.lang.String getScheme()
          Returns the request's scheme.
 java.lang.String getServerName()
          Returns the remote server name.
 int getServerPort()
          Returns the server (local) port index.
 byte[] getUriBuffer()
          Returns the byte buffer containing the request URI
 int getUriLength()
          Returns the length of the request URI
 void handleConnection(com.caucho.server.Connection conn)
          Handles a new connection.
 boolean isSecure()
          Returns true if the connection is secure.
 int printRemoteAddr(byte[] buffer, int offset)
          Prints the remote address into a buffer.
 void setHeader(java.lang.String key, java.lang.String value)
          Adds a new header.
protected  void start(ReadStream s)
          Clear the request variables in preparation for a new request.
 
Methods inherited from class com.caucho.server.http.Request
finish, finishSession, getApplication, getChain, getCharacterEncoding, getContentLength, getContentType, getContextPath, getCookie, getCookies, getDate, getHeader, getInputStream, getLocale, getLocales, getMethod, getPageContextPath, getPagePathInfo, getPageQueryString, getPageServletPath, getPageURI, getParameter, getParameterMap, getParameterNames, getParameterValues, getPathInfo, getPathTranslated, getProtocol, getQueryString, getReader, getRealPath, getRequestApplication, getRequestDepth, getRequestedSessionId, getRequestURI, getServletPath, getSession, getSessionGroup, getStream, getThreadRequest, init, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTesting, removeAttribute, setAttribute, setCharacterEncoding, setVaryCookie
 
Methods inherited from class com.caucho.server.http.AbstractRequest
authenticate, createSession, getAuthType, getCauchoApplication, getDateHeader, getIntHeader, getMedia, getRemoteUser, getRemoteUser, getRequestDepth, getRequestDispatcher, getRequestURL, getSession, getUserPrincipal, isUserInRole, logoutUserPrincipal, setHasCookie
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

handleConnection

public void handleConnection(com.caucho.server.Connection conn)
                      throws java.io.IOException
Handles a new connection. If keepalives are allowed, handleConnection will keep waiting for new requests. While waiting for a keepalive request, the connection is idle, so it can be easily closed.
Parameters:
conn - the new connection

start

protected void start(ReadStream s)
              throws java.io.IOException
Clear the request variables in preparation for a new request.
Overrides:
start in class Request
Parameters:
s - the read stream for the request

getScheme

public java.lang.String getScheme()
Returns the request's scheme.
Overrides:
getScheme in class Request
Following copied from interface: javax.servlet.ServletRequest
Returns:
a String containing the name of the scheme used to make this request

getMethodBuffer

public CharSegment getMethodBuffer()
Returns a buffer containing the request method.
Overrides:
getMethodBuffer in class Request

getUriBuffer

public byte[] getUriBuffer()
Returns the byte buffer containing the request URI
Overrides:
getUriBuffer in class Request

getUriLength

public int getUriLength()
Returns the length of the request URI
Overrides:
getUriLength in class Request

isSecure

public boolean isSecure()
Returns true if the connection is secure.
Overrides:
isSecure in class Request
Following copied from interface: javax.servlet.ServletRequest
Returns:
a boolean indicating if the request was made using a secure channel

getProtocolBuffer

public CharSegment getProtocolBuffer()
Returns a char segment containing the protocol.
Overrides:
getProtocolBuffer in class Request

setHeader

public void setHeader(java.lang.String key,
                      java.lang.String value)
Adds a new header. Used only by the caching to simulate If-Modified-Since.
Overrides:
setHeader in class Request
Parameters:
key - the key of the new header
value - the value for the new header

getHeaderBuffer

public CharSegment getHeaderBuffer(char[] testBuf,
                                   int length)
Returns the matching header.
Overrides:
getHeaderBuffer in class Request
Parameters:
testBuf - header key
length - length of the key.

getHeaderBuffer

public CharSegment getHeaderBuffer(java.lang.String key)
Returns the header value for the key, returned as a CharSegment.
Overrides:
getHeaderBuffer in class Request

getHeaderBuffers

public void getHeaderBuffers(java.util.ArrayList values,
                             java.lang.String key)
Fills an ArrayList with the header values matching the key.
Overrides:
getHeaderBuffers in class Request
Parameters:
values - ArrayList which will contain the maching values.
key - the header key to select.

getHeaders

public java.util.Enumeration getHeaders(java.lang.String key)
Return an enumeration of headers matching a key.
Overrides:
getHeaders in class Request
Parameters:
key - the header key to match.
Returns:
the enumeration of the headers.

getHeaderNames

public java.util.Enumeration getHeaderNames()
Returns an enumeration of all the header keys.
Overrides:
getHeaderNames in class Request
Following copied from interface: javax.servlet.http.HttpServletRequest
Returns:
an enumeration of all the header names sent with this request; if the request has no headers, an empty enumeration; if the servlet container does not allow servlets to use this method, null

getServerName

public java.lang.String getServerName()
Returns the remote server name.
Overrides:
getServerName in class Request
Following copied from interface: javax.servlet.ServletRequest
Returns:
a String containing the name of the server to which the request was sent

getServerPort

public int getServerPort()
Returns the server (local) port index.
Overrides:
getServerPort in class Request
Following copied from interface: javax.servlet.ServletRequest
Returns:
an integer specifying the port number

getRemoteAddr

public java.lang.String getRemoteAddr()
Returns the address of the remote client.
Overrides:
getRemoteAddr in class Request
Following copied from interface: javax.servlet.ServletRequest
Returns:
a String containing the IP address of the client that sent the request

printRemoteAddr

public int printRemoteAddr(byte[] buffer,
                           int offset)
                    throws java.io.IOException
Prints the remote address into a buffer.
Overrides:
printRemoteAddr in class Request
Parameters:
buffer - the buffer which will contain the address.
offset - the initial offset into the buffer.
Returns:
the final offset into the buffer.

getRemoteHost

public java.lang.String getRemoteHost()
Returns the client's remote host name.
Overrides:
getRemoteHost in class Request
Following copied from interface: javax.servlet.ServletRequest
Returns:
a String containing the fully qualified name of the client

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Returns the named attribute.
Overrides:
getAttribute in class Request
Following copied from interface: javax.servlet.ServletRequest
Parameters:
name - a String specifying the name of the attribute
Returns:
an Object containing the value of the attribute, or null if the attribute does not exist

getAttributeNames

public java.util.Enumeration getAttributeNames()
Returns an enumeration of the attribute names.
Overrides:
getAttributeNames in class Request
Following copied from interface: javax.servlet.ServletRequest
Returns:
an Enumeration of strings containing the names of the request's attributes

findSessionIdFromConnection

public java.lang.String findSessionIdFromConnection()
For SSL connections, use the SSL identifier.
Overrides:
findSessionIdFromConnection in class Request