|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectatg.servlet.MutableHttpServletRequest
public class MutableHttpServletRequest
This class is a wrapper around an HttpServletRequest that allows fields of the normally immutable request to be set.
| Field Summary | |
|---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
| Fields inherited from interface javax.servlet.http.HttpServletRequest |
|---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
| Constructor Summary | |
|---|---|
MutableHttpServletRequest()
Constructs a new MutableHttpServletRequest |
|
MutableHttpServletRequest(javax.servlet.http.HttpServletRequest pRequest)
Constructs a new MutableHttpServletRequest |
|
| Method Summary | |
|---|---|
java.lang.Object |
getAttribute(java.lang.String p0)
Wraps the call to getAttribute |
java.lang.Object |
getAttribute(java.lang.String p0,
boolean pCreate)
Wraps the call to getAttribute |
java.util.Enumeration |
getAttributeNames()
Returns an Enumeration containing the
names of the attributes available to this request. |
java.lang.String |
getAuthType()
Wraps the call to getAuthType |
java.lang.String |
getCharacterEncoding()
Returns the character set encoding for the input of this request. |
int |
getContentLength()
Wraps the call to getContentLength |
java.lang.String |
getContentType()
Wraps the call to getContentType |
java.lang.String |
getContextPath()
Returns the portion of the request URI that indicates the context of the request. |
javax.servlet.http.Cookie[] |
getCookies()
Gets the array of cookies found in this request. |
long |
getDateHeader(java.lang.String p0)
Wraps the call to getDateHeader |
java.lang.String |
getHeader(java.lang.String p0)
Wraps the call to getHeader |
java.util.Enumeration |
getHeaderNames()
Wraps the call to getHeaderNames |
java.util.Enumeration |
getHeaders(java.lang.String pName)
Returns all the values of the specified request header as an Enumeration of String objects. |
javax.servlet.ServletInputStream |
getInputStream()
Wraps the call to getInputStream |
int |
getIntHeader(java.lang.String p0)
Wraps the call to getIntHeader |
java.lang.String |
getLocalAddr()
|
java.util.Locale |
getLocale()
Returns the preferred Locale that the client will
accept content in, based purely 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. |
java.lang.String |
getLocalName()
|
int |
getLocalPort()
|
java.lang.String |
getMethod()
Wraps the call to getMethod |
java.lang.String |
getParameter(java.lang.String p0)
Wraps the call to getParameter |
java.util.Map |
getParameterMap()
Returns a java.util.Map of the parameters of this request. |
java.util.Enumeration |
getParameterNames()
Wraps the call to getParameterNames |
java.lang.String[] |
getParameterValues(java.lang.String p0)
Wraps the call to getParameterValues |
java.lang.String |
getPathInfo()
Wraps the call to getPathInfo |
java.lang.String |
getPathTranslated()
Wraps the call to getPathTranslated |
java.lang.Object |
getPermanentAttribute(AttributeFactory pKey)
This returns a permanent attribute value corresponding to the given key. |
java.lang.String |
getProtocol()
Wraps the call to getProtocol |
java.lang.String |
getQueryString()
Wraps the call to getQueryString |
java.io.BufferedReader |
getReader()
Returns an input stream for reading the request body. |
java.lang.String |
getRealPath(java.lang.String p0)
Wraps the call to getRealPath |
java.lang.String |
getRemoteAddr()
Wraps the call to getRemoteAddr |
java.lang.String |
getRemoteHost()
Wraps the call to getRemoteHost |
int |
getRemotePort()
|
java.lang.String |
getRemoteUser()
Wraps the call to getRemoteUser |
javax.servlet.http.HttpServletRequest |
getRequest()
Returns the request embedded by this request. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String pPath)
Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path. |
java.lang.String |
getRequestedSessionId()
Gets the session id specified with this request. |
java.lang.String |
getRequestURI()
Wraps the call to getRequestURI |
java.lang.StringBuffer |
getRequestURL()
Reconstructs the URL the client used to make the request. |
java.lang.String |
getScheme()
Wraps the call to getScheme |
java.lang.String |
getServerName()
Wraps the call to getServerName |
int |
getServerPort()
Wraps the call to getServerPort |
java.lang.String |
getServletPath()
Wraps the call to getServletPath |
javax.servlet.http.HttpSession |
getSession()
Returns the current session associated with this request, or if the request does not have a session, creates one. |
javax.servlet.http.HttpSession |
getSession(boolean create)
Gets the current valid session associated with this request, if create is false or, if necessary, creates a new session for the request, if create is true. |
java.security.Principal |
getUserPrincipal()
Returns a java.security.Principal object containing
the name of the current authenticated user. |
boolean |
isRequestedSessionIdFromCookie()
Checks whether the session id specified by this request came in as a cookie. |
boolean |
isRequestedSessionIdFromUrl()
Deprecated. |
boolean |
isRequestedSessionIdFromURL()
Checks whether the session id specified by this request came in as part of the URL. |
boolean |
isRequestedSessionIdValid()
Checks whether this request is associated with a session that is valid in the current session context. |
boolean |
isSecure()
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS |
boolean |
isUserInRole(java.lang.String pRole)
|
void |
removeAttribute(java.lang.String pName)
Removes an attribute from this request. |
void |
setAttribute(java.lang.String pName,
java.lang.Object pValue)
Sets an attribute with the given name and value. |
void |
setAttributeFactory(java.lang.String pName,
AttributeFactory pFactory)
Sets an attribute factory that will only be called if someone asks for the specified attribute. |
void |
setAuthType(java.lang.String pAuthType)
Sets the AuthType |
void |
setCharacterEncoding(java.lang.String pEncoding)
Overrides the name of the character encoding used in the body of this request. |
void |
setContentLength(int pContentLength)
Sets the ContentLength |
void |
setContentType(java.lang.String pContentType)
Sets the ContentType |
void |
setContextPath(java.lang.String pContextPath)
Sets the portion of the request URI that indicates the context of the request. |
void |
setInputStream(javax.servlet.ServletInputStream pInputStream)
Sets the InputStream |
void |
setMethod(java.lang.String pMethod)
Sets the Method |
void |
setPathInfo(java.lang.String pPathInfo)
Sets the PathInfo |
void |
setPathTranslated(java.lang.String pPathTranslated)
Sets the PathTranslated |
void |
setProtocol(java.lang.String pProtocol)
Sets the Protocol |
void |
setQueryString(java.lang.String pQueryString)
Sets the QueryString |
void |
setRemoteAddr(java.lang.String pRemoteAddr)
Sets the RemoteAddr |
void |
setRemoteHost(java.lang.String pRemoteHost)
Sets the RemoteHost |
void |
setRemoteUser(java.lang.String pRemoteUser)
Sets the RemoteUser |
void |
setRequest(javax.servlet.http.HttpServletRequest pRequest)
Sets the embedded request to be the given request. |
void |
setRequestURI(java.lang.String pRequestURI)
Sets the RequestURI |
void |
setScheme(java.lang.String pScheme)
Sets the Scheme |
void |
setServerName(java.lang.String pServerName)
Sets the ServerName |
void |
setServerPort(int pServerPort)
Sets the ServerPort |
void |
setServletPath(java.lang.String pServletPath)
Sets the ServletPath |
protected void |
swapRequest(javax.servlet.http.HttpServletRequest pRequest)
Swaps in a new underlying request object without doing a reset(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.lang.String CLASS_VERSION
| Constructor Detail |
|---|
public MutableHttpServletRequest()
public MutableHttpServletRequest(javax.servlet.http.HttpServletRequest pRequest)
pRequest - the request being wrapped| Method Detail |
|---|
public void setRequest(javax.servlet.http.HttpServletRequest pRequest)
protected void swapRequest(javax.servlet.http.HttpServletRequest pRequest)
public javax.servlet.http.HttpServletRequest getRequest()
public int getContentLength()
getContentLength in interface javax.servlet.ServletRequestpublic java.lang.String getContentType()
getContentType in interface javax.servlet.ServletRequestpublic java.lang.String getProtocol()
getProtocol in interface javax.servlet.ServletRequestpublic java.lang.String getScheme()
getScheme in interface javax.servlet.ServletRequestpublic java.lang.String getServerName()
getServerName in interface javax.servlet.ServletRequestpublic int getServerPort()
getServerPort in interface javax.servlet.ServletRequestpublic java.lang.String getRemoteAddr()
getRemoteAddr in interface javax.servlet.ServletRequestpublic java.lang.String getRemoteHost()
getRemoteHost in interface javax.servlet.ServletRequestpublic java.lang.String getRealPath(java.lang.String p0)
getRealPath in interface javax.servlet.ServletRequest
public javax.servlet.ServletInputStream getInputStream()
throws java.io.IOException
getInputStream in interface javax.servlet.ServletRequestjava.io.IOExceptionpublic java.lang.String getParameter(java.lang.String p0)
getParameter in interface javax.servlet.ServletRequestpublic java.lang.String[] getParameterValues(java.lang.String p0)
getParameterValues in interface javax.servlet.ServletRequestpublic java.util.Enumeration getParameterNames()
getParameterNames in interface javax.servlet.ServletRequestpublic java.util.Map getParameterMap()
getParameterMap in interface javax.servlet.ServletRequestpublic java.lang.Object getAttribute(java.lang.String p0)
getAttribute in interface javax.servlet.ServletRequest
public java.lang.Object getAttribute(java.lang.String p0,
boolean pCreate)
public java.util.Enumeration getAttributeNames()
Enumeration 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 interface javax.servlet.ServletRequestEnumeration of strings
containing the names
of the request's attributespublic java.lang.String getMethod()
getMethod in interface javax.servlet.http.HttpServletRequestpublic java.lang.String getRequestURI()
getRequestURI in interface javax.servlet.http.HttpServletRequestpublic java.lang.StringBuffer getRequestURL()
Because this method returns a StringBuffer,
not a string, you can modify the URL easily, for example,
to append query parameters.
This method is useful for creating redirect messages and for reporting errors.
getRequestURL in interface javax.servlet.http.HttpServletRequestStringBuffer object containing
the reconstructed URLpublic java.lang.String getServletPath()
getServletPath in interface javax.servlet.http.HttpServletRequestpublic java.lang.String getPathInfo()
getPathInfo in interface javax.servlet.http.HttpServletRequestpublic java.lang.String getPathTranslated()
getPathTranslated in interface javax.servlet.http.HttpServletRequestpublic java.lang.String getContextPath()
getContextPath in interface javax.servlet.http.HttpServletRequestString specifying the portion of the request
URI that indicates the context of the request.public java.lang.String getQueryString()
getQueryString in interface javax.servlet.http.HttpServletRequestpublic java.lang.String getRemoteUser()
getRemoteUser in interface javax.servlet.http.HttpServletRequestpublic java.lang.String getAuthType()
getAuthType in interface javax.servlet.http.HttpServletRequestpublic java.lang.String getHeader(java.lang.String p0)
getHeader in interface javax.servlet.http.HttpServletRequestpublic int getIntHeader(java.lang.String p0)
getIntHeader in interface javax.servlet.http.HttpServletRequestpublic long getDateHeader(java.lang.String p0)
getDateHeader in interface javax.servlet.http.HttpServletRequestpublic java.util.Enumeration getHeaderNames()
getHeaderNames in interface javax.servlet.http.HttpServletRequestpublic java.util.Enumeration getHeaders(java.lang.String pName)
Enumeration 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 interface javax.servlet.http.HttpServletRequestpName - a String specifying the header
name
Enumeration containing the
values of the requested header, or an empty Enumeration
if the request does not have any headers of that name.public void setContentLength(int pContentLength)
public void setContentType(java.lang.String pContentType)
public void setProtocol(java.lang.String pProtocol)
public void setScheme(java.lang.String pScheme)
public void setServerName(java.lang.String pServerName)
public void setServerPort(int pServerPort)
public void setRemoteAddr(java.lang.String pRemoteAddr)
public void setRemoteHost(java.lang.String pRemoteHost)
public void setInputStream(javax.servlet.ServletInputStream pInputStream)
public void setMethod(java.lang.String pMethod)
public void setRequestURI(java.lang.String pRequestURI)
public void setServletPath(java.lang.String pServletPath)
public void setPathInfo(java.lang.String pPathInfo)
public void setPathTranslated(java.lang.String pPathTranslated)
public void setQueryString(java.lang.String pQueryString)
public void setRemoteUser(java.lang.String pRemoteUser)
public void setAuthType(java.lang.String pAuthType)
public void setContextPath(java.lang.String pContextPath)
public java.lang.Object getPermanentAttribute(AttributeFactory pKey)
public void setAttribute(java.lang.String pName,
java.lang.Object pValue)
setAttribute in interface javax.servlet.ServletRequestpublic void removeAttribute(java.lang.String pName)
java.*,
javax.*, and com.sun.*, are
reserved for use by Sun Microsystems.
removeAttribute in interface javax.servlet.ServletRequestpName - a String specifying
the name of the attribute to remove
public void setAttributeFactory(java.lang.String pName,
AttributeFactory pFactory)
public javax.servlet.http.Cookie[] getCookies()
getCookies in interface javax.servlet.http.HttpServletRequestpublic javax.servlet.http.HttpSession getSession(boolean create)
Note: to ensure the session is properly maintained, the servlet developer must call this method (at least once) before any output is written to the response.
Additionally, application-writers need to be aware that newly
created sessions (that is, sessions for which
HttpSession.isNew returns true) do not have any
application-specific state.
getSession in interface javax.servlet.http.HttpServletRequestpublic javax.servlet.http.HttpSession getSession()
getSession in interface javax.servlet.http.HttpServletRequestHttpSession associated
with this requestpublic java.lang.String getRequestedSessionId()
getRequestedSessionId in interface javax.servlet.http.HttpServletRequestisRequestedSessionIdValid()public boolean isRequestedSessionIdValid()
getSession method.
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequestgetRequestedSessionId(),
HttpSessionContext,
getSession(boolean)public boolean isRequestedSessionIdFromCookie()
getSession method.)
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequestgetSession(boolean)public boolean isRequestedSessionIdFromUrl()
getSession method.)
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequestgetSession(boolean),
isRequestedSessionIdFromURL()public boolean isRequestedSessionIdFromURL()
getSession method.)
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequestgetSession(boolean)
public java.io.BufferedReader getReader()
throws java.io.IOException
getReader in interface javax.servlet.ServletRequestjava.io.IOExceptionpublic java.lang.String getCharacterEncoding()
getCharacterEncoding in interface javax.servlet.ServletRequest
public void setCharacterEncoding(java.lang.String pEncoding)
throws java.io.UnsupportedEncodingException
setCharacterEncoding in interface javax.servlet.ServletRequesta - String containing the name of
the chararacter encoding.
java.io.UnsupportedEncodingException - if this is not a valid encodingpublic boolean isUserInRole(java.lang.String pRole)
isUserInRole in interface javax.servlet.http.HttpServletRequestpublic java.security.Principal getUserPrincipal()
java.security.Principal object containing
the name of the current authenticated user. If the user has not been
authenticated, the method returns null.
getUserPrincipal in interface javax.servlet.http.HttpServletRequestjava.security.Principal containing
the name of the user making this request; null if
the user has not been authenticatedpublic boolean isSecure()
isSecure in interface javax.servlet.ServletRequestpublic java.util.Locale getLocale()
Locale that the client will
accept content in, based purely on the Accept-Language header.
getLocale in interface javax.servlet.ServletRequestLocale for the client.public java.util.Enumeration getLocales()
Enumeration of Locale objects
indicating, in decreasing order starting with the preferred locale, the
locales that are acceptable to the client.
getLocales in interface javax.servlet.ServletRequestEnumeration of preferred Locale
objects for the clientpublic javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String pPath)
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
ServletContext.getRequestDispatcher(java.lang.String) is that
this method can take a relative path.
getRequestDispatcher in interface javax.servlet.ServletRequestpPath - a String specifying the pathname to the resource
RequestDispatcher object that acts as a wrapper for
the resource at the specified path.public java.lang.String getLocalAddr()
getLocalAddr in interface javax.servlet.ServletRequestpublic java.lang.String getLocalName()
getLocalName in interface javax.servlet.ServletRequestpublic int getLocalPort()
getLocalPort in interface javax.servlet.ServletRequestpublic int getRemotePort()
getRemotePort in interface javax.servlet.ServletRequest
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||