TrinityCore
Loading...
Searching...
No Matches
Trinity::Net::Http::HttpService< SessionImpl > Class Template Reference

#include <HttpService.h>

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

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 Trinity::Net::SocketMgr< HttpServiceTraits< SessionImpl > >
 SocketMgr (SocketMgr const &)=delete
 
 SocketMgr (SocketMgr &&)=delete
 
SocketMgroperator= (SocketMgr const &)=delete
 
SocketMgroperator= (SocketMgr &&)=delete
 
virtual ~SocketMgr ()
 
virtual bool StartNetwork (Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int threadCount)
 
void Wait ()
 
virtual void OnSocketOpen (IoContextTcpSocket &&sock)
 
int32 GetNetworkThreadCount () const
 
Asio::IoContextSelectThreadWithMinConnections () const
 
- 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

std::unique_ptr< HttpNetworkThread< SessionImpl >[]> CreateThreads () const override
 
- Protected Member Functions inherited from Trinity::Net::SocketMgr< HttpServiceTraits< SessionImpl > >
 SocketMgr ()
 
- 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 Trinity::Net::SocketMgr< HttpServiceTraits< SessionImpl > >
std::unique_ptr< AsyncAcceptor_acceptor
 
std::unique_ptr< ThreadType[]> _threads
 
int32 _threadCount
 

Private Types

using BaseSocketMgr = SocketMgr< HttpServiceTraits< SessionImpl > >
 

Private Attributes

friend BaseSocketMgr
 

Additional Inherited Members

- Public Types inherited from Trinity::Net::SocketMgr< HttpServiceTraits< SessionImpl > >
using Self = typename Traits::Self
 
using SocketType = typename Traits::SocketType
 
using ThreadType = typename Traits::ThreadType
 
- 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 142 of file HttpService.h.

Member Typedef Documentation

◆ BaseSocketMgr

template<typename SessionImpl >
using Trinity::Net::Http::HttpService< SessionImpl >::BaseSocketMgr = SocketMgr<HttpServiceTraits<SessionImpl> >
private

Definition at line 144 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 149 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 182 of file HttpService.h.

+ Here is the call graph for this function:

◆ CreateThreads()

template<typename SessionImpl >
std::unique_ptr< HttpNetworkThread< SessionImpl >[]> Trinity::Net::Http::HttpService< SessionImpl >::CreateThreads ( ) const
inlineoverrideprotectedvirtual

Reimplemented from Trinity::Net::SocketMgr< HttpServiceTraits< SessionImpl > >.

Definition at line 190 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 173 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 154 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 Trinity::Net::SocketMgr< HttpServiceTraits< SessionImpl > >.

Definition at line 163 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 198 of file HttpService.h.

◆ _logger

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

Definition at line 199 of file HttpService.h.

◆ BaseSocketMgr

template<typename SessionImpl >
friend Trinity::Net::Http::HttpService< SessionImpl >::BaseSocketMgr
private

Definition at line 146 of file HttpService.h.


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