proxygen
|
#include <RequestHandler.h>
Public Member Functions | |
virtual void | setResponseHandler (ResponseHandler *handler) noexcept |
virtual void | onRequest (std::unique_ptr< HTTPMessage > headers) noexcept=0 |
virtual void | onBody (std::unique_ptr< folly::IOBuf > body) noexcept=0 |
virtual void | onUpgrade (proxygen::UpgradeProtocol prot) noexcept=0 |
virtual void | onEOM () noexcept=0 |
virtual void | requestComplete () noexcept=0 |
virtual void | onError (ProxygenError err) noexcept=0 |
virtual void | onEgressPaused () noexcept |
virtual void | onEgressResumed () noexcept |
virtual bool | canHandleExpect () noexcept |
virtual ExMessageHandler * | getExHandler () noexcept |
virtual ResponseHandler * | getDownstream () noexcept |
virtual | ~RequestHandler () |
Protected Attributes | |
ResponseHandler * | downstream_ {nullptr} |
Interface to be implemented by objects that handle requests from client. ResponseHandler acts as the client for these objects and provides methods to send back the response
Definition at line 24 of file RequestHandler.h.
|
inlinevirtual |
Definition at line 109 of file RequestHandler.h.
|
inlinevirtualnoexcept |
Returns true if the handler is responsible for responding to Expect headers, false otherwise.
Reimplemented in proxygen::Filter.
Definition at line 94 of file RequestHandler.h.
Referenced by proxygen::Filter::canHandleExpect(), and proxygen::RequestHandlerAdaptor::onHeadersComplete().
|
inlinevirtualnoexcept |
|
inlinevirtualnoexcept |
Implement in control stream handler to support incoming child EX streams.
Reimplemented in proxygen::Filter, and proxygen::ExMessageHandler.
Definition at line 101 of file RequestHandler.h.
Referenced by proxygen::Filter::getExHandler(), and proxygen::RequestHandlerAdaptor::onExTransaction().
|
pure virtualnoexcept |
Invoked when we get part of body for the request.
Implemented in TestHandlerFactory::TestHandler, proxygen::MockRequestHandler, proxygen::PushHandler, proxygen::Filter, ProxyService::ProxyHandler, proxygen::RejectConnectFilter, proxygen::DirectResponseHandler, EchoService::EchoHandler, PushService::PushRequestHandler, proxygen::ScopedHandler< HandlerType >, and StaticService::StaticHandler.
Referenced by proxygen::RequestHandlerAdaptor::onBody(), proxygen::Filter::onBody(), and setResponseHandler().
|
inlinevirtualnoexcept |
Signals from HTTP layer when client queue is full or empty. If you are sending a streaming response, consider implementing these and acting accordingly. Saves your server from running out of memory.
Reimplemented in proxygen::Filter, proxygen::RejectConnectFilter, ProxyService::ProxyHandler, and StaticService::StaticHandler.
Definition at line 84 of file RequestHandler.h.
Referenced by proxygen::PushHandler::InnerPushHandler::onEgressPaused(), proxygen::RequestHandlerAdaptor::onEgressPaused(), and proxygen::Filter::onEgressPaused().
|
inlinevirtualnoexcept |
Reimplemented in proxygen::Filter, proxygen::RejectConnectFilter, ProxyService::ProxyHandler, and StaticService::StaticHandler.
Definition at line 87 of file RequestHandler.h.
Referenced by proxygen::PushHandler::InnerPushHandler::onEgressResumed(), proxygen::RequestHandlerAdaptor::onEgressResumed(), and proxygen::Filter::onEgressResumed().
|
pure virtualnoexcept |
Invoked when we finish receiving the body.
Implemented in TestHandlerFactory::TestHandler, proxygen::PushHandler, proxygen::Filter, ProxyService::ProxyHandler, proxygen::RejectConnectFilter, proxygen::DirectResponseHandler, proxygen::ScopedHandler< HandlerType >, EchoService::EchoHandler, PushService::PushRequestHandler, and StaticService::StaticHandler.
Referenced by proxygen::RequestHandlerAdaptor::onEOM(), proxygen::Filter::onEOM(), and setResponseHandler().
|
pure virtualnoexcept |
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.
Implemented in TestHandlerFactory::TestHandler, proxygen::Filter, proxygen::ScopedHandler< HandlerType >, proxygen::DirectResponseHandler, ProxyService::ProxyHandler, proxygen::RejectConnectFilter, EchoService::EchoHandler, PushService::PushRequestHandler, StaticService::StaticHandler, and proxygen::PushHandler.
Referenced by proxygen::RejectConnectFilter::onError(), proxygen::Filter::onError(), proxygen::RejectConnectFilter::onRequest(), proxygen::RequestHandlerAdaptor::setError(), and setResponseHandler().
|
pure virtualnoexcept |
Invoked when we have successfully fetched headers from client. This will always be the first callback invoked on your handler.
Implemented in TestHandlerFactory::TestHandler, proxygen::MockRequestHandler, proxygen::PushHandler, proxygen::Filter, ProxyService::ProxyHandler, proxygen::DirectResponseHandler, EchoService::EchoHandler, PushService::PushRequestHandler, proxygen::RejectConnectFilter, proxygen::ScopedHandler< HandlerType >, and StaticService::StaticHandler.
Referenced by proxygen::HTTPServerAcceptor::newHandler(), proxygen::RequestHandlerAdaptor::onHeadersComplete(), proxygen::Filter::onRequest(), and setResponseHandler().
|
pure virtualnoexcept |
Invoked when the session has been upgraded to a different protocol
Implemented in TestHandlerFactory::TestHandler, proxygen::PushHandler, proxygen::Filter, ProxyService::ProxyHandler, proxygen::RejectConnectFilter, proxygen::DirectResponseHandler, EchoService::EchoHandler, PushService::PushRequestHandler, proxygen::ScopedHandler< HandlerType >, StaticService::StaticHandler, and proxygen::ExMessageHandler.
Referenced by proxygen::Filter::onUpgrade(), proxygen::RequestHandlerAdaptor::onUpgrade(), and setResponseHandler().
|
pure virtualnoexcept |
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.
Implemented in TestHandlerFactory::TestHandler, proxygen::Filter, proxygen::ScopedHandler< HandlerType >, ProxyService::ProxyHandler, proxygen::DirectResponseHandler, proxygen::RejectConnectFilter, EchoService::EchoHandler, PushService::PushRequestHandler, StaticService::StaticHandler, and proxygen::PushHandler.
Referenced by proxygen::RequestHandlerAdaptor::detachTransaction(), proxygen::Filter::requestComplete(), and setResponseHandler().
|
inlinevirtualnoexcept |
Saves the downstream handle with itself. Implementations of this interface should use downstream_ to send back response.
XXX: Only override this method if you are ABSOLUTELY sure what you are doing. If possible, just use downstream_ variable and dont mess with these things.
Reimplemented in proxygen::Filter.
Definition at line 34 of file RequestHandler.h.
References downstream_, handler(), folly::pushmi::__adl::noexcept(), onBody(), onEOM(), onError(), onRequest(), onUpgrade(), and requestComplete().
Referenced by proxygen::Filter::setResponseHandler(), and proxygen::RequestHandlerAdaptor::setTransaction().
|
protected |
A place designated for the response handler. You can use this to send back the response in your RequestHandler.
Definition at line 116 of file RequestHandler.h.
Referenced by ProxyService::ProxyHandler::abortDownstream(), ProxyService::ProxyHandler::connectError(), ProxyService::ProxyHandler::connectSuccess(), proxygen::Filter::getCurrentTransportInfo(), getDownstream(), proxygen::Filter::getSetupTransportInfo(), proxygen::Filter::newPushedResponse(), PushService::PushRequestHandler::onEOM(), EchoService::EchoHandler::onEOM(), proxygen::DirectResponseHandler::onEOM(), proxygen::ScopedHandler< HandlerType >::onEOM(), proxygen::Filter::onError(), proxygen::RejectConnectFilter::onRequest(), PushService::PushRequestHandler::onRequest(), ProxyService::ProxyHandler::onRequest(), ProxyService::ProxyHandler::onServerBody(), ProxyService::ProxyHandler::onServerEgressPaused(), ProxyService::ProxyHandler::onServerEgressResumed(), ProxyService::ProxyHandler::onServerEOM(), ProxyService::ProxyHandler::onServerHeadersComplete(), proxygen::Filter::pauseIngress(), ProxyService::ProxyHandler::readDataAvailable(), proxygen::Filter::refreshTimeout(), proxygen::Filter::requestComplete(), proxygen::Filter::resumeIngress(), proxygen::Filter::sendAbort(), proxygen::Filter::sendBody(), proxygen::Filter::sendChunkHeader(), proxygen::Filter::sendChunkTerminator(), proxygen::Filter::sendEOM(), proxygen::Filter::sendHeaders(), setResponseHandler(), and proxygen::Filter::setResponseHandler().