public class TLcdHttpServletRequestKVPRequestWrapper extends Object implements ILcdRequest
HttpServletRequest
objects.Constructor and Description |
---|
TLcdHttpServletRequestKVPRequestWrapper(javax.servlet.http.HttpServletRequest aHttpServletRequest)
Creates a wrapper object for KVP requests.
|
Modifier and Type | Method and Description |
---|---|
String |
getApplicationPath()
Delegates to the corresponding method in
HttpServletRequest . |
Object |
getAttribute(String aAttributeName)
Delegates to the corresponding method in
HttpServletRequest . |
Enumeration<String> |
getAttributeNames()
Delegates to the corresponding method in
HttpServletRequest . |
String |
getContentType()
Returns the MIME type of the body of the request, or
null if the type is not known. |
String |
getContextPath()
Delegates to the corresponding method in
HttpServletRequest . |
long |
getDateHeader(String aName)
Returns the value of the specified request header as a long value that
represents a Date object.
|
String |
getHeader(String aName)
Returns the value of the specified request header as a String.
|
Enumeration |
getHeaderNames()
Returns an enumeration of all the header names this request contains.
|
Enumeration |
getHeaders(String aName)
Returns all the values of the specified request header as an Enumeration
of String objects.
|
javax.servlet.http.HttpServletRequest |
getHttpServletRequest() |
InputStream |
getInputStream()
Returns the body of the request as an input stream.
|
int |
getIntHeader(String aName)
Returns the value of the specified request header as an int.
|
String |
getParameter(String aParameterName)
Returns the value of the parameter with the given name.
|
String |
getParameterIgnoreCase(String aParameterName)
A case-insensitive version of
getParameter() . |
List<String> |
getParameterNames()
Returns an unmodifiable list containing the names of all the parameters that
are specified in this request.
|
String |
getProtocol()
Delegates to the corresponding method in
HttpServletRequest . |
String |
getScheme()
Delegates to the corresponding method in
HttpServletRequest . |
String |
getServerName()
Delegates to the corresponding method in
HttpServletRequest . |
int |
getServerPort()
Delegates to the corresponding method in
HttpServletRequest . |
Principal |
getUserPrincipal()
Returns a
java.security.Principal object containing the name
of the current authenticated user. |
boolean |
isUserInRole(String aRole)
Returns a boolean indicating whether the authenticated user is included
in the specified logical "role".
|
void |
removeAttribute(String aAttributeName)
Delegates to the corresponding method in
HttpServletRequest . |
void |
setAttribute(String aAttributeName,
Object aAttributeObject)
Delegates to the corresponding method in
HttpServletRequest . |
public TLcdHttpServletRequestKVPRequestWrapper(javax.servlet.http.HttpServletRequest aHttpServletRequest)
aHttpServletRequest
- The HttpServletRequest
object around which to build a wrapper.public String getParameter(String aParameterName)
getParameter
in interface ILcdRequest
aParameterName
- the parameter namepublic List<String> getParameterNames()
getParameterNames
in interface ILcdRequest
public String getParameterIgnoreCase(String aParameterName)
getParameter()
. Only valid for KVP requests.getParameterIgnoreCase
in interface ILcdRequest
aParameterName
- the parameter namepublic String getProtocol()
HttpServletRequest
.getProtocol
in interface ILcdRequest
public String getScheme()
HttpServletRequest
.getScheme
in interface ILcdRequest
public String getServerName()
HttpServletRequest
.getServerName
in interface ILcdRequest
public int getServerPort()
HttpServletRequest
.getServerPort
in interface ILcdRequest
public String getContextPath()
HttpServletRequest
.getContextPath
in interface ILcdRequest
public String getApplicationPath()
HttpServletRequest
.getApplicationPath
in interface ILcdRequest
public Object getAttribute(String aAttributeName)
HttpServletRequest
.getAttribute
in interface ILcdRequest
aAttributeName
- the name of the attribute.public Enumeration<String> getAttributeNames()
HttpServletRequest
.getAttributeNames
in interface ILcdRequest
Enumeration
of strings containing the names of the request's attributespublic void removeAttribute(String aAttributeName)
HttpServletRequest
.removeAttribute
in interface ILcdRequest
aAttributeName
- the name of the attribute.public void setAttribute(String aAttributeName, Object aAttributeObject)
HttpServletRequest
.setAttribute
in interface ILcdRequest
aAttributeName
- the name of the attribute.aAttributeObject
- the value of the attribute.public String getHeader(String aName)
getHeader
in interface ILcdRequest
aName
- a String specifying the header namepublic Enumeration getHeaders(String aName)
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.
aName
- a String specifying the header namepublic Enumeration getHeaderNames()
Some servlet containers do not allow do not allow servlets to access headers using this method, in which case this method returns null
public int getIntHeader(String aName)
The header name is case insensitive.
aName
- a String specifying the name of a request headerNumberFormatException
- If the header value can't be converted to an intpublic long getDateHeader(String aName)
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 throws an IllegalArgumentException.
getDateHeader
in interface ILcdRequest
aName
- a String specifying the name of the headerIllegalArgumentException
- If the header value can't be converted to a datepublic Principal getUserPrincipal()
ILcdRequest
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 ILcdRequest
java.security.Principal
containing the name of the
user making this request; null
if the user has not
been authenticatedHttpServletRequest.getUserPrincipal()
public boolean isUserInRole(String aRole)
ILcdRequest
false
.isUserInRole
in interface ILcdRequest
aRole
- a String
specifying the name of the roleboolean
indicating whether the user making this
request belongs to a given role; false
if the user
has not been authenticatedHttpServletRequest.isUserInRole(String)
public String getContentType()
ILcdRequest
null
if the type is not known.getContentType
in interface ILcdRequest
String
with the MIME type of the request, or null if the type is not known.TLcdServletUtil.isXMLRequest(ILcdRequest)
,
TLcdServletUtil.isKVPRequest(ILcdRequest)
public InputStream getInputStream() throws IOException
ILcdRequest
InputStream.mark(int)
and thus return true
for InputStream.markSupported()
.
This is important as the command dispatcher needs to take a peek into the request to determine which request handler knows to deal with the client request.
getInputStream
in interface ILcdRequest
IOException
- if an input exception occurs.public javax.servlet.http.HttpServletRequest getHttpServletRequest()