proxygen
proxygen::ScopedHandlerFactory< HandlerType > Class Template Reference

#include <ScopedHTTPServer.h>

Inheritance diagram for proxygen::ScopedHandlerFactory< HandlerType >:
proxygen::RequestHandlerFactory

Public Member Functions

 ScopedHandlerFactory (HandlerType handler)
 
void onServerStart (folly::EventBase *) noexceptoverride
 
void onServerStop () noexceptoverride
 
RequestHandleronRequest (RequestHandler *, HTTPMessage *) noexceptoverride
 
- Public Member Functions inherited from proxygen::RequestHandlerFactory
virtual ~RequestHandlerFactory ()
 

Private Attributes

HandlerType handler_
 

Detailed Description

template<typename HandlerType>
class proxygen::ScopedHandlerFactory< HandlerType >

Definition at line 65 of file ScopedHTTPServer.h.

Constructor & Destructor Documentation

template<typename HandlerType >
proxygen::ScopedHandlerFactory< HandlerType >::ScopedHandlerFactory ( HandlerType  handler)
inlineexplicit

Definition at line 67 of file ScopedHTTPServer.h.

67  : handler_(handler) {
68  }
void handler(int, siginfo_t *, void *)

Member Function Documentation

template<typename HandlerType >
RequestHandler* proxygen::ScopedHandlerFactory< HandlerType >::onRequest ( RequestHandler ,
HTTPMessage  
)
inlineoverridevirtualnoexcept

Invoked for each new request server handles. HTTPMessage is provided so that user can potentially choose among several implementation of handler based on URL or something. No need to save/copy this HTTPMessage. RequestHandler will be given the HTTPMessage in a separate callback.

Some request handlers don't handle the request themselves (think filters). They do take some actions based on request/response but otherwise they just hand-off request to some other RequestHandler. This upstream RequestHandler is given as first parameter. For the terminal RequestHandler this will by nullptr.

Implements proxygen::RequestHandlerFactory.

Definition at line 76 of file ScopedHTTPServer.h.

76  {
77  return new ScopedHandler<HandlerType>(&handler_);
78  }
template<typename HandlerType >
void proxygen::ScopedHandlerFactory< HandlerType >::onServerStart ( folly::EventBase evb)
inlineoverridevirtualnoexcept

Invoked in each thread server is going to handle requests before we start handling requests. Can be used to setup thread-local setup for each thread (stats and such).

Implements proxygen::RequestHandlerFactory.

Definition at line 70 of file ScopedHTTPServer.h.

70  {
71  }
template<typename HandlerType >
void proxygen::ScopedHandlerFactory< HandlerType >::onServerStop ( )
inlineoverridevirtualnoexcept

Invoked in each handler thread after all the connections are drained from that thread. Can be used to tear down thread-local setup.

Implements proxygen::RequestHandlerFactory.

Definition at line 73 of file ScopedHTTPServer.h.

73  {
74  }

Member Data Documentation

template<typename HandlerType >
HandlerType proxygen::ScopedHandlerFactory< HandlerType >::handler_
private

Definition at line 80 of file ScopedHTTPServer.h.


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