|
PAJES 3.0.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pajes.servlet.HttpServletRequestWrapper
public class HttpServletRequestWrapper
The HttpServletRequestWrapper object extends the standard HttpServletRequest
object to provide additional functionality such as the ability to
automatically process file uploads, and the handling of encrypted query
parameters. Instances of HttpServletRequestWrapper are created by the static
create(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, int) method.
| Field Summary |
|---|
| Fields inherited from interface javax.servlet.http.HttpServletRequest |
|---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
| Method Summary | |
|---|---|
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the named attribute as an Object. |
java.util.Enumeration<?> |
getAttributeNames()
Returns an Enumeration containing the names of the
attributes available to this request. |
java.lang.String |
getAuthType()
Returns the name of the authentication scheme the server uses, for example, "BASIC" or "SSL," or null if the server does not
have an authentication scheme. |
java.lang.String |
getCharacterEncoding()
Returns the name of the character encoding style used in this request. |
int |
getContentLength()
Returns the length, in bytes, of the content contained in the request and sent by way of the input stream or -1 if the length is not known. |
java.lang.String |
getContentType()
Returns the MIME type of the content of the request, or null
if the type is not known. |
java.lang.String |
getContextPath()
Returns the portion of the request URI that indicates the context of the request. |
javax.servlet.http.Cookie[] |
getCookies()
Returns an array containing all of the Cookie objects the
browser sent with this request. |
long |
getDateHeader(java.lang.String name)
Returns the value of the specified request header as a long
value that represents a Date object. |
java.lang.String |
getHeader(java.lang.String name)
Returns the value of the specified request header as a String. |
java.util.Enumeration<?> |
getHeaderNames()
Returns an enumeration of all the header names this request contains. |
java.util.Enumeration<?> |
getHeaders(java.lang.String name)
Returns all the values of the specified request header as an Enumeration of String objects. |
javax.servlet.http.HttpServletRequest |
getHttpServletRequest()
Returns the HttpServletRequest that this object wrappers. |
javax.servlet.ServletInputStream |
getInputStream()
Retrieves binary data from the body of the request as a ServletInputStream, which gives you the ability to read one line at a time. |
int |
getIntHeader(java.lang.String name)
Returns the value of the specified request header as an integer. |
java.lang.String |
getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on which the request was received. |
java.util.Locale |
getLocale()
Returns the preferred Locale that the client will accept
content in, based 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 based on the Accept-Language
header. |
java.lang.String |
getLocalName()
Returns the host name of the Internet Protocol (IP) interface on which the request was received. |
int |
getLocalPort()
Returns the Internet Protocol (IP) port number of the interface on which the request was received. |
java.lang.String |
getMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. |
java.lang.String |
getParameter(java.lang.String name)
Returns the value of a request parameter as a String, or
null if the parameter does not exist. |
java.util.Map<?,?> |
getParameterMap()
Returns a java.util.Map of the parameters of this request. |
java.util.Enumeration<?> |
getParameterNames()
Returns an Enumeration of String objects
containing the names of the parameters contained in this request. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Returns an array of String objects containing all of the
values the given request parameter has, or null if the
parameter does not exist. |
java.lang.String |
getPathInfo()
Returns any extra path information associated with the URL the client sent when it made this request. |
java.lang.String |
getPathTranslated()
Returns any extra path information after the servlet name but before the query string, and translates it to a real path. |
java.lang.String |
getProtocol()
Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1. |
java.lang.String |
getQueryString()
Returns the query string that is contained in the request URL after the path. |
java.io.BufferedReader |
getReader()
Returns the body of the request as a BufferedReader that
translates character set encodings. |
java.lang.String |
getRealPath(java.lang.String path)
Deprecated. As of Version 2.1 of the Java Servlet API, use ServletContext.getRealPath instead. |
java.lang.String |
getRemoteAddr()
Returns the Internet Protocol (IP) address of the client that sent the request. |
java.lang.String |
getRemoteHost()
Returns the fully qualified name of the client that sent the request. |
int |
getRemotePort()
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request. |
java.lang.String |
getRemoteUser()
Returns the name of the user making this request, if the user has logged in using HTTP authentication. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String path)
Returns a RequestDispatcher object that acts as a wrapper for the
resource located at the given path. |
java.lang.String |
getRequestedSessionId()
Returns the session ID specified by the client. |
java.lang.String |
getRequestURI()
Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request. |
java.lang.StringBuffer |
getRequestURL()
Reconstructs the URL the client used to make the request. |
java.lang.String |
getScheme()
Returns the name of the scheme used to make 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. |
java.lang.String |
getServletPath()
Returns the part of this request's URL that calls the servlet. |
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)
Returns the current HttpSession associated with this
request or, if necessary, creates a new session for the request. |
UploadedFile |
getUploadedFile(java.lang.String sourceFileName)
Returns the specified uploaded file instance. |
java.util.Enumeration<java.lang.String> |
getUploadedFileNames()
Returns an Enumeration of String objects
containing the names of the files uploaded in this request. |
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 this request submitted came in as a cookie, rather than from the getSession() method. |
boolean |
isRequestedSessionIdFromUrl()
Deprecated. As of Version 2.1 of the Java Servlet API, use isRequestedSessionIdFromURL() instead. |
boolean |
isRequestedSessionIdFromURL()
Checks whether the session ID this request submitted came in as part of the request URL, rather than from the getSession() method. |
boolean |
isRequestedSessionIdValid()
Checks whether this request has a valid session in the current session context (which is a HttpSessionContext). |
boolean |
isSecure()
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS. |
boolean |
isUserInRole(java.lang.String role)
Returns a boolean indicating whether the authenticated user is included in the specified logical "role". |
void |
removeAttribute(java.lang.String name)
Removes an attribute from this request. |
void |
setAttribute(java.lang.String key,
java.lang.Object o)
Stores an attribute in the context of this request. |
void |
setCharacterEncoding(java.lang.String enc)
Overrides the name of the character encoding used in the body of this request. |
void |
setUserPrincipal(java.security.Principal principal)
Sets the authenticated user of this request. |
void |
setUserPrincipalRoles(PrincipalRoles roles)
Sets valid roles for the authenticated user of this request. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public java.lang.Object getAttribute(java.lang.String name)
Object.
This method allows the servlet engine to give the servlet custom
information about a request. This method returns null if
no attribute of the given name exists.
Attribute names should follow the same conventions as package names. This
specification reserves names matching java.,
javax., and sun..
getAttribute in interface javax.servlet.ServletRequestname - a String specifying the name of the attribute
Object containing the value of the attribute,
or null if the attribute does not existpublic 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 getAuthType()
null if the server does not
have an authentication scheme.
The authentication scheme provides a challenge-response model in which the server challenges the client, and the client provides authentication information. Same as the value of the CGI variable AUTH_TYPE.
getAuthType in interface javax.servlet.http.HttpServletRequestString specifying the name of the authentication
scheme, or null if the server does not have an
authentication schemepublic java.lang.String getCharacterEncoding()
null if the request does not use
character encoding.
getCharacterEncoding in interface javax.servlet.ServletRequestString containing the name of the chararacter
encoding style, or null if the request does not
use character encodingpublic int getContentLength()
getContentLength in interface javax.servlet.ServletRequestpublic java.lang.String getContentType()
null
if the type is not known. Same as the value of the CGI variable
CONTENT_TYPE.
getContentType in interface javax.servlet.ServletRequestString containing the name of the MIME type of
the request, or -1 if the type is not knownpublic java.lang.String getContextPath()
getContextPath in interface javax.servlet.http.HttpServletRequestString specifying the portion of the request URI
that indicates the context of the requestpublic javax.servlet.http.Cookie[] getCookies()
Cookie objects the
browser sent with this request. This method returns null
if the browser did not send any cookies.
getCookies in interface javax.servlet.http.HttpServletRequestCookies included with this
request, or null if the request has no cookiespublic long getDateHeader(java.lang.String name)
long
value that represents a Date object. Use this method with
headers that contain dates, such as If-Modified-Since.
The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive.
If the request did not have a header of the specified name, this method
returns -1. If the header can't be converted to a date, the method
returns an IllegalArgumentException.
getDateHeader in interface javax.servlet.http.HttpServletRequestname - a String specifying the name of the header
long value representing the date specified in
the header expressed as the number of milliseconds since January
1, 1970 GMT, or -1 if the named header was not included with the
reqestpublic java.lang.String getHeader(java.lang.String name)
String. If the named header wasn't sent with the request,
this method returns null. The header name is case
insensitive. You can use this method with any request header.
getHeader in interface javax.servlet.http.HttpServletRequestname - a String specifying the header name
String containing the value of the requested
header, or null if the request does not have a
header of that namepublic java.util.Enumeration<?> getHeaderNames()
Some servlet engines do not allow do not allow servlets to access headers
using this method, in which case this method returns null
getHeaderNames in interface javax.servlet.http.HttpServletRequestnullpublic java.util.Enumeration<?> getHeaders(java.lang.String name)
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.HttpServletRequestname - a String specifying the header name
Enumeration containing the values of the
requested header, or null if the request does not
have any headers of that namepublic javax.servlet.http.HttpServletRequest getHttpServletRequest()
HttpServletRequest that this object wrappers.
HttpServletRequest instance.
public javax.servlet.ServletInputStream getInputStream()
throws java.io.IOException
getInputStream in interface javax.servlet.ServletRequestjava.io.IOException - if an input or output exception occurredpublic int getIntHeader(java.lang.String name)
NumberFormatException.
The header name is case insensitive.
getIntHeader in interface javax.servlet.http.HttpServletRequestname - a String specifying the name of a request
header
public java.lang.String getLocalAddr()
getLocalAddr in interface javax.servlet.ServletRequestString containing the IP address on which the
request was received.public java.util.Locale getLocale()
Locale that the client will accept
content in, based on the Accept-Language header. If the client request
doesn't provide an Accept-Language header, this method returns the
default locale for the server.
getLocale in interface javax.servlet.ServletRequestLocale for the clientpublic 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 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.
getLocales in interface javax.servlet.ServletRequestEnumeration of preferred Locale
objects for the clientpublic java.lang.String getLocalName()
getLocalName in interface javax.servlet.ServletRequestString containing the host name of the IP on
which the request was received.public int getLocalPort()
getLocalPort in interface javax.servlet.ServletRequestpublic java.lang.String getMethod()
String is the
same as the value of the CGI variable REQUEST_METHOD.
getMethod in interface javax.servlet.http.HttpServletRequestString specifying the name of the method with
which this request was madepublic java.lang.String getParameter(java.lang.String name)
String, or
null if the parameter does not exist. Request parameters
are extra information sent with the request.
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 servlet engine determines the return value.
getParameter in interface javax.servlet.ServletRequestname - a String specifying the name of the parameter
String representing the single value of the
parametergetParameterValues(java.lang.String)public java.util.Map<?,?> getParameterMap()
getParameterMap in interface javax.servlet.ServletRequestpublic java.util.Enumeration<?> getParameterNames()
Enumeration of String objects
containing the names of the parameters contained in this request. If the
request has no parameters or if the input stream is empty, returns an
empty Enumeration. The input stream is empty when all the
data returned by getInputStream() has been read.
getParameterNames in interface javax.servlet.ServletRequestEnumeration of String objects,
each String containing the name of a request
parameter; or an empty Enumeration if the request
has no parameterspublic java.lang.String[] getParameterValues(java.lang.String name)
String objects containing all of the
values the given request parameter has, or null if the
parameter does not exist. For example, in an HTTP servlet, this method
returns an array of String objects containing the values
of a query string or posted form.
If the parameter has a single value, the array has a length of 1.
getParameterValues in interface javax.servlet.ServletRequestname - a String containing the name of the parameter
whose value is requested
String objects containing the
parameter's valuesgetParameter(java.lang.String)public java.lang.String getPathInfo()
null if there was no extra path
information.
The information this method returns is the same as the value of the CGI variable PATH_INFO.
getPathInfo in interface javax.servlet.http.HttpServletRequestString specifying extra path information that
comes after the servlet path but before the query string in the
request URL; or null if the URL does not have any
extra path informationpublic java.lang.String getPathTranslated()
If the URL does not have any extra path information, this method returns
null.
getPathTranslated in interface javax.servlet.http.HttpServletRequestString specifying the real path, or
null if the URL does not have any extra path
informationpublic java.lang.String getProtocol()
SERVER_PROTOCOL.
getProtocol in interface javax.servlet.ServletRequestString containing the protocol name and version
numberpublic java.lang.String getQueryString()
null if the URL does not have a
query string. Same as the value of the CGI variable QUERY_STRING.
getQueryString in interface javax.servlet.http.HttpServletRequestString containing the query string or
null if the URL contains no query string
public java.io.BufferedReader getReader()
throws java.io.IOException
BufferedReader that
translates character set encodings.
getReader in interface javax.servlet.ServletRequestBufferedReader containing the body of the
request
java.io.IOException - if an input or output exception occurredgetInputStream()@Deprecated public java.lang.String getRealPath(java.lang.String path)
getRealPath in interface javax.servlet.ServletRequestpath - the context path.
public java.lang.String getRemoteAddr()
REMOTE_ADDR.
getRemoteAddr in interface javax.servlet.ServletRequestString containing the IP address of the client
that sent the requestpublic java.lang.String getRemoteHost()
REMOTE_HOST.
getRemoteHost in interface javax.servlet.ServletRequestString containing the fully qualified name of
the clientpublic int getRemotePort()
getRemotePort in interface javax.servlet.ServletRequestpublic java.lang.String getRemoteUser()
null if
the user login is not authenticated. Whether the user name is sent with
each subsequent request depends on the browser. Same as the value of the
CGI variable REMOTE_USER.
getRemoteUser in interface javax.servlet.http.HttpServletRequestString specifying the name of the user making
this request, or null if the user name is not
knownpublic javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
RequestDispatcher 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 ServletContext.getRequestDispatcher(java.lang.String) is that this method can take a
relative path.
getRequestDispatcher in interface javax.servlet.ServletRequestpath - a String specifying the pathname to the
resource
RequestDispatcher object that acts as a wrapper
for the resource at the specified pathpublic java.lang.String getRequestedSessionId()
null.
getRequestedSessionId in interface javax.servlet.http.HttpServletRequestString specifying the session ID, or
null if the request did not specify a session ID.isRequestedSessionIdValid()public java.lang.String getRequestURI()
First line of HTTP request Returned Value POST /some/path.html HTTP/1.1 /some/path.html GET http://foo.bar/a.html HTTP/1.0 http://foo.bar/a.html HEAD /xyz?a=b HTTP/1.1 /xyz
To reconstruct an URL with a scheme and host, use
HttpUtils.getRequestURL, which returns a StringBuilder.
getRequestURI in interface javax.servlet.http.HttpServletRequestString containing the part of the URL from the
protocol name up to the query stringpublic java.lang.StringBuffer getRequestURL()
Because this method returns a StringBuilder, 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.HttpServletRequestStringBuilder object containing the
reconstructed URLpublic java.lang.String getScheme()
http, https, or ftp.
Different schemes have different rules for constructing URLs, as noted in
RFC 1738.
You can reconstruct the URL used to make this request by using this scheme, the server name and port, the pathname to the Web page on the server (also known as the Universal Resource Identifier), and the query string..
getScheme in interface javax.servlet.ServletRequestString containing the name of the scheme used to
make this requestpublic java.lang.String getServerName()
SERVER_NAME.
getServerName in interface javax.servlet.ServletRequestString containing the name of the server to
which the request was sentpublic int getServerPort()
SERVER_PORT.
getServerPort in interface javax.servlet.ServletRequestpublic java.lang.String getServletPath()
getServletPath in interface javax.servlet.http.HttpServletRequestString containing the name or path of the
servlet being called, as it is specified in the request URLpublic javax.servlet.http.HttpSession getSession()
getSession in interface javax.servlet.http.HttpServletRequestHttpSession associated with this requestpublic javax.servlet.http.HttpSession getSession(boolean create)
HttpSession associated with this
request or, if necessary, creates a new session for the request. Use
true for create to create a new session, or
false to return the current HttpSession.
If create is false and the request has no
valid HttpSession, this method returns null.
To make sure the session is properly maintained, you must call this
method at least once before you write any output to the response. 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.HttpServletRequestcreate - true to create a new session for this request;
false to return the current session
HttpSession associated with this request or
null if create is
false and the request has no valid sessionpublic UploadedFile getUploadedFile(java.lang.String sourceFileName)
sourceFileName - the file name of the uploaded file to be retrieved.
getUploadedFileNames()public java.util.Enumeration<java.lang.String> getUploadedFileNames()
Enumeration of String objects
containing the names of the files uploaded in this request. If the
request has no uploaded files, returns an empty Enumeration.
Enumeration of String objects,
each String containing the source file name of an
uploaded file; or an empty Enumeration if the
request has no uploaded files.getUploadedFile(java.lang.String)public 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 isRequestedSessionIdFromCookie()
getSession() method.
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequesttrue if the session ID came in as a cookie;
otherwise, false.getSession()@Deprecated public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromURL() instead.
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequesttrue if the session ID came in as part of an URL;
otherwise, false.public boolean isRequestedSessionIdFromURL()
getSession() method.
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequesttrue if the session ID came in as part of an URL;
otherwise, false.getSession()public boolean isRequestedSessionIdValid()
getSession() method never returns it.
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequesttrue if this request has a valid session in the
current session context; otherwise, false.getRequestedSessionId(),
getSession()public boolean isSecure()
isSecure in interface javax.servlet.ServletRequestpublic boolean isUserInRole(java.lang.String role)
false.
isUserInRole in interface javax.servlet.http.HttpServletRequestrole - a String specifying the name of the role
boolean indicating whether the user making this
request belongs to a given role; false if the user
has not been authenticatedpublic void removeAttribute(java.lang.String name)
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.
removeAttribute in interface javax.servlet.ServletRequestname - a String specifying the name of the attribute
to remove
public void setAttribute(java.lang.String key,
java.lang.Object o)
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.
setAttribute in interface javax.servlet.ServletRequestkey - a String specifying the name of the attributeo - an Object containing the context of the request
public void setCharacterEncoding(java.lang.String enc)
throws java.io.UnsupportedEncodingException
setCharacterEncoding in interface javax.servlet.ServletRequestenc - a String containing the name of the chararacter
encoding.
java.io.UnsupportedEncodingException - if this is not a valid encodingpublic void setUserPrincipal(java.security.Principal principal)
principal - a java.security.Principal containing the name
of the user making this requestpublic void setUserPrincipalRoles(PrincipalRoles roles)
roles - a org.pajes.security.PrincipalRoles instance
containing the valid roles for the user making this request;public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()
|
PAJES 3.0.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||