# pion::net::HTTPRequestWriter Class Reference

`#include <HTTPRequestWriter.hpp>`

Inherits pion::net::HTTPWriter.

List of all members.

## Detailed Description

HTTPRequestWriter: used to asynchronously send HTTP requests

Definition at line 29 of file HTTPRequestWriter.hpp.

## Public Member Functions

virtual | ~HTTPRequestWriter ()
| default destructor
HTTPRequest & | getRequest (void)
| returns a non-const reference to the request that will be sent

## Static Public Member Functions

static boost::shared_ptr< HTTPRequestWriter > | create (TCPConnectionPtr &tcp_conn, FinishedHandler handler=FinishedHandler())
static boost::shared_ptr< HTTPRequestWriter > | create (TCPConnectionPtr &tcp_conn, HTTPRequestPtr &http_request, FinishedHandler handler=FinishedHandler())

## Protected Member Functions

| HTTPRequestWriter (TCPConnectionPtr &tcp_conn, FinishedHandler handler)
| HTTPRequestWriter (TCPConnectionPtr &tcp_conn, HTTPRequestPtr &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::HTTPRequestWriter::HTTPRequestWriter | ( | TCPConnectionPtr & | tcp_conn,
|  | FinishedHandler | handler |
| ) |  |  | `[inline, protected]`

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

Parameters:

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

Definition at line 83 of file HTTPRequestWriter.hpp.

References pion::net::HTTPWriter::setLogger().

Referenced by create().

pion::net::HTTPRequestWriter::HTTPRequestWriter | ( | TCPConnectionPtr & | tcp_conn,
|  | HTTPRequestPtr & | http_request,
|  | FinishedHandler | handler |
| ) |  |  | `[inline, protected]`

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

Parameters:

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

Definition at line 96 of file HTTPRequestWriter.hpp.

References pion::net::HTTPWriter::setLogger(), and pion::net::HTTPWriter::writeNoCopy().

## Member Function Documentation

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

creates new HTTPRequestWriter objects

Parameters:

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

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

Definition at line 63 of file HTTPRequestWriter.hpp.

References HTTPRequestWriter().

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

creates new HTTPRequestWriter objects

Parameters:

  | tcp_conn | TCP connection used to send the request
  | handler | function called after the request has been sent

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

Definition at line 47 of file HTTPRequestWriter.hpp.

References HTTPRequestWriter().

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

called after the request 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 139 of file HTTPRequestWriter.hpp.

References pion::net::HTTPWriter::clear(), pion::net::HTTPWriter::finishedWriting(), pion::net::HTTPWriter::getLogger(), and pion::net::HTTPWriter::sendingChunkedMessage().

Referenced by bindToWriteHandler().

virtual void pion::net::HTTPRequestWriter::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 118 of file HTTPRequestWriter.hpp.

References pion::net::HTTPWriter::getContentLength(), pion::net::HTTPWriter::getTCPConnection(), and pion::net::HTTPWriter::sendingChunkedMessage().

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

- net/include/pion/net/HTTPRequestWriter.hpp