proxygen
|
#include <EchoHandler.h>
Public Member Functions | |
EchoHandler (EchoStats *stats) | |
void | onRequest (std::unique_ptr< proxygen::HTTPMessage > headers) noexceptoverride |
void | onBody (std::unique_ptr< folly::IOBuf > body) noexceptoverride |
void | onEOM () noexceptoverride |
void | onUpgrade (proxygen::UpgradeProtocol proto) noexceptoverride |
void | requestComplete () noexceptoverride |
void | onError (proxygen::ProxygenError err) noexceptoverride |
Public Member Functions inherited from proxygen::RequestHandler | |
virtual void | setResponseHandler (ResponseHandler *handler) noexcept |
virtual void | onEgressPaused () noexcept |
virtual void | onEgressResumed () noexcept |
virtual bool | canHandleExpect () noexcept |
virtual ExMessageHandler * | getExHandler () noexcept |
virtual ResponseHandler * | getDownstream () noexcept |
virtual | ~RequestHandler () |
Private Attributes | |
EchoStats *const | stats_ {nullptr} |
std::unique_ptr< folly::IOBuf > | body_ |
Additional Inherited Members | |
Protected Attributes inherited from proxygen::RequestHandler | |
ResponseHandler * | downstream_ {nullptr} |
Definition at line 23 of file EchoHandler.h.
|
explicit |
Definition at line 21 of file EchoHandler.cpp.
|
overridevirtualnoexcept |
Invoked when we get part of body for the request.
Implements proxygen::RequestHandler.
Definition at line 28 of file EchoHandler.cpp.
References body_, and folly::gen::move.
|
overridevirtualnoexcept |
Invoked when we finish receiving the body.
Implements proxygen::RequestHandler.
Definition at line 36 of file EchoHandler.cpp.
References proxygen::ResponseBuilder::body(), body_, proxygen::RequestHandler::downstream_, EchoService::EchoStats::getRequestCount(), proxygen::ResponseBuilder::header(), folly::gen::move, proxygen::ResponseBuilder::sendWithEOM(), stats_, and proxygen::ResponseBuilder::status().
|
overridevirtualnoexcept |
Request failed. Maybe because of read/write error on socket or client not being able to send request in time.
NOTE: Can be invoked at any time (except for before onRequest).
No more callbacks will be invoked after this. You should clean up after yourself.
Implements proxygen::RequestHandler.
Definition at line 53 of file EchoHandler.cpp.
|
overridevirtualnoexcept |
Invoked when we have successfully fetched headers from client. This will always be the first callback invoked on your handler.
Implements proxygen::RequestHandler.
Definition at line 24 of file EchoHandler.cpp.
References EchoService::EchoStats::recordRequest(), and stats_.
|
overridevirtualnoexcept |
Invoked when the session has been upgraded to a different protocol
Implements proxygen::RequestHandler.
Definition at line 45 of file EchoHandler.cpp.
|
overridevirtualnoexcept |
Invoked when request processing has been completed and nothing more needs to be done. This may be a good place to log some stats and clean up resources. This is distinct from onEOM() because it is invoked after the response is fully sent. Once this callback has been received, downstream_
should be considered invalid.
Implements proxygen::RequestHandler.
Definition at line 49 of file EchoHandler.cpp.
|
private |
Definition at line 43 of file EchoHandler.h.
Definition at line 41 of file EchoHandler.h.
Referenced by onEOM(), and onRequest().