|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Defines a servlet engine generated object that enables a servlet to get information about a client request.
Some of the data provided by the ServletRequest object includes parameter names and values, attributes, and an input stream. Subclasses of ServletRequest can provide additional protocol-specific data. For example, HTTP data is provided by the interface HttpServletRequest, which extends ServletRequest. This framework provides the servlet's only access to this data.
MIME bodies are either text or binary data. Use getReader to handle text, including the character encodings. The getInputStream call should be used to handle binary data. Multipart MIME bodies are treated as binary data, since the headers are US-ASCII data.
HttpServletRequest
Method Summary | |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the named attribute of this request. |
java.util.Enumeration |
getAttributeNames()
Returns an enumeration of attribute names contained in this request. |
java.lang.String |
getCharacterEncoding()
Returns the character set encoding for the input of this request. |
int |
getContentLength()
Returns the size of the request entity data, or -1 if not known. |
java.lang.String |
getContentType()
Returns the Internet Media (MIME) Type of the request entity data, or null if not known. |
ServletInputStream |
getInputStream()
Returns an input stream for reading binary data in the request body. |
java.lang.String |
getParameter(java.lang.String name)
Returns a string containing the lone value of the specified parameter, or null if the parameter does not exist. |
java.util.Enumeration |
getParameterNames()
Returns the parameter names for this request as an enumeration of strings, or an empty enumeration if there are no parameters or the input stream is empty. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Returns the values of the specified parameter for the request as an array of strings, or null if the named parameter does not exist. |
java.lang.String |
getProtocol()
Returns the protocol and version of the request as a string of the form <protocol>/<major version>.<minor
version> . |
java.io.BufferedReader |
getReader()
Returns a buffered reader for reading text in the request body. |
java.lang.String |
getRealPath(java.lang.String path)
Deprecated. This method has been deprecated in preference to the same method found in the ServletContext interface. |
java.lang.String |
getRemoteAddr()
Returns the IP address of the agent that sent the request. |
java.lang.String |
getRemoteHost()
Returns the fully qualified host name of the agent that sent the request. |
java.lang.String |
getScheme()
Returns the scheme of the URL used in this request, for example "http", "https", or "ftp". |
java.lang.String |
getServerName()
Returns the host name of the server that received the request. |
int |
getServerPort()
Returns the port number on which this request was received. |
void |
setAttribute(java.lang.String key,
java.lang.Object o)
This method stores an attribute in the request context; these attributes will be reset between requests. |
Method Detail |
public java.lang.Object getAttribute(java.lang.String name)
name
- the name of the attribute whose value is requiredpublic java.util.Enumeration getAttributeNames()
public java.lang.String getCharacterEncoding()
public int getContentLength()
public java.lang.String getContentType()
public ServletInputStream getInputStream() throws java.io.IOException
getReader
public java.lang.String getParameter(java.lang.String name)
name
- the name of the parameter whose value is required.getParameterValues(java.lang.String)
public java.util.Enumeration getParameterNames()
public java.lang.String[] getParameterValues(java.lang.String name)
name
- the name of the parameter whose value is required.getParameter(java.lang.String)
public java.lang.String getProtocol()
<protocol>/<major version>.<minor
version>
. Same as the CGI variable SERVER_PROTOCOL.public java.lang.String getScheme()
public java.lang.String getServerName()
public int getServerPort()
public java.io.BufferedReader getReader() throws java.io.IOException
getInputStream
public java.lang.String getRemoteAddr()
public java.lang.String getRemoteHost()
public void setAttribute(java.lang.String key, java.lang.Object o)
The package (and hence attribute) names beginning with java.*, and javax.* are reserved for use by Javasoft. Similarly, com.sun.* is reserved for use by Sun Microsystems.
key
- a String specifying the name of the attributeo
- a context object stored with the key.public java.lang.String getRealPath(java.lang.String path)
path
- the virtual path to be translated to a real path
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |