Does not inherit
#include rwsf/servlet/ServletRequest.h
rwsf::ServletRequest encapsulates a request from a client. The Agent constructs an instance of this class for each request. The Agent populates the object with the details of the client request. The request object also contains an attribute collection that stores data created by objects in the Agent. For example, a filter might preprocess part of the request and store the results in an attribute for use by a servlet.
The following table lists methods that are either non-standard or not supported at this release.
getLocale() |
not supported in this release. |
getParameterMap() |
not supported in this release. |
getPayload() |
added method. |
getReader() |
not supported in this release. |
virtual ~ServletRequest();
Destructor.
rwsf::Attribute getAttribute(const std::string & name) const;
Returns the specified attribute. Attribute name comparisons are case sensitive. If the named attribute is not found, returns an empty attribute.
rwsf::Enumeration< std::string > getAttributeNames() const;
Returns an enumeration of all attribute names in this request. When the request contains no attributes, returns an empty enumeration.
std::string getCharacterEncoding() const;
Returns the character encoding specified in the Content-Type of the request, or ISO-8859-1 if the Content-Type does not specify a character encoding.
int getContentLength() const;
Returns the content length of the request payload, or -1 if the Agent cannot determine the length.
std::string getContentType() const;
Returns the Content-Type of the request. When the request has no content type, returns the empty string.
std::string getParameter(const std::string & name) const;
Returns the named request parameter. Request parameters are extra data sent with the request. For HTTP, request parameters are typically encoded in the URL or available in the POST body. If the parameter has more than one value, this method returns the first value. Use getParameterValues to get all of the values for the named parameter. If the parameter does not exist, returns the empty string.
rwsf::Enumeration< std::string > getParameterNames() const;
Returns an enumeration of all parameter names in this request. Returns an empty enumeration when the request contains no parameters.
std::list< std::string > getParameterValues(const std::string & name) const;
Returns the list of values for the named request parameter. When the parameter has only one value, returns a list with one element. When the named parameter does not exist, returns an empty list.
std::string getPayload() const;
Returns the body of the request. When the request has no body, returns an empty string.
std::string getProtocol() const;
Returns the request protocol. For HTTP this will typically return HTTP/1.1
std::string getRemoteAddr() const;
Returns the internet address of the client sending the request. When the client address is unknown, returns an empty string.
std::string getRemoteHost() const;
Returns the host name of the client sending the request. If the name is unknown, returns an empty string.
rwsf::RequestDispatcher getRequestDispatcher(const std::string & path);
Returns a request dispatcher for the path specified. The path can indicate either a local path to a servlet within the same context, a local path to a static page within the same context, or a complete HTTP URL.
std::string getScheme() const;
Returns the protocol scheme for this request, for example, http or https.
std::string getServerName() const;
Returns the name of the server processing this request.
int getServerPort() const;
Returns the port on the server processing this request.
bool isSecure() const;
Returns true if the HTTP request arrived over a secure protocol, false otherwise.
rwsf::Attribute removeAttribute(const std::string & name);
Removes the attribute from this request, returns the attribute. If the attribute cannot be found, returns an empty attribute.
void setAttribute(const std::string & name, const rwsf::Attribute & value);
Sets the named attribute to the value provided. If the attribute already exists, its value is replaced with the new value.
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.