Class TLcdHttpServletRequestKVPRequestWrapper
- All Implemented Interfaces:
ILcdRequest
HttpServletRequest
objects.-
Constructor Summary
ConstructorDescriptionTLcdHttpServletRequestKVPRequestWrapper
(jakarta.servlet.http.HttpServletRequest aHttpServletRequest) Creates a wrapper object for KVP requests. -
Method Summary
Modifier and TypeMethodDescriptionDelegates to the corresponding method inHttpServletRequest
.getAttribute
(String aAttributeName) Delegates to the corresponding method inHttpServletRequest
.Delegates to the corresponding method inHttpServletRequest
.Returns the MIME type of the body of the request, ornull
if the type is not known.Delegates to the corresponding method inHttpServletRequest
.long
getDateHeader
(String aName) Returns the value of the specified request header as a long value that represents a Date object.Returns the value of the specified request header as a String.Returns an enumeration of all the header names this request contains.getHeaders
(String aName) Returns all the values of the specified request header as an Enumeration of String objects.jakarta.servlet.http.HttpServletRequest
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.getParameter
(String aParameterName) Returns the value of the parameter with the given name.getParameterIgnoreCase
(String aParameterName) A case-insensitive version ofgetParameter()
.Returns an unmodifiable list containing the names of all the parameters that are specified in this request.Delegates to the corresponding method inHttpServletRequest
.Delegates to the corresponding method inHttpServletRequest
.Delegates to the corresponding method inHttpServletRequest
.int
Delegates to the corresponding method inHttpServletRequest
.Returns ajava.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 inHttpServletRequest
.void
setAttribute
(String aAttributeName, Object aAttributeObject) Delegates to the corresponding method inHttpServletRequest
.
-
Constructor Details
-
TLcdHttpServletRequestKVPRequestWrapper
public TLcdHttpServletRequestKVPRequestWrapper(jakarta.servlet.http.HttpServletRequest aHttpServletRequest) Creates a wrapper object for KVP requests.- Parameters:
aHttpServletRequest
- TheHttpServletRequest
object around which to build a wrapper.
-
-
Method Details
-
getParameter
Returns the value of the parameter with the given name. Only valid for KVP requests.- Specified by:
getParameter
in interfaceILcdRequest
- Parameters:
aParameterName
- the parameter name- Returns:
- the value of the specified parameter or null if the parameter was not specified
-
getParameterNames
Returns an unmodifiable list containing the names of all the parameters that are specified in this request. Only valid for KVP requests.- Specified by:
getParameterNames
in interfaceILcdRequest
- Returns:
- a list of parameter names.
-
getParameterIgnoreCase
A case-insensitive version ofgetParameter()
. Only valid for KVP requests.- Specified by:
getParameterIgnoreCase
in interfaceILcdRequest
- Parameters:
aParameterName
- the parameter name- Returns:
- the value of the specified parameter or null if the parameter was not specified
-
getProtocol
Delegates to the corresponding method inHttpServletRequest
.- Specified by:
getProtocol
in interfaceILcdRequest
-
getScheme
Delegates to the corresponding method inHttpServletRequest
.- Specified by:
getScheme
in interfaceILcdRequest
-
getServerName
Delegates to the corresponding method inHttpServletRequest
.- Specified by:
getServerName
in interfaceILcdRequest
-
getServerPort
public int getServerPort()Delegates to the corresponding method inHttpServletRequest
.- Specified by:
getServerPort
in interfaceILcdRequest
-
getContextPath
Delegates to the corresponding method inHttpServletRequest
.- Specified by:
getContextPath
in interfaceILcdRequest
-
getApplicationPath
Delegates to the corresponding method inHttpServletRequest
.- Specified by:
getApplicationPath
in interfaceILcdRequest
-
getAttribute
Delegates to the corresponding method inHttpServletRequest
.- Specified by:
getAttribute
in interfaceILcdRequest
- Parameters:
aAttributeName
- the name of the attribute.- Returns:
- the attribute value.
-
getAttributeNames
Delegates to the corresponding method inHttpServletRequest
.- Specified by:
getAttributeNames
in interfaceILcdRequest
- Returns:
- an
Enumeration
of strings containing the names of the request's attributes
-
removeAttribute
Delegates to the corresponding method inHttpServletRequest
.- Specified by:
removeAttribute
in interfaceILcdRequest
- Parameters:
aAttributeName
- the name of the attribute.
-
setAttribute
Delegates to the corresponding method inHttpServletRequest
.- Specified by:
setAttribute
in interfaceILcdRequest
- Parameters:
aAttributeName
- the name of the attribute.aAttributeObject
- the value of the attribute.
-
getHeader
Returns the value of the specified request header as a String. If the request did not include a header of the specified name, this method returns null. The header name is case insensitive. You can use this method with any request header.- Specified by:
getHeader
in interfaceILcdRequest
- Parameters:
aName
- a String specifying the header name- Returns:
- a String containing the value of the requested header, or null if the request does not have a header of that name
-
getHeaders
Returns all the values of the specified request header as an 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.
- Parameters:
aName
- a String specifying the header name- Returns:
- an Enumeration containing the values of the requested header. If the request does not have any headers of that name return an empty enumeration. If the container does not allow access to header information, return null
-
getHeaderNames
Returns an enumeration of all the header names this request contains. If the request has no headers, this method returns an empty enumeration.Some servlet containers do not allow do not allow servlets to access headers using this method, in which case this method returns null
- Returns:
- an enumeration of all the header names sent with this request; if the request has no headers, an empty enumeration; if the servlet container does not allow servlets to use this method, null
-
getIntHeader
Returns the value of the specified request header as an int. If the request does not have a header of the specified name, this method returns -1. If the header cannot be converted to an integer, this method throws a NumberFormatException.The header name is case insensitive.
- Parameters:
aName
- a String specifying the name of a request header- Returns:
- an integer expressing the value of the request header or -1 if the request doesn't have a header of this name
- Throws:
NumberFormatException
- If the header value can't be converted to an int
-
getDateHeader
Returns the value of the specified request header as a long value that represents a Date object. Use this method with headers that contain dates, such asIf-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.
- Specified by:
getDateHeader
in interfaceILcdRequest
- Parameters:
aName
- a String specifying the name of the header- Returns:
- a 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 reqest
- Throws:
IllegalArgumentException
- If the header value can't be converted to a date
-
getUserPrincipal
Description copied from interface:ILcdRequest
Returns ajava.security.Principal
object containing the name of the current authenticated user. If the user has not been authenticated, the method returnsnull
.- Specified by:
getUserPrincipal
in interfaceILcdRequest
- Returns:
- a
java.security.Principal
containing the name of the user making this request;null
if the user has not been authenticated - See Also:
-
isUserInRole
Description copied from interface:ILcdRequest
Returns a boolean indicating whether the authenticated user is included in the specified logical "role". Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method returnsfalse
.- Specified by:
isUserInRole
in interfaceILcdRequest
- Parameters:
aRole
- aString
specifying the name of the role- Returns:
- a
boolean
indicating whether the user making this request belongs to a given role;false
if the user has not been authenticated - See Also:
-
getContentType
Description copied from interface:ILcdRequest
Returns the MIME type of the body of the request, ornull
if the type is not known.- Specified by:
getContentType
in interfaceILcdRequest
- Returns:
- the
String
with the MIME type of the request, or null if the type is not known. - See Also:
-
getInputStream
Description copied from interface:ILcdRequest
Returns the body of the request as an input stream. The returned input stream must support the methodInputStream.mark(int)
and thus returntrue
forInputStream.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.
- Specified by:
getInputStream
in interfaceILcdRequest
- Returns:
- the body of the request as an input stream.
- Throws:
IOException
- if an input exception occurs.
-
getHttpServletRequest
public jakarta.servlet.http.HttpServletRequest getHttpServletRequest()
-