Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::net::http::Servlet Class Reference

HTTP applications. More...

#include <Controller.h>

Public Types

using Ptr = std::shared_ptr<Servlet>
 
using Callback = std::function<void(HttpServletContext &)>
 

Public Member Functions

 Servlet ()
 
 Servlet (RequestType expect, const std::string &url)
 
void setCallback (Callback callback)
 
const std::string & getUri () const
 
RequestType getExpectType () const
 
auto & getExpectQueryArgs () const
 
auto & getExpectHeaders () const
 
void requiredQueryArg (const std::string &arg)
 
void requiredHeader (const std::string &arg)
 
void invoke (HttpServletContext &ctx) const
 
Servletoperator= (Callback callback)
 

Private Attributes

std::string uri
 Registration path.
 
RequestType expect_type
 Expected request type, 403 if not met.
 
std::set< std::string > expect_query_args
 Expected query string parameters, 400 if not met.
 
std::set< std::string > expect_headers
 Expected header parameters, 400 if not met.
 
Callback callback
 Request handling callback function, 500 if not met.
 

Detailed Description

HTTP applications.

Member Typedef Documentation

◆ Callback

◆ Ptr

using sese::net::http::Servlet::Ptr = std::shared_ptr<Servlet>

Constructor & Destructor Documentation

◆ Servlet() [1/2]

sese::net::http::Servlet::Servlet ( )

◆ Servlet() [2/2]

sese::net::http::Servlet::Servlet ( RequestType expect,
const std::string & url )

Member Function Documentation

◆ getExpectHeaders()

auto & sese::net::http::Servlet::getExpectHeaders ( ) const
inlinenodiscard

References expect_headers.

◆ getExpectQueryArgs()

auto & sese::net::http::Servlet::getExpectQueryArgs ( ) const
inlinenodiscard

References expect_query_args.

◆ getExpectType()

RequestType sese::net::http::Servlet::getExpectType ( ) const
inlinenodiscard

References expect_type.

◆ getUri()

const std::string & sese::net::http::Servlet::getUri ( ) const
inlinenodiscard

◆ invoke()

◆ operator=()

Servlet & sese::net::http::Servlet::operator= ( Callback callback)
inline

References callback, and setCallback().

◆ requiredHeader()

void sese::net::http::Servlet::requiredHeader ( const std::string & arg)

◆ requiredQueryArg()

void sese::net::http::Servlet::requiredQueryArg ( const std::string & arg)

◆ setCallback()

void sese::net::http::Servlet::setCallback ( Callback callback)

References callback().

Referenced by operator=().

Member Data Documentation

◆ callback

Callback sese::net::http::Servlet::callback
private

Request handling callback function, 500 if not met.

Referenced by operator=().

◆ expect_headers

std::set<std::string> sese::net::http::Servlet::expect_headers
private

Expected header parameters, 400 if not met.

Referenced by getExpectHeaders().

◆ expect_query_args

std::set<std::string> sese::net::http::Servlet::expect_query_args
private

Expected query string parameters, 400 if not met.

Referenced by getExpectQueryArgs().

◆ expect_type

RequestType sese::net::http::Servlet::expect_type
private

Expected request type, 403 if not met.

Referenced by getExpectType(), and Servlet().

◆ uri

std::string sese::net::http::Servlet::uri
private

Registration path.

Referenced by getUri(), and Servlet().


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