xmltooling 3.2.4

Public Member Functions | List of all members
xmltooling::HTTPRequest Class Referenceabstract

Interface to HTTP requests. More...

`#include <xmltooling/io/HTTPRequest.h>`

Inheritance diagram for xmltooling::HTTPRequest:
[legend]
Collaboration diagram for xmltooling::HTTPRequest:
[legend]

## Public Member Functions
bool | isSecure () const
| Returns true iff the request is over a confidential channel.
bool | isDefaultPort () const
| Returns true iff the request port is the default port for the request protocol.
std::string | getLanguageRange () const
| Returns a language range to use in selecting language-specific content for this request.
virtual const char * | getMethod () const =0
| Returns the HTTP method of the request (GET, POST, etc.)
virtual const char * | getRequestURI () const =0
| Returns the request URI.
virtual const char * | getRequestURL () const =0
| Returns the complete request URL, including scheme, host, port, and URI.
virtual const char * | getQueryString () const =0
| Returns the HTTP query string appened to the request.
virtual std::string | getHeader (const char *name) const =0
| Returns a request header value.
virtual const char * | getCookie (const char *name) const
| Get a cookie value supplied by the client.
virtual const char * | getCookie (const char *name, bool sameSiteFallback) const
| Get a cookie value supplied by the client.
virtual const std::map< std::string, std::string > & | getCookies () const
| Gets all the cookies supplied by the client.
Public Member Functions inherited from xmltooling::GenericRequest
virtual const char * | getScheme () const =0
| Returns the URL scheme of the request (http, https, ftp, ldap, etc.)
virtual const char * | getHostname () const =0
| Returns hostname of service that received request.
virtual int | getPort () const =0
| Returns incoming port.
virtual std::string | getContentType () const =0
| Returns the MIME type of the request, if known.
virtual long | getContentLength () const =0
| Returns the length of the request body, if known.
virtual const char * | getRequestBody () const =0
| Returns the raw request body.
virtual const char * | getParameter (const char *name) const =0
| Returns a decoded named parameter value from the request.
virtual std::vector< constchar * >::size_type | getParameters (const char *name, std::vector< const char * > &values) const =0
| Returns all of the decoded values of a named parameter from the request.
virtual std::string | getRemoteUser () const =0
| Returns the transport-authenticated identity associated with the request, if authentication is solely handled by the transport.
virtual std::string | getAuthType () const
| Gets the authentication type associated with the request.
virtual std::string | getRemoteAddr () const =0
| Returns the IP address of the client.
virtual const std::vector< XSECCryptoX509 * > & | getClientCertificates () const =0
| Returns the chain of certificates sent by the client.
virtual void | absolutize (std::string &url) const
| Converts a relative URL into an absolute one based on the properties of the request.
bool | startLangMatching () const
| Initializes the language matching process; call this method to begin the matching process by calling the matchLang method.
bool | continueLangMatching () const
| Continues the language matching process; additional calls to matchLang can be done as long as this method returns true.
bool | matchLang (const XMLCh *tag) const
| Matches a language tag against the currently active range.

## Additional Inherited Members
Static Public Member Functions inherited from xmltooling::GenericRequest
static void | setLangDefaults (bool langFromClient, const XMLCh *defaultRange)
| Establish default handling of language ranges.

## Detailed Description

Interface to HTTP requests.

To supply information from the surrounding web server environment, a shim must be supplied in the form of this interface to adapt the library to different proprietary server APIs.

This interface need not be threadsafe.

## Member Function Documentation

## ◆ getCookie() [1/2]

virtual const char * xmltooling::HTTPRequest::getCookie | ( | const char * | name | ) | const
| virtual

Get a cookie value supplied by the client.

Parameters

  name | name of cookie

Returns
  cookie value or nullptr

## ◆ getCookie() [2/2]

virtual const char * xmltooling::HTTPRequest::getCookie | ( | const char * | name,
|  | bool | sameSiteFallback ) const
| virtual

Get a cookie value supplied by the client.

The boolean flag enables the workaround for older clients with broken SameSite support by looking for a second cookie with a decorated name that would not carry the SameSite flag.

Parameters

  name | name of cookie
  sameSiteFallback | enables lookaside to fallback cookie name

Returns
  cookie value or nullptr

## ◆ getCookies()

virtual const std::map< std::string, std::string > & xmltooling::HTTPRequest::getCookies | ( |  | ) | const
| virtual

Gets all the cookies supplied by the client.

Returns
  a map of cookie name/value pairs

## ◆ getHeader()

virtual std::string xmltooling::HTTPRequest::getHeader | ( | const char * | name | ) | const
| pure virtual

Returns a request header value.

Parameters

  name | the name of the header to return

Returns
  the header's value, or an empty string

## ◆ getLanguageRange()

std::string xmltooling::HTTPRequest::getLanguageRange | ( |  | ) | const
| virtual

Returns a language range to use in selecting language-specific content for this request.

The syntax is that of the HTTP 1.1 Accept-Language header, even if the underlying request is not HTTP.

Returns
  an HTTP 1.1 syntax language range specifier

Reimplemented from xmltooling::GenericRequest.

## ◆ getMethod()

virtual const char * xmltooling::HTTPRequest::getMethod | ( |  | ) | const
| pure virtual

Returns the HTTP method of the request (GET, POST, etc.)

Returns
  the HTTP method

## ◆ getQueryString()

virtual const char * xmltooling::HTTPRequest::getQueryString | ( |  | ) | const
| pure virtual

Returns the HTTP query string appened to the request.

The query string is returned without any decoding applied, everything found after the ? delimiter.

Returns
  the query string

## ◆ getRequestURI()

virtual const char * xmltooling::HTTPRequest::getRequestURI | ( |  | ) | const
| pure virtual

Returns the request URI.

Returns
  the request URI

## ◆ getRequestURL()

virtual const char * xmltooling::HTTPRequest::getRequestURL | ( |  | ) | const
| pure virtual

Returns the complete request URL, including scheme, host, port, and URI.

Returns
  the request URL

## ◆ isDefaultPort()

bool xmltooling::HTTPRequest::isDefaultPort | ( |  | ) | const
| virtual

Returns true iff the request port is the default port for the request protocol.

Returns
  default port indicator

Reimplemented from xmltooling::GenericRequest.

## ◆ isSecure()

bool xmltooling::HTTPRequest::isSecure | ( |  | ) | const
| virtual

Returns true iff the request is over a confidential channel.

Returns
  confidential channel indicator

Implements xmltooling::GenericRequest.

The documentation for this class was generated from the following file:

- xmltooling/io/HTTPRequest.h