ofxHTTP
A collection of tools for HTTP.
ofx::HTTP::BaseRouteSettings Class Reference

A base implementation of route settings. More...

#include <BaseRoute.h>

Inheritance diagram for ofx::HTTP::BaseRouteSettings:
ofx::HTTP::FileSystemRouteSettings ofx::HTTP::IPVideoRouteSettings ofx::HTTP::PostRouteSettings ofx::HTTP::SSERouteSettings ofx::HTTP::WebSocketRouteSettings

Public Types

typedef std::set< std::string > HTTPMethodSet
 A typedef for HTTPMethodSet.
 
typedef std::set< std::string > MediaTypeSet
 A typedef for a MediaTypeSet.
 

Public Member Functions

 BaseRouteSettings (const std::string &routePathPattern=BaseRouteSettings::DEFAULT_ROUTE_PATH_PATTERN, bool requireSecurePort=false, bool requireAuthentication=false, const HTTPMethodSet &validHTTPMethods=HTTPMethodSet())
 Create the BaseRouteSettings with the given route path. More...
 
virtual ~BaseRouteSettings ()
 Destroy the BaseRoutSettings.
 
void setRoutePathPattern (const std::string &routePathPattern)
 Set the route path regex pattern. More...
 
const std::string & getRoutePathPattern () const
 
void setRequireSecurePort (bool requireSecurePort)
 Set the secure port requirement. More...
 
bool requireSecurePort () const
 
void setRequireAuthentication (bool requireAuthentication)
 Set the authentication requirement. More...
 
bool requireAuthentication () const
 
void setValidHTTPMethods (const HTTPMethodSet &validHTTPMethods)
 Set the list of valid HTTPMethods. More...
 
const HTTPMethodSetgetValidHTTPMethods () const
 
void setValidContentTypes (const MediaTypeSet &validContentTypes)
 Set the list of valid Content Types. More...
 
const MediaTypeSetgetValidContentTypes () const
 

Static Public Attributes

static const std::string DEFAULT_ROUTE_PATH_PATTERN = "/.*"
 The default route path regex pattern. More...
 

Detailed Description

A base implementation of route settings.

These settings define the basic information needed to implement BaseRoute::canHandleRequest() method.

Constructor & Destructor Documentation

◆ BaseRouteSettings()

ofx::HTTP::BaseRouteSettings::BaseRouteSettings ( const std::string &  routePathPattern = BaseRouteSettings::DEFAULT_ROUTE_PATH_PATTERN,
bool  requireSecurePort = false,
bool  requireAuthentication = false,
const HTTPMethodSet validHTTPMethods = HTTPMethodSet() 
)

Create the BaseRouteSettings with the given route path.

Parameters
routePathPatternThe regex pattern that this route will handle.
requireSecurePortTrue if this route requires communication on an SSL encrypted port.
requireAuthenticationRequire authenticated requests.
validHTTPMethodsThe valid HTTP Methods that this route will handle.

Member Function Documentation

◆ getRoutePathPattern()

const std::string & ofx::HTTP::BaseRouteSettings::getRoutePathPattern ( ) const
Returns
The regex pattern that this route handles.

◆ getValidContentTypes()

const BaseRouteSettings::MediaTypeSet & ofx::HTTP::BaseRouteSettings::getValidContentTypes ( ) const
Returns
the Set of valid request content types.
Note
If Empty, all requested content types will be accepted.

◆ getValidHTTPMethods()

const BaseRouteSettings::HTTPMethodSet & ofx::HTTP::BaseRouteSettings::getValidHTTPMethods ( ) const
Returns
The set of valid HTTP methods.
Note
If empty, all requested HTTP methods will be accepted.

◆ requireAuthentication()

bool ofx::HTTP::BaseRouteSettings::requireAuthentication ( ) const
Returns
true iff route requires server authentication.

◆ requireSecurePort()

bool ofx::HTTP::BaseRouteSettings::requireSecurePort ( ) const
Returns
true iff route requires communication on an SSL encrypted port.

◆ setRequireAuthentication()

void ofx::HTTP::BaseRouteSettings::setRequireAuthentication ( bool  requireAuthentication)

Set the authentication requirement.

Parameters
requireAuthenticationSet to true if this route requires authentication.

◆ setRequireSecurePort()

void ofx::HTTP::BaseRouteSettings::setRequireSecurePort ( bool  requireSecurePort)

Set the secure port requirement.

Parameters
requireSecurePortSet to true if this route can only handle requests submitted on an SSL encrypted port.

◆ setRoutePathPattern()

void ofx::HTTP::BaseRouteSettings::setRoutePathPattern ( const std::string &  routePathPattern)

Set the route path regex pattern.

Parameters
routePathPatternThe regex pattern that this route will handle.

◆ setValidContentTypes()

void ofx::HTTP::BaseRouteSettings::setValidContentTypes ( const MediaTypeSet validContentTypes)

Set the list of valid Content Types.

Parameters
validContentTypesA set of valid content types.
Note
An empty set means that any requested Content-Type will be accepted. A non-empty set means that the requested The Content-Type MUST be in the set.

◆ setValidHTTPMethods()

void ofx::HTTP::BaseRouteSettings::setValidHTTPMethods ( const HTTPMethodSet validHTTPMethods)

Set the list of valid HTTPMethods.

Parameters
validHTTPMethodsA set of valid HTTPMethods.
Note
An empty set means that any requested HTTPMethod will be accepted. A non-empty set means that the requested HTTPMethod MUST be in the set.

Member Data Documentation

◆ DEFAULT_ROUTE_PATH_PATTERN

const std::string ofx::HTTP::BaseRouteSettings::DEFAULT_ROUTE_PATH_PATTERN = "/.*"
static

The default route path regex pattern.

By default, this pattern matches all requests.


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