# HttpConnectionHandler.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/server/HttpConnectionHandler.hpp"

# HttpConnectionHandler

Simple ConnectionHandler (oatpp::network::ConnectionHandler) for handling HTTP communication.
Will create one thread per each connection to handle communication.

namespace oatpp { namespace web { namespace server { 
  class HttpConnectionHandler : public base::Countable, public network::ConnectionHandler, public HttpProcessor::TaskProcessingListener {}
}}}

# Methods

Return Type Name Summary
[none] HttpConnectionHandler Multiple implementations:
  1. Constructor.
  2. Constructor.
  3. Constructor.
std::shared_ptr<HttpConnectionHandler> createShared Create shared HttpConnectionHandler.
void setErrorHandler Set root error handler for all requests coming through this Connection Handler.
void addRequestInterceptor Add request interceptor. Request interceptors are called before routing happens.
void addResponseInterceptor Add response interceptor.
void handleConnection Implementation of oatpp::network::ConnectionHandler::handleConnection().
void stop Tell all worker threads to exit when done.
v_uint64 getConnectionsCount Get connections count.

# HttpConnectionHandler::HttpConnectionHandler

  1. Constructor.
    HttpConnectionHandler(const std::shared_ptr<HttpProcessor::Components>& components)
    
  2. Constructor.
    HttpConnectionHandler(const std::shared_ptr<HttpRouter>& router)
      : HttpConnectionHandler(std::make_shared<HttpProcessor::Components>(router))
    
  3. Constructor.
    HttpConnectionHandler(const std::shared_ptr<HttpRouter>& router,
                          const std::shared_ptr<HttpProcessor::Config>& config)
      : HttpConnectionHandler(std::make_shared<HttpProcessor::Components>(router, config))
    

# HttpConnectionHandler::createShared

Create shared HttpConnectionHandler.

static std::shared_ptr<HttpConnectionHandler> createShared(const std::shared_ptr<HttpRouter>& router)

# HttpConnectionHandler::setErrorHandler

Set root error handler for all requests coming through this Connection Handler. All unhandled errors will be handled by this error handler.

void setErrorHandler(const std::shared_ptr<handler::ErrorHandler>& errorHandler)

# HttpConnectionHandler::addRequestInterceptor

Add request interceptor. Request interceptors are called before routing happens. If multiple interceptors set then the order of interception is the same as the order of calls to addRequestInterceptor.

void addRequestInterceptor(const std::shared_ptr<interceptor::RequestInterceptor>& interceptor)

# HttpConnectionHandler::addResponseInterceptor

Add response interceptor. If multiple interceptors set then the order of interception is the same as the order of calls to addResponseInterceptor.

void addResponseInterceptor(const std::shared_ptr<interceptor::ResponseInterceptor>& interceptor)

# HttpConnectionHandler::handleConnection

Implementation of oatpp::network::ConnectionHandler::handleConnection().

void handleConnection(const provider::ResourceHandle<IOStream>& connection,
                      const std::shared_ptr<const ParameterMap>& params) override

# HttpConnectionHandler::stop

Tell all worker threads to exit when done.

void stop() override

# HttpConnectionHandler::getConnectionsCount

Get connections count.

  • @return

v_uint64 getConnectionsCount()