# pion::net::HTTPResponseWriter Class Reference

`#include <HTTPResponseWriter.hpp>`

Inherits pion::net::HTTPWriter.

List of all members.

## Detailed Description

HTTPResponseWriter: used to asynchronously send HTTP responses

Definition at line 30 of file HTTPResponseWriter.hpp.

## Public Member Functions

virtual | ~HTTPResponseWriter ()
| default destructor
HTTPResponse & | getResponse (void)
| returns a non-const reference to the response that will be sent

## Static Public Member Functions

static boost::shared_ptr< HTTPResponseWriter > | create (TCPConnectionPtr &tcp_conn, HTTPResponsePtr &http_response, FinishedHandler handler=FinishedHandler())
static boost::shared_ptr< HTTPResponseWriter > | create (TCPConnectionPtr &tcp_conn, const HTTPRequest &http_request, FinishedHandler handler=FinishedHandler())

## Protected Member Functions

| HTTPResponseWriter (TCPConnectionPtr &tcp_conn, HTTPResponsePtr &http_response, FinishedHandler handler)
| HTTPResponseWriter (TCPConnectionPtr &tcp_conn, const HTTPRequest &http_request, FinishedHandler handler)
virtual void | prepareBuffersForSend (HTTPMessage::WriteBuffers &write_buffers)
virtual WriteHandler | bindToWriteHandler (void)
| returns a function bound to HTTPWriter::handleWrite()
virtual void | handleWrite (const boost::system::error_code &write_error, std::size_t bytes_written)

## Constructor & Destructor Documentation

pion::net::HTTPResponseWriter::HTTPResponseWriter | ( | TCPConnectionPtr & | tcp_conn,
|  | HTTPResponsePtr & | http_response,
|  | FinishedHandler | handler |
| ) |  |  | `[inline, protected]`

protected constructor restricts creation of objects (use create())

Parameters:

  | tcp_conn | TCP connection used to send the response
  | http_response | pointer to the response that will be sent
  | handler | function called after the request has been sent

Definition at line 86 of file HTTPResponseWriter.hpp.

pion::net::HTTPResponseWriter::HTTPResponseWriter | ( | TCPConnectionPtr & | tcp_conn,
|  | const HTTPRequest & | http_request,
|  | FinishedHandler | handler |
| ) |  |  | `[inline, protected]`

protected constructor restricts creation of objects (use create())

Parameters:

  | tcp_conn | TCP connection used to send the response
  | http_request | the request we are responding to
  | handler | function called after the request has been sent

Definition at line 110 of file HTTPResponseWriter.hpp.

## Member Function Documentation

static boost::shared_ptr<HTTPResponseWriter> pion::net::HTTPResponseWriter::create | ( | TCPConnectionPtr & | tcp_conn,
|  | const HTTPRequest & | http_request,
|  | FinishedHandler | handler = `FinishedHandler()` |
| ) |  |  | `[inline, static]`

creates new HTTPResponseWriter objects

Parameters:

  | tcp_conn | TCP connection used to send the response
  | http_request | the request we are responding to
  | handler | function called after the request has been sent

Returns:
  boost::shared_ptr<HTTPResponseWriter> shared pointer to the new writer object that was created

Definition at line 66 of file HTTPResponseWriter.hpp.

static boost::shared_ptr<HTTPResponseWriter> pion::net::HTTPResponseWriter::create | ( | TCPConnectionPtr & | tcp_conn,
|  | HTTPResponsePtr & | http_response,
|  | FinishedHandler | handler = `FinishedHandler()` |
| ) |  |  | `[inline, static]`

creates new HTTPResponseWriter objects

Parameters:

  | tcp_conn | TCP connection used to send the response
  | http_response | pointer to the response that will be sent
  | handler | function called after the response has been sent

Returns:
  boost::shared_ptr<HTTPResponseWriter> shared pointer to the new writer object that was created

Definition at line 49 of file HTTPResponseWriter.hpp.

Referenced by pion::net::HTTPServer::handleBadRequest(), pion::net::HTTPServer::handleForbiddenRequest(), pion::net::HTTPServer::handleMethodNotAllowed(), pion::net::HTTPServer::handleNotFoundRequest(), pion::net::HTTPCookieAuth::handleOk(), pion::net::HTTPCookieAuth::handleRedirection(), pion::net::HTTPServer::handleServerError(), pion::net::HTTPCookieAuth::handleUnauthorized(), and pion::net::HTTPBasicAuth::handleUnauthorized().

virtual void pion::net::HTTPResponseWriter::handleWrite | ( | const boost::system::error_code & | write_error,
|  | std::size_t | bytes_written |
| ) |  |  | `[inline, protected, virtual]`

called after the response is sent

Parameters:

  | write_error | error status from the last write operation
  | bytes_written | number of bytes sent by the last write operation

Implements pion::net::HTTPWriter.

Definition at line 146 of file HTTPResponseWriter.hpp.

Referenced by bindToWriteHandler().

virtual void pion::net::HTTPResponseWriter::prepareBuffersForSend | ( | HTTPMessage::WriteBuffers & | write_buffers | ) | `[inline, protected, virtual]`

initializes a vector of write buffers with the HTTP message information

Parameters:

  | write_buffers | vector of write buffers to initialize

Implements pion::net::HTTPWriter.

Definition at line 125 of file HTTPResponseWriter.hpp.

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

- net/include/pion/net/HTTPResponseWriter.hpp