proxygen
proxygen::ResponseHandler Class Referenceabstract

#include <ResponseHandler.h>

Inheritance diagram for proxygen::ResponseHandler:
proxygen::Filter proxygen::MockResponseHandler proxygen::RequestHandlerAdaptor DummyFilterFactory::DummyFilter proxygen::RejectConnectFilter proxygen::ZlibServerFilter StubRequestHandlerAdaptor

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 ResponseHandlernewPushedResponse (PushHandler *pushHandler) noexcept=0
 
virtual ResponseHandlernewExMessage (ExMessageHandler *, bool=false) noexcept
 
virtual const wangle::TransportInfogetSetupTransportInfo () const noexcept=0
 
virtual void getCurrentTransportInfo (wangle::TransportInfo *tinfo) const =0
 
HTTPTransactiongetTransaction () const noexcept
 

Protected Attributes

RequestHandlerupstream_ {nullptr}
 
HTTPTransactiontxn_ {nullptr}
 

Detailed Description

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.

Constructor & Destructor Documentation

proxygen::ResponseHandler::ResponseHandler ( RequestHandler upstream)
inlineexplicit

Definition at line 46 of file ResponseHandler.h.

47  : upstream_(CHECK_NOTNULL(upstream)) {
48  }
RequestHandler * upstream_
virtual proxygen::ResponseHandler::~ResponseHandler ( )
inlinevirtual

Member Function Documentation

virtual void proxygen::ResponseHandler::getCurrentTransportInfo ( wangle::TransportInfo tinfo) const
pure virtual
virtual const wangle::TransportInfo& proxygen::ResponseHandler::getSetupTransportInfo ( ) const
pure virtualnoexcept
HTTPTransaction* proxygen::ResponseHandler::getTransaction ( ) const
inlinenoexcept

Definition at line 92 of file ResponseHandler.h.

References txn_.

Referenced by proxygen::RequestHandlerAdaptor::newExMessage(), and proxygen::ResponseBuilder::send().

92  {
93  return txn_;
94  }
HTTPTransaction * txn_
virtual ResponseHandler* proxygen::ResponseHandler::newExMessage ( ExMessageHandler ,
bool  = false 
)
inlinevirtualnoexcept

Reimplemented in proxygen::RequestHandlerAdaptor.

Definition at line 80 of file ResponseHandler.h.

References getCurrentTransportInfo(), and getSetupTransportInfo().

82  {
83  LOG(FATAL) << "newExMessage not supported";
84  }
virtual void proxygen::ResponseHandler::refreshTimeout ( )
pure virtualnoexcept
virtual void proxygen::ResponseHandler::sendHeaders ( HTTPMessage msg)
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().

Member Data Documentation


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