|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.messagelet.impl.ServletRequestImpl
public class ServletRequestImpl
Based on the RequestBase code from Catalina.
Field Summary | |
---|---|
protected HashMap |
attributes
The attributes associated with this Request, keyed by attribute name. |
protected String |
authorization
The authorization credentials sent with this Request. |
protected String |
characterEncoding
The character encoding for this Request. |
protected int |
contentLength
The content length associated with this request. |
protected String |
contentType
The content type associated with this request. |
protected static Locale |
defaultLocale
The default Locale if none are specified. |
protected InputStream |
input
The input stream associated with this Request. |
protected ArrayList |
locales
The preferred Locales assocaited with this Request. |
protected String |
protocol
The protocol name and version associated with this Request. |
protected BufferedReader |
reader
The reader that has been returned by getReader , if any. |
protected String |
remoteAddr
The remote address associated with this request. |
protected String |
remoteHost
The fully qualified name of the remote host. |
protected String |
scheme
The scheme associated with this Request. |
protected boolean |
secure
Was this request received on a secure connection? |
protected String |
serverName
The server name associated with this Request. |
protected int |
serverPort
The server port associated with this Request. |
protected javax.servlet.ServletContext |
servletContext
The ServletContext which is used to dispatch further requests |
protected javax.servlet.ServletInputStream |
stream
The ServletInputStream that has been returned by getInputStream() , if any. |
Constructor Summary | |
---|---|
ServletRequestImpl(javax.servlet.ServletContext servletContext)
|
Method Summary | |
---|---|
void |
addLocale(Locale locale)
Add a Locale to the set of preferred Locales for this Request. |
javax.servlet.ServletInputStream |
createInputStream()
Create and return a ServletInputStream to read the content associated with this Request. |
void |
finishRequest()
Perform whatever actions are required to flush and close the input stream or reader, in a single operation. |
Object |
getAttribute(String name)
Return the specified request attribute if it exists; otherwise, return null . |
Enumeration |
getAttributeNames()
Return the names of all request attributes for this Request, or an empty Enumeration if there are none. |
String |
getCharacterEncoding()
Return the character encoding for this Request. |
int |
getContentLength()
Return the content length for this Request. |
String |
getContentType()
Return the content type for this Request. |
javax.servlet.ServletInputStream |
getInputStream()
Return the servlet input stream for this Request. |
Locale |
getLocale()
Return the preferred Locale that the client will accept content in, based on the value for the first Accept-Language header
that was encountered. |
Enumeration |
getLocales()
Return the set of preferred Locales that the client will accept content in, based on the values for any Accept-Language
headers that were encountered. |
String |
getParameter(String name)
Return the value of the specified request parameter, if any; otherwise, return null . |
Map |
getParameterMap()
Returns a Map of the parameters of this request. |
Enumeration |
getParameterNames()
Return the names of all defined request parameters for this request. |
String[] |
getParameterValues(String name)
Return the defined values for the specified request parameter, if any; otherwise, return null . |
String |
getProtocol()
Return the protocol and version used to make this Request. |
BufferedReader |
getReader()
Read the Reader wrapping the input stream for this Request. |
String |
getRealPath(String path)
Deprecated. As of version 2.1 of the Java Servlet API, use ServletContext.getRealPath() . |
String |
getRemoteAddr()
Return the remote IP address making this Request. |
String |
getRemoteHost()
Return the remote host name making this Request. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(String path)
Return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative to the current request path. |
String |
getScheme()
Return the scheme used to make this Request. |
String |
getServerName()
Return the server name responding to this Request. |
int |
getServerPort()
Return the server port responding to this Request. |
InputStream |
getStream()
Return the input stream associated with this Request. |
boolean |
isSecure()
Was this request received on a secure connection? |
protected void |
log(String message)
Log a message to the current ServletContext |
protected void |
log(String message,
Throwable throwable)
Log a message to the current ServletContext |
void |
removeAttribute(String name)
Remove the specified request attribute if it exists. |
void |
setAttribute(String name,
Object value)
Set the specified request attribute to the specified value. |
void |
setCharacterEncoding(String enc)
Overrides the name of the character encoding used in the body of this request. |
void |
setContentLength(int length)
Set the content length associated with this Request. |
void |
setContentType(String type)
Set the content type (and optionally the character encoding) associated with this Request. |
void |
setProtocol(String protocol)
Set the protocol name and version associated with this Request. |
void |
setRemoteAddr(String remoteAddr)
Set the IP address of the remote client associated with this Request. |
void |
setRemoteHost(String remoteHost)
Set the fully qualified name of the remote client associated with this Request. |
void |
setScheme(String scheme)
Set the name of the scheme associated with this request. |
void |
setSecure(boolean secure)
Set the value to be returned by isSecure()
for this Request. |
void |
setServerName(String name)
Set the name of the server (virtual host) to process this request. |
void |
setServerPort(int port)
Set the port number of the server to process this request. |
void |
setStream(InputStream input)
Set the input stream associated with this Request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected HashMap attributes
protected String authorization
protected String characterEncoding
protected int contentLength
protected String contentType
protected static Locale defaultLocale
protected InputStream input
protected ArrayList locales
protected String protocol
protected BufferedReader reader
getReader
, if any.
protected String remoteAddr
protected String remoteHost
protected String scheme
protected boolean secure
protected String serverName
protected int serverPort
protected javax.servlet.ServletInputStream stream
getInputStream()
, if any.
protected javax.servlet.ServletContext servletContext
Constructor Detail |
---|
public ServletRequestImpl(javax.servlet.ServletContext servletContext)
Method Detail |
---|
public InputStream getStream()
public void setStream(InputStream input)
input
- The new input streampublic void addLocale(Locale locale)
locale
- The new preferred Localepublic javax.servlet.ServletInputStream createInputStream() throws IOException
IOException
- if an input/output error occurspublic void finishRequest() throws IOException
IOException
- if an input/output error occurspublic void setContentLength(int length)
length
- The new content lengthpublic void setContentType(String type)
text/html; charset=ISO-8859-4
.
type
- The new content typepublic void setProtocol(String protocol)
protocol
- Protocol name and versionpublic void setRemoteAddr(String remoteAddr)
remoteAddr
- The remote IP addresspublic void setRemoteHost(String remoteHost)
remoteHost
- The remote host namepublic void setScheme(String scheme)
http
, https
, and ftp
.
scheme
- The schemepublic void setSecure(boolean secure)
isSecure()
for this Request.
secure
- The new isSecure valuepublic void setServerName(String name)
name
- The server namepublic void setServerPort(int port)
port
- The server portpublic Object getAttribute(String name)
null
.
getAttribute
in interface javax.servlet.ServletRequest
name
- Name of the request attribute to returnpublic Enumeration getAttributeNames()
Enumeration
if there are none.
getAttributeNames
in interface javax.servlet.ServletRequest
public String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletRequest
public int getContentLength()
getContentLength
in interface javax.servlet.ServletRequest
public String getContentType()
getContentType
in interface javax.servlet.ServletRequest
public javax.servlet.ServletInputStream getInputStream() throws IOException
createInputStream()
.
getInputStream
in interface javax.servlet.ServletRequest
IllegalStateException
- if getReader()
has
already been called for this request
IOException
- if an input/output error occurspublic Locale getLocale()
Accept-Language
header
that was encountered. If the request did not specify a preferred
language, the server's default Locale is returned.
getLocale
in interface javax.servlet.ServletRequest
public Enumeration getLocales()
Accept-Language
headers that were encountered. If the request did not specify a
preferred language, the server's default Locale is returned.
getLocales
in interface javax.servlet.ServletRequest
public String getParameter(String name)
null
. If there is more than one value defined,
return only the first one.
getParameter
in interface javax.servlet.ServletRequest
name
- Name of the desired request parameterpublic String[] getParameterValues(String name)
null
.
getParameterValues
in interface javax.servlet.ServletRequest
name
- Name of the desired request parameterpublic Map getParameterMap()
Map
of the parameters of this request.
Request parameters are extra information sent with the request.
For HTTP servlets, parameters are contained in the query string
or posted form data.
getParameterMap
in interface javax.servlet.ServletRequest
Map
containing parameter names as keys
and parameter values as map values.public Enumeration getParameterNames()
getParameterNames
in interface javax.servlet.ServletRequest
public String getProtocol()
getProtocol
in interface javax.servlet.ServletRequest
public BufferedReader getReader() throws IOException
BufferedReader
around the
servlet input stream returned by createInputStream()
.
getReader
in interface javax.servlet.ServletRequest
IllegalStateException
- if getInputStream()
has already been called for this request
IOException
- if an input/output error occurspublic String getRealPath(String path)
ServletContext.getRealPath()
.
getRealPath
in interface javax.servlet.ServletRequest
path
- Path to be translatedpublic String getRemoteAddr()
getRemoteAddr
in interface javax.servlet.ServletRequest
public String getRemoteHost()
getRemoteHost
in interface javax.servlet.ServletRequest
public javax.servlet.RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher
in interface javax.servlet.ServletRequest
path
- Path of the resource to be wrappedpublic String getScheme()
getScheme
in interface javax.servlet.ServletRequest
public String getServerName()
getServerName
in interface javax.servlet.ServletRequest
public int getServerPort()
getServerPort
in interface javax.servlet.ServletRequest
public boolean isSecure()
isSecure
in interface javax.servlet.ServletRequest
public void removeAttribute(String name)
removeAttribute
in interface javax.servlet.ServletRequest
name
- Name of the request attribute to removepublic void setAttribute(String name, Object value)
setAttribute
in interface javax.servlet.ServletRequest
name
- Name of the request attribute to setvalue
- The associated valuepublic void setCharacterEncoding(String enc) throws UnsupportedEncodingException
getReader()
.
setCharacterEncoding
in interface javax.servlet.ServletRequest
enc
- The character encoding to be used
UnsupportedEncodingException
- if the specified encoding
is not supportedprotected void log(String message)
message
- Message to be loggedprotected void log(String message, Throwable throwable)
message
- Message to be loggedthrowable
- Associated exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |