ServletRequest object and passes
it as an argument to the servlet's service method.
A ServletRequest object provides data including
parameter name and values, attributes, and an input stream.
Interfaces that extend ServletRequest can provide
additional protocol-specific data (for example, HTTP data is
provided by .
javax.servlet.http.HttpServletRequest
javax.servlet.http.HttpServletRequestObject,
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
. This allows information to be
embedded into a request before a setAttribute(java.lang.String,java.lang.Object) call.
RequestDispatcher
Attribute names should follow the same conventions as package
names. This specification reserves names matching java.*,
javax.*, and sun.*.
name a String specifying the name of
the attributeObject containing the value
of the attribute, or null if
the attribute does not existServletInputStream. Either this method or
getReader() may be called to read the body, not both.
ServletInputStream object containing
the body of the requestjava.lang.IllegalStateException if the getReader() method
has already been called for this requestjava.io.IOException if an input or output exception occurredString,
or null if the parameter does not exist. Request parameters
are extra information sent with the request. For HTTP servlets,
parameters are contained in the query string or posted form data.
You should only use this method when you are sure the
parameter has only one value. If the parameter might have
more than one value, use .
getParameterValues(java.lang.String)
If you use this method with a multivalued
parameter, the value returned is equal to the first value
in the array returned by getParameterValues.
If the parameter data was sent in the request body, such as occurs
with an HTTP POST request, then reading the body directly via or getInputStream() can interfere
with the execution of this method.
getReader()
name a String specifying the
name of the parameterString representing the
single value of the parametergetParameterValues(java.lang.String)Enumeration of String
objects containing the names of the parameters contained
in this request. If the request has
no parameters, the method returns an
empty Enumeration.
Enumeration of String
objects, each String containing
the name of a request parameter; or an
empty Enumeration if the
request has no parametersString objects containing
all of the values the given request parameter has, or
null if the parameter does not exist.
If the parameter has a single value, the array has a length of 1.
name a String containing the name of
the parameter whose value is requestedString objects
containing the parameter's valuesgetParameter(java.lang.String)BufferedReader. The reader translates the character
data according to the character encoding used on the body.
Either this method or getReader() may be called to read the
body, not both.
BufferedReader
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 getInputStream() method
has been called on this requestjava.io.IOException if an input or output exception occurredgetInputStream()RequestDispatcher.
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.
name a String specifying
the name of the attributeo the Object to be storedAttribute names should follow the same conventions as
package names. Names beginning with java.*,
javax.*, and com.sun.*, are
reserved for use by Sun Microsystems.
name a String specifying
the name of the attribute to removeEnumeration 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.
Enumeration of preferred
Locale objects for the clientRequestDispatcher object that acts as a wrapper for
the resource located at the given path.
A RequestDispatcher object can be used to forward
a request to the resource or to include the resource in a response.
The resource can be dynamic or static.
The pathname specified may be relative, although it cannot extend
outside the current servlet context. If the path begins with
a "/" it is interpreted as relative to the current context root.
This method returns null if the servlet container
cannot return a RequestDispatcher.
The difference between this method and is that this method can take a
relative path.
ServletContext.getRequestDispatcher(java.lang.String)
path a String specifying the pathname
to the resourceRequestDispatcher object
that acts as a wrapper for the resource
at the specified pathRequestDispatcherServletContext.getRequestDispatcher(java.lang.String)ServletContext.getRealPath(java.lang.String) instead.