proxygen
|
#include <ResponseHandler.h>
Public Member Functions | |
ResponseHandler (RequestHandler *upstream) | |
virtual | ~ResponseHandler () |
virtual void | sendHeaders (HTTPMessage &msg) noexcept=0 |
virtual void | sendChunkHeader (size_t len) noexcept=0 |
virtual void | sendBody (std::unique_ptr< folly::IOBuf > body) noexcept=0 |
virtual void | sendChunkTerminator () noexcept=0 |
virtual void | sendEOM () noexcept=0 |
virtual void | sendAbort () noexcept=0 |
virtual void | refreshTimeout () noexcept=0 |
virtual void | pauseIngress () noexcept=0 |
virtual void | resumeIngress () noexcept=0 |
virtual ResponseHandler * | newPushedResponse (PushHandler *pushHandler) noexcept=0 |
virtual ResponseHandler * | newExMessage (ExMessageHandler *, bool=false) noexcept |
virtual const wangle::TransportInfo & | getSetupTransportInfo () const noexcept=0 |
virtual void | getCurrentTransportInfo (wangle::TransportInfo *tinfo) const =0 |
HTTPTransaction * | getTransaction () const noexcept |
Protected Attributes | |
RequestHandler * | upstream_ {nullptr} |
HTTPTransaction * | txn_ {nullptr} |
Interface that acts as client for RequestHandler. It also has a hook for the RequestHandler so that it is easy to chain these Request/Response handlers and be able to modify these chains.
The names are pretty much self explanatory. You only need to get into details about this interface if you are implementing filters.
NOTE: All the writes are done at the end of the event loop. So this is safe to do in your RequestHandler.
{ ... downstream_->sendHeader(...); downstream_->sendEOM(); }
You dont need to worry about any callbacks being invoked after sendHeader.
Consider using proxygen/httpserver/ResponseBuilder to send back the response. It will take care of chunking response if required and everything.
Definition at line 44 of file ResponseHandler.h.
|
inlineexplicit |
Definition at line 46 of file ResponseHandler.h.
|
inlinevirtual |
Definition at line 50 of file ResponseHandler.h.
References newPushedResponse(), folly::pushmi::__adl::noexcept(), pauseIngress(), refreshTimeout(), resumeIngress(), sendAbort(), sendBody(), sendChunkHeader(), sendChunkTerminator(), sendEOM(), and sendHeaders().
|
pure virtual |
Implemented in proxygen::Filter, and proxygen::RequestHandlerAdaptor.
Referenced by proxygen::Filter::getCurrentTransportInfo(), proxygen::MockResponseHandler::MockResponseHandler(), and newExMessage().
|
pure virtualnoexcept |
Implemented in proxygen::Filter, proxygen::RequestHandlerAdaptor, and proxygen::MockResponseHandler.
Referenced by proxygen::Filter::getSetupTransportInfo(), and newExMessage().
|
inlinenoexcept |
Definition at line 92 of file ResponseHandler.h.
References txn_.
Referenced by proxygen::RequestHandlerAdaptor::newExMessage(), and proxygen::ResponseBuilder::send().
|
inlinevirtualnoexcept |
Reimplemented in proxygen::RequestHandlerAdaptor.
Definition at line 80 of file ResponseHandler.h.
References getCurrentTransportInfo(), and getSetupTransportInfo().
|
pure virtualnoexcept |
|
pure virtualnoexcept |
|
pure virtualnoexcept |
Implemented in proxygen::Filter, proxygen::RejectConnectFilter, and proxygen::RequestHandlerAdaptor.
Referenced by proxygen::MockResponseHandler::MockResponseHandler(), proxygen::Filter::refreshTimeout(), and ~ResponseHandler().
|
pure virtualnoexcept |
|
pure virtualnoexcept |
|
pure virtualnoexcept |
Implemented in proxygen::Filter, proxygen::ZlibServerFilter, proxygen::RejectConnectFilter, proxygen::RequestHandlerAdaptor, and proxygen::MockResponseHandler.
Referenced by ProxyService::ProxyHandler::onServerBody(), ProxyService::ProxyHandler::readDataAvailable(), proxygen::ResponseBuilder::send(), proxygen::Filter::sendBody(), and ~ResponseHandler().
|
pure virtualnoexcept |
|
pure virtualnoexcept |
|
pure virtualnoexcept |
Implemented in proxygen::ZlibServerFilter, proxygen::Filter, proxygen::RejectConnectFilter, proxygen::RequestHandlerAdaptor, and StubRequestHandlerAdaptor.
Referenced by proxygen::MockResponseHandler::MockResponseHandler(), ProxyService::ProxyHandler::onServerEOM(), proxygen::ResponseBuilder::rejectUpgradeRequest(), proxygen::ResponseBuilder::send(), proxygen::Filter::sendEOM(), and ~ResponseHandler().
|
pure virtualnoexcept |
NOTE: We take response message as non-const reference, to allow filters between your handler and client to be able to modify response if they want to.
eg. a compression filter might want to change the content-encoding
Implemented in proxygen::Filter, proxygen::RejectConnectFilter, proxygen::RequestHandlerAdaptor, proxygen::ZlibServerFilter, and StubRequestHandlerAdaptor.
Referenced by proxygen::ResponseBuilder::acceptUpgradeRequest(), proxygen::MockResponseHandler::MockResponseHandler(), ProxyService::ProxyHandler::onServerHeadersComplete(), proxygen::ResponseBuilder::rejectUpgradeRequest(), proxygen::ResponseBuilder::send(), proxygen::Filter::sendHeaders(), and ~ResponseHandler().
|
protected |
Definition at line 98 of file ResponseHandler.h.
Referenced by proxygen::RequestHandlerAdaptor::getCurrentTransportInfo(), proxygen::RequestHandlerAdaptor::getSetupTransportInfo(), getTransaction(), proxygen::RequestHandlerAdaptor::newPushedResponse(), proxygen::RequestHandlerAdaptor::onError(), proxygen::RequestHandlerAdaptor::pauseIngress(), proxygen::RequestHandlerAdaptor::refreshTimeout(), proxygen::RequestHandlerAdaptor::resumeIngress(), proxygen::RequestHandlerAdaptor::sendAbort(), proxygen::RequestHandlerAdaptor::sendBody(), proxygen::RequestHandlerAdaptor::sendChunkHeader(), proxygen::RequestHandlerAdaptor::sendChunkTerminator(), proxygen::RequestHandlerAdaptor::sendEOM(), proxygen::RequestHandlerAdaptor::sendHeaders(), proxygen::Filter::setResponseHandler(), and proxygen::RequestHandlerAdaptor::setTransaction().
|
protected |
Definition at line 97 of file ResponseHandler.h.
Referenced by proxygen::Filter::canHandleExpect(), proxygen::RequestHandlerAdaptor::detachTransaction(), proxygen::Filter::getExHandler(), proxygen::RequestHandlerAdaptor::onBody(), proxygen::Filter::onBody(), proxygen::RequestHandlerAdaptor::onEgressPaused(), proxygen::Filter::onEgressPaused(), proxygen::RequestHandlerAdaptor::onEgressResumed(), proxygen::Filter::onEgressResumed(), proxygen::RequestHandlerAdaptor::onEOM(), proxygen::Filter::onEOM(), proxygen::RejectConnectFilter::onError(), proxygen::Filter::onError(), proxygen::RequestHandlerAdaptor::onExTransaction(), proxygen::RequestHandlerAdaptor::onHeadersComplete(), proxygen::RejectConnectFilter::onRequest(), proxygen::Filter::onRequest(), proxygen::Filter::onUpgrade(), proxygen::RequestHandlerAdaptor::onUpgrade(), proxygen::RejectConnectFilter::requestComplete(), proxygen::Filter::requestComplete(), proxygen::RequestHandlerAdaptor::setError(), proxygen::Filter::setResponseHandler(), and proxygen::RequestHandlerAdaptor::setTransaction().