|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.caucho.server.http.AbstractRequest
|
+--com.caucho.server.http.Request
Base class for top-level requests. Request drives the request and also stores information about the request.
| Field Summary | |
protected boolean |
bogusSecure
|
protected CharBuffer |
cb
|
protected java.util.ArrayList |
closeOnExit
|
protected com.caucho.server.Connection |
conn
|
protected TransactionImpl |
currentTransaction
|
protected ReadStream |
filterStream
|
protected boolean |
hasInputStream
|
protected com.caucho.server.http.InvocationKey |
invocationKey
|
protected boolean |
isSecure
|
protected ReadStream |
rawStream
|
protected Response |
response
|
protected ServletServer |
server
|
protected int |
sessionGroup
|
protected int |
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 |
| Constructor Summary | |
protected |
Request(ServletServer server)
Create a new Request. |
| Method Summary | |
java.lang.String |
findSessionIdFromConnection()
For SSL connections, use the SSL identifier. |
protected void |
finish()
Cleans up at the end of the request |
protected void |
finishSession()
|
Application |
getApplication()
Returns the request's Application. |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the named attribute as an Object,
or null if no attribute of the given name exists. |
java.util.Enumeration |
getAttributeNames()
Returns an Enumeration containing the
names of the attributes available to this request. |
java.lang.String |
getChain(java.lang.String contentType)
Returns a servlet filter based on the content type. |
java.lang.String |
getCharacterEncoding()
Returns the character encoding of a post. |
int |
getContentLength()
Returns the content length of a post. |
java.lang.String |
getContentType()
Returns the content-length of a post. |
java.lang.String |
getContextPath()
Returns the context part of the uri. |
Cookie |
getCookie(java.lang.String name)
Returns the cookies from the browser |
Cookie[] |
getCookies()
Returns the cookies from the browser |
long |
getDate()
Returns the date for the current request. |
java.lang.String |
getHeader(java.lang.String key)
Returns the value of the specified request header as a String. |
abstract CharSegment |
getHeaderBuffer(char[] cb,
int length)
|
abstract CharSegment |
getHeaderBuffer(java.lang.String key)
|
abstract void |
getHeaderBuffers(java.util.ArrayList values,
java.lang.String key)
|
abstract java.util.Enumeration |
getHeaderNames()
Enumerates the header keys |
java.util.Enumeration |
getHeaders(java.lang.String name)
Returns all the values of the specified request header as an Enumeration of String objects. |
ServletInputStream |
getInputStream()
Returns a stream for reading POST data. |
java.util.Locale |
getLocale()
Returns the preferred Locale that the client will
accept content in, based on the Accept-Language header. |
java.util.Enumeration |
getLocales()
Returns an Enumeration of Locale objects
indicating, in decreasing order starting with the preferred locale, the
locales that are acceptable to the client based on the Accept-Language
header. |
java.lang.String |
getMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. |
abstract CharSegment |
getMethodBuffer()
|
java.lang.String |
getPageContextPath()
Returns the context part of the uri. |
java.lang.String |
getPagePathInfo()
Returns the portion of the uri after the servlet path for the current page. |
java.lang.String |
getPageQueryString()
Returns the current page's query string. |
java.lang.String |
getPageServletPath()
Returns the portion of the uri mapped to the servlet for the current page. |
java.lang.String |
getPageURI()
Returns the URI for the page. |
java.lang.String |
getParameter(java.lang.String name)
Returns the form primary value for the given name. |
java.util.Map |
getParameterMap()
Returns a map of the form. |
java.util.Enumeration |
getParameterNames()
Returns an enumeration of the form names. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Returns the form's values for the given name. |
java.lang.String |
getPathInfo()
Returns the portion of the uri after the servlet path for the original request. |
java.lang.String |
getPathTranslated()
Returns the real path of pathInfo. |
java.lang.String |
getProtocol()
Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1. |
abstract CharSegment |
getProtocolBuffer()
|
java.lang.String |
getQueryString()
Returns the current page's query string. |
java.io.BufferedReader |
getReader()
Returns a Reader for the POST contents |
java.lang.String |
getRealPath(java.lang.String path)
Deprecated. As of JSDK 2.1 |
abstract java.lang.String |
getRemoteAddr()
Returns the Internet Protocol (IP) address of the client that sent the request. |
abstract java.lang.String |
getRemoteHost()
Returns the fully qualified name of the client that sent the request, or the IP address of the client if the name cannot be determined. |
Application |
getRequestApplication()
|
int |
getRequestDepth()
|
java.lang.String |
getRequestedSessionId()
Returns the session id in the HTTP request. |
java.lang.String |
getRequestURI()
Returns the URI for the request |
abstract java.lang.String |
getScheme()
Returns the name of the scheme used to make this request, for example, http, https, or ftp. |
abstract java.lang.String |
getServerName()
Returns the host name of the server that received the request. |
abstract int |
getServerPort()
Returns the port number on which this request was received. |
java.lang.String |
getServletPath()
Returns the portion of the uri mapped to the servlet for the original request. |
HttpSession |
getSession(boolean create)
Returns the current session. |
int |
getSessionGroup()
|
ReadStream |
getStream()
|
static Request |
getThreadRequest()
Returns the request associated with the current thread. |
abstract byte[] |
getUriBuffer()
|
abstract int |
getUriLength()
|
void |
init()
Initialize thread-specific data. |
boolean |
isRequestedSessionIdFromCookie()
Returns true if the current sessionId came from a cookie. |
boolean |
isRequestedSessionIdFromUrl()
Deprecated. |
boolean |
isRequestedSessionIdFromURL()
Returns true if the current sessionId came from the url. |
boolean |
isRequestedSessionIdValid()
Returns true if the HTTP request's session id refers to a valid session. |
boolean |
isSecure()
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS. |
boolean |
isTesting()
|
int |
printRemoteAddr(byte[] buffer,
int offset)
|
void |
removeAttribute(java.lang.String name)
Removes an attribute from this request. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Stores an attribute in this request. |
void |
setCharacterEncoding(java.lang.String encoding)
Sets the character encoding of a post. |
abstract void |
setHeader(java.lang.String key,
java.lang.String value)
|
protected void |
setVaryCookie(java.lang.String cookie)
If true, detects when a page depends on a cookie. |
protected void |
start(ReadStream s)
Prepare the Request object for a new request. |
| 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 |
| Methods inherited from interface com.caucho.server.ServerRequest |
handleConnection |
| Field Detail |
protected ServletServer server
protected com.caucho.server.Connection conn
protected int version
protected com.caucho.server.http.InvocationKey invocationKey
protected int sessionGroup
protected ReadStream rawStream
protected ReadStream filterStream
protected boolean hasInputStream
protected Response response
protected CharBuffer cb
protected boolean isSecure
protected boolean bogusSecure
protected TransactionImpl currentTransaction
protected java.util.ArrayList closeOnExit
| Constructor Detail |
protected Request(ServletServer server)
server - the parent server| Method Detail |
public void init()
init in interface com.caucho.server.ServerRequest
protected void start(ReadStream s)
throws java.io.IOException
s - the raw connection streampublic java.lang.String getChain(java.lang.String contentType)
getChain in class AbstractRequestcontentType - mime-type selecting the filter.
public abstract void setHeader(java.lang.String key,
java.lang.String value)
setHeader in class AbstractRequest
protected void finishSession()
throws java.io.IOException
finishSession in class AbstractRequest
protected void finish()
throws java.io.IOException
finish in class AbstractRequest
public ServletInputStream getInputStream()
throws java.io.IOException
getInputStream in class AbstractRequestjavax.servlet.ServletRequestServletInputStream object containing
the body of the requestjava.lang.IllegalStateException - if the ServletRequest.getReader() method
has already been called for this requestjava.io.IOException - if an input or output exception occurred
public ReadStream getStream()
throws java.io.IOException
getStream in class AbstractRequestpublic int getRequestDepth()
public java.io.BufferedReader getReader()
throws java.io.IOException
getReader in class AbstractRequestjavax.servlet.ServletRequestBufferedReader
containing the body of the requestjava.io.UnsupportedEncodingException - if the character set encoding
used is not supported and the
text cannot be decodedjava.lang.IllegalStateException - if ServletRequest.getInputStream() method
has been called on this requestjava.io.IOException - if an input or output exception occurredServletRequest.getInputStream()public abstract java.lang.String getServerName()
ServletRequestSERVER_NAME.getServerName in class AbstractRequestjavax.servlet.ServletRequestString containing the name
of the server to which the request was sentpublic abstract int getServerPort()
ServletRequestSERVER_PORT.getServerPort in class AbstractRequestjavax.servlet.ServletRequestpublic abstract java.lang.String getRemoteAddr()
ServletRequestREMOTE_ADDR.getRemoteAddr in class AbstractRequestjavax.servlet.ServletRequestString containing the
IP address of the client that sent the request
public int printRemoteAddr(byte[] buffer,
int offset)
throws java.io.IOException
public abstract java.lang.String getRemoteHost()
ServletRequestREMOTE_HOST.getRemoteHost in class AbstractRequestjavax.servlet.ServletRequestString containing the fully qualified name
of the clientpublic abstract java.lang.String getScheme()
ServletRequesthttp, https, or ftp.
Different schemes have different rules for constructing URLs,
as noted in RFC 1738.getScheme in class AbstractRequestjavax.servlet.ServletRequestString containing the name
of the scheme used to make this requestpublic abstract CharSegment getMethodBuffer()
getMethodBuffer in class AbstractRequestpublic java.lang.String getMethod()
HttpServletRequestgetMethod in class AbstractRequestjavax.servlet.http.HttpServletRequestString
specifying the name
of the method with which
this request was madepublic java.lang.String getProtocol()
ServletRequestSERVER_PROTOCOL.getProtocol in class AbstractRequestjavax.servlet.ServletRequestString containing the protocol
name and version numberpublic abstract CharSegment getProtocolBuffer()
public java.lang.String getRequestURI()
getRequestURI in class AbstractRequestjavax.servlet.http.HttpServletRequestString containing
the part of the URL from the
protocol name up to the query stringHttpUtils.getRequestURL(javax.servlet.http.HttpServletRequest)public java.lang.String getPageURI()
getPageURI in class AbstractRequestpublic abstract byte[] getUriBuffer()
public abstract int getUriLength()
public java.lang.String getContextPath()
getContextPath in class AbstractRequestjavax.servlet.http.HttpServletRequestString specifying the
portion of the request URI that indicates the context
of the requestpublic java.lang.String getPageContextPath()
getPageContextPath in class AbstractRequestpublic java.lang.String getServletPath()
getServletPath in class AbstractRequestjavax.servlet.http.HttpServletRequestString containing
the name or path of the servlet being
called, as specified in the request URL,
decoded.public java.lang.String getPageServletPath()
getPageServletPath in class AbstractRequestpublic java.lang.String getPathInfo()
getPathInfo in class AbstractRequestjavax.servlet.http.HttpServletRequestString, decoded by the
web container, specifying
extra path information that comes
after the servlet path but before
the query string in the request URL;
or null if the URL does not have
any extra path informationpublic java.lang.String getPagePathInfo()
getPagePathInfo in class AbstractRequestpublic java.lang.String getRealPath(java.lang.String path)
getRealPath in class AbstractRequestpublic java.lang.String getPathTranslated()
getPathTranslated in class AbstractRequestjavax.servlet.http.HttpServletRequestString specifying the
real path, or null if
the URL does not have any extra path
informationpublic java.lang.String getQueryString()
getQueryString in class AbstractRequestjavax.servlet.http.HttpServletRequestString containing the query
string or null if the URL
contains no query string. The value is not
decoded by the container.public java.lang.String getPageQueryString()
getPageQueryString in class AbstractRequestpublic java.lang.String getHeader(java.lang.String key)
HttpServletRequestString. If the request did not include a header
of the specified name, this method returns null.
The header name is case insensitive. You can use
this method with any request header.getHeader in class AbstractRequestjavax.servlet.http.HttpServletRequestname - a String specifying the
header nameString containing the
value of the requested
header, or null
if the request does not
have a header of that namepublic abstract CharSegment getHeaderBuffer(java.lang.String key)
public abstract CharSegment getHeaderBuffer(char[] cb,
int length)
public abstract void getHeaderBuffers(java.util.ArrayList values,
java.lang.String key)
public abstract java.util.Enumeration getHeaderNames()
getHeaderNames in class AbstractRequestjavax.servlet.http.HttpServletRequestnullpublic int getContentLength()
getContentLength in class AbstractRequestjavax.servlet.ServletRequestpublic java.lang.String getContentType()
getContentType in class AbstractRequestjavax.servlet.ServletRequestString containing the name
of the MIME type of
the request, or -1 if the type is not knownpublic java.lang.String getCharacterEncoding()
getCharacterEncoding in class AbstractRequestjavax.servlet.ServletRequestString containing the name of
the chararacter encoding, or null
if the request does not specify a character encodingpublic void setCharacterEncoding(java.lang.String encoding)
javax.servlet.ServletRequesta - String containing the name of
the chararacter encoding.java.io.UnsupportedEncodingException - if this is not a valid encodingpublic Cookie[] getCookies()
getCookies in class AbstractRequestjavax.servlet.http.HttpServletRequestCookies
included with this request, or null
if the request has no cookiespublic Cookie getCookie(java.lang.String name)
getCookie in class AbstractRequestprotected void setVaryCookie(java.lang.String cookie)
setVaryCookie in class AbstractRequestcom.caucho.server.http.AbstractRequestcookie - the cookie the page depends on.public HttpSession getSession(boolean create)
getSession in class AbstractRequestcreate - true if a new session should be createdpublic boolean isRequestedSessionIdValid()
isRequestedSessionIdValid in class AbstractRequestjavax.servlet.http.HttpServletRequesttrue if this
request has an id for a valid session
in the current session context;
false otherwiseHttpServletRequest.getRequestedSessionId(),
HttpServletRequest.getSession(boolean),
HttpSessionContextpublic boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie in class AbstractRequestjavax.servlet.http.HttpServletRequesttrue if the session ID
came in as a
cookie; otherwise, falseHttpServletRequest.getSession(boolean)public boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL in class AbstractRequestjavax.servlet.http.HttpServletRequesttrue if the session ID
came in as part of a URL; otherwise,
falseHttpServletRequest.getSession(boolean)public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl in class AbstractRequestpublic java.lang.String getRequestedSessionId()
getRequestedSessionId in class AbstractRequestjavax.servlet.http.HttpServletRequestString specifying the session
ID, or null if the request did
not specify a session IDHttpServletRequest.isRequestedSessionIdValid()public java.lang.String findSessionIdFromConnection()
public int getSessionGroup()
getSessionGroup in class AbstractRequestpublic java.util.Enumeration getParameterNames()
getParameterNames in class AbstractRequestjavax.servlet.ServletRequestEnumeration of String
objects, each String containing
the name of a request parameter; or an
empty Enumeration if the
request has no parameterspublic java.util.Map getParameterMap()
javax.servlet.ServletRequestpublic java.lang.String[] getParameterValues(java.lang.String name)
getParameterValues in class AbstractRequestname - key in the formpublic java.lang.String getParameter(java.lang.String name)
getParameter in class AbstractRequestjavax.servlet.ServletRequestname - a String specifying the
name of the parameterString representing the
single value of the parameterServletRequest.getParameterValues(java.lang.String)public java.util.Enumeration getAttributeNames()
ServletRequestEnumeration containing the
names of the attributes available to this request.
This method returns an empty Enumeration
if the request has no attributes available to it.getAttributeNames in class AbstractRequestjavax.servlet.ServletRequestEnumeration of strings
containing the names
of the request's attributespublic java.lang.Object getAttribute(java.lang.String name)
ServletRequestObject,
or null if no attribute of the given name exists.
Attributes can be set two ways. The servlet container may set
attributes to make available custom information about a request.
For example, for requests made using HTTPS, the attribute
javax.servlet.request.X509Certificate can be used to
retrieve information on the certificate of the client. Attributes
can also be set programatically using
ServletRequest.setAttribute(java.lang.String, java.lang.Object). This allows information to be
embedded into a request before a RequestDispatcher call.
Attribute names should follow the same conventions as package
names. This specification reserves names matching java.*,
javax.*, and sun.*.
getAttribute in class AbstractRequestjavax.servlet.ServletRequestname - a String specifying the name of
the attributeObject containing the value
of the attribute, or null if
the attribute does not exist
public void setAttribute(java.lang.String name,
java.lang.Object value)
ServletRequestRequestDispatcher.
Attribute names should follow the same conventions as
package names. Names beginning with java.*,
javax.*, and com.sun.*, are
reserved for use by Sun Microsystems.
setAttribute in class AbstractRequestjavax.servlet.ServletRequestname - a String specifying
the name of the attributeo - the Object to be storedpublic void removeAttribute(java.lang.String name)
ServletRequestAttribute names should follow the same conventions as
package names. Names beginning with java.*,
javax.*, and com.sun.*, are
reserved for use by Sun Microsystems.
removeAttribute in class AbstractRequestjavax.servlet.ServletRequestname - a String specifying
the name of the attribute to removepublic java.util.Enumeration getHeaders(java.lang.String name)
HttpServletRequestEnumeration of String objects.
Some headers, such as Accept-Language can be sent
by clients as several headers each with a different value rather than
sending the header as a comma separated list.
If the request did not include any headers
of the specified name, this method returns an empty
Enumeration.
The header name is case insensitive. You can use
this method with any request header.
getHeaders in class AbstractRequestjavax.servlet.http.HttpServletRequestname - a String specifying the
header nameEnumeration containing
the values of the requested header. If
the request does not have any headers of
that name return an empty
enumeration. If
the container does not allow access to
header information, return nullpublic java.util.Locale getLocale()
ServletRequestLocale that the client will
accept content in, based on the Accept-Language header.
If the client request doesn't provide an Accept-Language header,
this method returns the default locale for the server.getLocale in class AbstractRequestjavax.servlet.ServletRequestLocale for the clientpublic java.util.Enumeration getLocales()
ServletRequestEnumeration of Locale objects
indicating, in decreasing order starting with the preferred locale, the
locales that are acceptable to the client based on the Accept-Language
header.
If the client request doesn't provide an Accept-Language header,
this method returns an Enumeration containing one
Locale, the default locale for the server.getLocales in class AbstractRequestjavax.servlet.ServletRequestEnumeration of preferred
Locale objects for the clientpublic boolean isSecure()
ServletRequestisSecure in class AbstractRequestjavax.servlet.ServletRequestpublic Application getApplication()
public Application getRequestApplication()
public static Request getThreadRequest()
public long getDate()
getDate in class AbstractRequestpublic boolean isTesting()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||