TrinityCore
Trinity::Net::Http::HttpService< SessionImpl > Class Template Reference

#include <HttpService.h>

+ Inheritance diagram for Trinity::Net::Http::HttpService< SessionImpl >:

Classes

class  Thread
 

Public Member Functions

 HttpService (std::string_view loggerSuffix)
 
bool StartNetwork (Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int32 threadCount=1) override
 
void StopNetwork () override
 
template<HttpRequestHandler< SessionImpl > Callable>
void RegisterHandler (boost::beast::http::verb method, std::string_view path, Callable handler, RequestHandlerFlag flags=RequestHandlerFlag::None)
 
virtual std::shared_ptr< SessionStateCreateNewSessionState (boost::asio::ip::address const &address)
 
void RegisterHandler (boost::beast::http::verb method, std::string_view path, std::function< RequestHandlerResult(std::shared_ptr< AbstractSocket > session, RequestContext &context)> handler, RequestHandlerFlag flags=RequestHandlerFlag::None)
 
- Public Member Functions inherited from SocketMgr< SessionImpl >
virtual ~SocketMgr ()
 
virtual bool StartNetwork (Trinity::Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int threadCount)
 
virtual void StopNetwork ()
 
void Wait ()
 
virtual void OnSocketOpen (boost::asio::ip::tcp::socket &&sock, uint32 threadIndex)
 
int32 GetNetworkThreadCount () const
 
uint32 SelectThreadWithMinConnections () const
 
std::pair< boost::asio::ip::tcp::socket *, uint32GetSocketForAccept ()
 
- Public Member Functions inherited from Trinity::Net::Http::DispatcherService
 DispatcherService (std::string_view loggerSuffix)
 
RequestHandlerResult HandleRequest (std::shared_ptr< AbstractSocket > session, RequestContext &context)
 
- Public Member Functions inherited from Trinity::Net::Http::SessionService
 SessionService (std::string_view loggerSuffix)
 
void Start (Asio::IoContext &ioContext)
 
void Stop ()
 
std::shared_ptr< SessionStateFindAndRefreshSessionState (std::string_view id, boost::asio::ip::address const &address)
 
void MarkSessionInactive (boost::uuids::uuid const &id)
 

Protected Member Functions

NetworkThread< SessionImpl > * CreateThreads () const override
 
- Protected Member Functions inherited from SocketMgr< SessionImpl >
 SocketMgr ()
 
virtual NetworkThread< SessionImpl > * CreateThreads () const=0
 
- Protected Member Functions inherited from Trinity::Net::Http::DispatcherService
void RegisterHandler (boost::beast::http::verb method, std::string_view path, std::function< RequestHandlerResult(std::shared_ptr< AbstractSocket > session, RequestContext &context)> handler, RequestHandlerFlag flags=RequestHandlerFlag::None)
 
- Protected Member Functions inherited from Trinity::Net::Http::SessionService
void InitAndStoreSessionState (std::shared_ptr< SessionState > state, boost::asio::ip::address const &address)
 
void KillInactiveSessions ()
 

Protected Attributes

Asio::IoContext_ioContext
 
std::string _logger
 
- Protected Attributes inherited from SocketMgr< SessionImpl >
AsyncAcceptor_acceptor
 
NetworkThread< SessionImpl > * _threads
 
int32 _threadCount
 

Additional Inherited Members

- Static Public Member Functions inherited from Trinity::Net::Http::DispatcherService
static RequestHandlerResult HandleBadRequest (std::shared_ptr< AbstractSocket > session, RequestContext &context)
 
static RequestHandlerResult HandleUnauthorized (std::shared_ptr< AbstractSocket > session, RequestContext &context)
 
static RequestHandlerResult HandlePathNotFound (std::shared_ptr< AbstractSocket > session, RequestContext &context)
 

Detailed Description

template<typename SessionImpl>
class Trinity::Net::Http::HttpService< SessionImpl >

Definition at line 116 of file HttpService.h.

Constructor & Destructor Documentation

◆ HttpService()

template<typename SessionImpl >
Trinity::Net::Http::HttpService< SessionImpl >::HttpService ( std::string_view  loggerSuffix)
inline

Definition at line 119 of file HttpService.h.

Member Function Documentation

◆ CreateNewSessionState()

template<typename SessionImpl >
virtual std::shared_ptr< SessionState > Trinity::Net::Http::HttpService< SessionImpl >::CreateNewSessionState ( boost::asio::ip::address const &  address)
inlinevirtual

Reimplemented in Battlenet::LoginRESTService.

Definition at line 152 of file HttpService.h.

+ Here is the call graph for this function:

◆ CreateThreads()

template<typename SessionImpl >
NetworkThread< SessionImpl > * Trinity::Net::Http::HttpService< SessionImpl >::CreateThreads ( ) const
inlineoverrideprotectedvirtual

Implements SocketMgr< SessionImpl >.

Definition at line 175 of file HttpService.h.

+ Here is the call graph for this function:

◆ RegisterHandler() [1/2]

template<typename SessionImpl >
template<HttpRequestHandler< SessionImpl > Callable>
void Trinity::Net::Http::HttpService< SessionImpl >::RegisterHandler ( boost::beast::http::verb  method,
std::string_view  path,
Callable  handler,
RequestHandlerFlag  flags = RequestHandlerFlag::None 
)
inline

Definition at line 143 of file HttpService.h.

+ Here is the call graph for this function:

◆ RegisterHandler() [2/2]

template<typename SessionImpl >
void Trinity::Net::Http::DispatcherService::RegisterHandler ( boost::beast::http::verb  method,
std::string_view  path,
std::function< RequestHandlerResult(std::shared_ptr< AbstractSocket > session, RequestContext &context)>  handler,
RequestHandlerFlag  flags = RequestHandlerFlag::None 
)

Definition at line 69 of file HttpService.cpp.

◆ StartNetwork()

template<typename SessionImpl >
bool Trinity::Net::Http::HttpService< SessionImpl >::StartNetwork ( Asio::IoContext ioContext,
std::string const &  bindIp,
uint16  port,
int32  threadCount = 1 
)
inlineoverride

Definition at line 124 of file HttpService.h.

+ Here is the call graph for this function:

◆ StopNetwork()

template<typename SessionImpl >
void Trinity::Net::Http::HttpService< SessionImpl >::StopNetwork ( )
inlineoverridevirtual

Reimplemented from SocketMgr< SessionImpl >.

Definition at line 133 of file HttpService.h.

+ Here is the call graph for this function:

Member Data Documentation

◆ _ioContext

template<typename SessionImpl >
Asio::IoContext* Trinity::Net::Http::HttpService< SessionImpl >::_ioContext
protected

Definition at line 183 of file HttpService.h.

◆ _logger

template<typename SessionImpl >
std::string Trinity::Net::Http::HttpService< SessionImpl >::_logger
protected

Definition at line 184 of file HttpService.h.


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