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

Settings for a PostRoute. More...

#include <PostRoute.h>

Inheritance diagram for ofx::HTTP::PostRouteSettings:
ofx::HTTP::BaseRouteSettings

Public Types

enum  Defaults { DEFAULT_POST_BUFFER_SIZE = 8192, DEFAULT_FIELD_LIMIT = 100, DEFAULT_MAXIMUM_FILE_UPLOAD_SIZE = 2097152 }
 Default values. More...
 
- Public Types inherited from ofx::HTTP::BaseRouteSettings
typedef std::set< std::string > HTTPMethodSet
 A typedef for HTTPMethodSet.
 
typedef std::set< std::string > MediaTypeSet
 A typedef for a MediaTypeSet.
 

Public Member Functions

 PostRouteSettings (const std::string &routePathPattern=DEFAULT_POST_ROUTE, bool requireSecurePort=false, bool requireAuthentication=false)
 Create PostRouteSettings. More...
 
virtual ~PostRouteSettings ()
 Destroy the PostRouteSetting.
 
void setUploadFolder (const std::string &uploadFolder)
 
const std::string & getUploadFolder () const
 
void setUploadRedirect (const std::string &uploadRedirect)
 
const std::string & getUploadRedirect () const
 
void setWriteBufferSize (std::size_t writeBufferSize)
 
std::size_t getWriteBufferSize () const
 
void setFieldLimit (std::size_t fieldLimit)
 
std::size_t getFieldLimit () const
 
void setMaximumFileUploadSize (uint64_t maximumFileUploadSize)
 Set the maximum file upload size in bytes. More...
 
uint64_t getMaximumFileUploadSize () const
 Get the maximum file upload size. More...
 
- Public Member Functions inherited from 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. 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_POST_ROUTE = "/post"
 
static const std::string DEFAULT_POST_FOLDER = "uploads/"
 
static const std::string DEFAULT_POST_REDIRECT = "uploaded.html"
 
static const std::string DEFAULT_POST_HTTP_METHODS_ARRAY [] = { "POST" }
 An unfortunate compromise until C++11. More...
 
static const HTTPMethodSet DEFAULT_POST_HTTP_METHODS
 The default HTTP methods for this route.
 
- Static Public Attributes inherited from ofx::HTTP::BaseRouteSettings
static const std::string DEFAULT_ROUTE_PATH_PATTERN = "/.*"
 The default route path regex pattern. More...
 

Detailed Description

Settings for a PostRoute.

Member Enumeration Documentation

◆ Defaults

Default values.

Enumerator
DEFAULT_POST_BUFFER_SIZE 

File upload buffer.

DEFAULT_FIELD_LIMIT 

Maximum number of form fields.

DEFAULT_MAXIMUM_FILE_UPLOAD_SIZE 

Maximum file upload size (2 MB)

Constructor & Destructor Documentation

◆ PostRouteSettings()

ofx::HTTP::PostRouteSettings::PostRouteSettings ( const std::string &  routePathPattern = DEFAULT_POST_ROUTE,
bool  requireSecurePort = false,
bool  requireAuthentication = false 
)

Create PostRouteSettings.

Parameters
routePathPatternThe regex pattern that this route will handle.
requireSecurePortTrue if this route requires communication on an SSL encrypted port.

Member Function Documentation

◆ getMaximumFileUploadSize()

uint64_t ofx::HTTP::PostRouteSettings::getMaximumFileUploadSize ( ) const

Get the maximum file upload size.

Returns
The maximum file upload size in bytes.

◆ setMaximumFileUploadSize()

void ofx::HTTP::PostRouteSettings::setMaximumFileUploadSize ( uint64_t  maximumFileUploadSize)

Set the maximum file upload size in bytes.

Parameters
maximumFileUploadSizeThe maximum file upload size in bytes.

Member Data Documentation

◆ DEFAULT_POST_HTTP_METHODS_ARRAY

const std::string ofx::HTTP::PostRouteSettings::DEFAULT_POST_HTTP_METHODS_ARRAY = { "POST" }
static

An unfortunate compromise until C++11.

Note
C++ is not able to initialize static collections until after C++11. This is a compromise until then.

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