Whenever the server receives a request it creates a ServletRequest object,
puts all the request information in it and passes this along with
a ServletResponse object to the approriate servlet.
getAttribute
public Object getAttribute(String name)
Gets a named attribute's value.
This gives one of the initialization attribute values.
Note that the Servlet 2.1 API Documentation mentions some predefined
attribute names, but the Servlet Spec does not mention them.
I (MJW) am not sure if they are platform specific (JWS) or not.
- The value of the attribute, null if not found.
getAttributeNames
public Enumeration getAttributeNames()
Gets an Enumeration of all the attribute names.
- The Enumeration of all attribute names set in this request.
getCharacterEncoding
public String getCharacterEncoding()
Gets the character encoding of the request data.
- Character encoding or null if the encoding is unavailable
getContentLength
public int getContentLength()
Gets the size in bytes of the request
- the number of bytes in the request
or -1 if not known
getContentType
public String getContentType()
Gets the mime type of the request
- a String containing the mime type of the request
or null if not known
getInputStream
public ServletInputStream getInputStream()
throws IOException
Creates an inputstream for servlets to read client request data from.
getLocale
public java.util.Locale getLocale()
XXX
getLocales
public Enumeration getLocales()
XXX
getParameter
public String getParameter(String name)
Gets the value of a named requestparameter.
If the parameter can have more than one value
getParameterValues
should be used.
If there are more than one values associated with the parameter this
method will only return the first value as return by
getParameterValues
is returned.
see javax.servlet.ServletRequest.getParameterValues()
name
- the name of the parameter whose value we want
- the (first) value of the parameter or null if not present
getParameterNames
public Enumeration getParameterNames()
Gets all parameter names.
Note that the Servlet API 2.1 documentation says that this returns
an empty Enumeration if the input stream is empty, but this is not
mandated by the Servlet Spec.
- an enumeration containing all parameter names
getParameterValues
public String[] getParameterValues(String name)
Gets an array of Strings containing all the request parameter's
values whose name matches name
.
- the array containing all the values or null if not present
getProtocol
public String getProtocol()
Gets the protocol of the request as Proto/Major.Minor
("HTTP/1.1").
- A string containing the protocol name
getReader
public BufferedReader getReader()
throws IOException
Creates an BufferedReader for servlets to read client request
data from.
- The created BufferedReader
getRealPath
public String getRealPath(String path)
Should use getRealPath from the current ServletContext.
Translates the given path to the real path on the servers
filesystem, using the servers documentroot.
path
- the path which requires translating
javax.servlet.ServletContext.getRealPath(java.lang.String)
getRemoteAddr
public String getRemoteAddr()
Gets the ip address of the client that sent the request
getRemoteHost
public String getRemoteHost()
Gets the hostname of the client that sent the request.
This is either a fully qualified host name or a string representing
the remote IP address.
getScheme
public String getScheme()
Gets the scheme of the request as defined by RFC 1783
("ftp", "http", "gopher", "news").
- A String containing the scheme
getServerName
public String getServerName()
Get the name of the server receiving the request
getServerPort
public int getServerPort()
Gets the portnumber the server reveiving the request is running on.
isSecure
public boolean isSecure()
XXX
removeAttribute
public void removeAttribute(String name)
XXX
setAttribute
public void setAttribute(String name,
Object o)
Puts a named object into the ServletRequest
.
Can be used to communicate with other servlets if this
ServletRequest
is passed to another servlet through a
RequestDispatcher
.
The names used must follow the conventions used for naming java
packages.
name
- - which is used to refer to this object