HydraExpress™ C++ API Reference Guide

Product Documentation:
   HydraExpress C++
Documentation Home
List of all members | Public Member Functions
rwsf::ServletRequest Class Reference

Encapsulates a client request object. More...

#include <rwsf/servlet/ServletRequest.h>

Inheritance diagram for rwsf::ServletRequest:
rwsf::HttpServletRequest

Public Member Functions

virtual ~ServletRequest ()
 
rwsf::Attribute getAttribute (const std::string &name) const
 
rwsf::Enumeration< std::string > getAttributeNames () const
 
std::string getCharacterEncoding () const
 
int getContentLength () const
 
std::string getContentType () const
 
std::string getParameter (const std::string &name) const
 
rwsf::Enumeration< std::string > getParameterNames () const
 
std::list< std::string > getParameterValues (const std::string &name) const
 
std::string getPayload () const
 
std::string getProtocol () const
 
std::string getRemoteAddr () const
 
std::string getRemoteHost () const
 
rwsf::RequestDispatcher getRequestDispatcher (const std::string &path)
 
std::string getScheme () const
 
std::string getServerName () const
 
int getServerPort () const
 
bool isSecure () const
 
rwsf::Attribute removeAttribute (const std::string &name)
 
void setAttribute (const std::string &name, const rwsf::Attribute &value)
 

Detailed Description

rwsf::ServletRequest encapsulates a request from a client. The Agent constructs an instance of this class for each request and 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 behavior of the following functions are inconsistent with or not defined in the Java Servlet Specification v2.3.

getLocale() Not supported in this release
getParameterMap() Not supported in this release
getPayload() Added method
getReader() Not supported in this release

Constructor & Destructor Documentation

virtual rwsf::ServletRequest::~ServletRequest ( )
virtual

Destructor.

Member Function Documentation

rwsf::Attribute rwsf::ServletRequest::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> rwsf::ServletRequest::getAttributeNames ( ) const

Returns an enumeration of all attribute names in this request. When the request contains no attributes, returns an empty enumeration.

std::string rwsf::ServletRequest::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 rwsf::ServletRequest::getContentLength ( ) const

Returns the length, in bytes, of the request body made available by the input stream, or -1 if the length is not known.

std::string rwsf::ServletRequest::getContentType ( ) const

Returns the Content-Type of the request. When the request has no content type, returns the empty string.

std::string rwsf::ServletRequest::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> rwsf::ServletRequest::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> rwsf::ServletRequest::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 rwsf::ServletRequest::getPayload ( ) const

Returns the body of the request. When the request has no body, returns an empty string.

std::string rwsf::ServletRequest::getProtocol ( ) const

Returns the request protocol. For HTTP, this will typically return HTTP/1.1

std::string rwsf::ServletRequest::getRemoteAddr ( ) const

Returns the Internet address of the client sending the request. When the client address is unknown, returns an empty string.

std::string rwsf::ServletRequest::getRemoteHost ( ) const

Returns the host name of the client sending the request. If the name is unknown, returns an empty string.

rwsf::RequestDispatcher rwsf::ServletRequest::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 rwsf::ServletRequest::getScheme ( ) const

Returns the protocol scheme for this request, for example, http or https.

std::string rwsf::ServletRequest::getServerName ( ) const

Returns the name of the server processing this request.

int rwsf::ServletRequest::getServerPort ( ) const

Returns the port on the server processing this request.

bool rwsf::ServletRequest::isSecure ( ) const

Returns true if the HTTP request arrived over a secure protocol, false otherwise.

rwsf::Attribute rwsf::ServletRequest::removeAttribute ( const std::string &  name)

Removes the attribute from this request, and returns it. If the attribute cannot be found, returns an empty attribute.

void rwsf::ServletRequest::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 © 2019 Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is registered trademark of Rogue Wave Software, Inc. in the United States and other countries, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.