pion  5.0.6
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
pion::http::response_writer Class Reference

#include <response_writer.hpp>

Inherits pion::http::writer, and enable_shared_from_this< response_writer >.

Public Member Functions

virtual ~response_writer ()
 default destructor
 
http::responseget_response (void)
 returns a non-const reference to the response that will be sent
 
- Public Member Functions inherited from pion::http::writer
virtual ~writer ()
 default destructor
 
void clear (void)
 clears out all of the memory buffers used to cache payload content data
 
template<typename T >
void write (const T &data)
 
void write (std::ostream &(*iomanip)(std::ostream &))
 
void write (const void *data, size_t length)
 
void write_no_copy (const std::string &data)
 
void write_no_copy (void *data, size_t length)
 
void send (void)
 
template<typename SendHandler >
void send (SendHandler send_handler)
 
template<typename SendHandler >
void send_chunk (SendHandler send_handler)
 
template<typename SendHandler >
void send_final_chunk (SendHandler send_handler)
 
void send_final_chunk (void)
 
tcp::connection_ptr & get_connection (void)
 returns a shared pointer to the TCP connection
 
size_t get_content_length (void) const
 returns the length of the payload content (in bytes)
 
void supports_chunked_messages (bool b)
 sets whether or not the client supports chunked messages
 
bool supports_chunked_messages () const
 returns true if the client supports chunked messages
 
bool sending_chunked_message () const
 returns true if we are sending a chunked message to the client
 
void set_logger (logger log_ptr)
 sets the logger to be used
 
logger get_logger (void)
 returns the logger currently in use
 

Static Public Member Functions

static boost::shared_ptr< response_writercreate (tcp::connection_ptr &tcp_conn, http::response_ptr &http_response_ptr, finished_handler_t handler=finished_handler_t())
 
static boost::shared_ptr< response_writercreate (tcp::connection_ptr &tcp_conn, const http::request &http_request, finished_handler_t handler=finished_handler_t())
 

Protected Member Functions

 response_writer (tcp::connection_ptr &tcp_conn, http::response_ptr &http_response_ptr, finished_handler_t handler)
 
 response_writer (tcp::connection_ptr &tcp_conn, const http::request &http_request, finished_handler_t handler)
 
virtual void prepare_buffers_for_send (http::message::write_buffers_t &write_buffers)
 
virtual write_handler_t bind_to_write_handler (void)
 returns a function bound to http::writer::handle_write()
 
virtual void handle_write (const boost::system::error_code &write_error, std::size_t bytes_written)
 
- Protected Member Functions inherited from pion::http::writer
 writer (tcp::connection_ptr &tcp_conn, finished_handler_t handler)
 
void finished_writing (const boost::system::error_code &ec)
 called after we have finished sending the HTTP message
 

Additional Inherited Members

- Protected Types inherited from pion::http::writer
typedef boost::function1< void, const boost::system::error_code & > finished_handler_t
 function called after the HTTP message has been sent
 
typedef boost::function2< void, const boost::system::error_code &, std::size_t > write_handler_t
 data type for a function that handles write operations
 

Detailed Description

response_writer: used to asynchronously send HTTP responses

Definition at line 31 of file response_writer.hpp.

Constructor & Destructor Documentation

pion::http::response_writer::response_writer ( tcp::connection_ptr &  tcp_conn,
http::response_ptr &  http_response_ptr,
finished_handler_t  handler 
)
inlineprotected

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

Parameters
tcp_connTCP connection used to send the response
http_responsepointer to the response that will be sent
handlerfunction called after the request has been sent

Definition at line 87 of file response_writer.hpp.

pion::http::response_writer::response_writer ( tcp::connection_ptr &  tcp_conn,
const http::request http_request,
finished_handler_t  handler 
)
inlineprotected

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

Parameters
tcp_connTCP connection used to send the response
http_requestthe request we are responding to
handlerfunction called after the request has been sent

Definition at line 111 of file response_writer.hpp.

Member Function Documentation

static boost::shared_ptr<response_writer> pion::http::response_writer::create ( tcp::connection_ptr &  tcp_conn,
http::response_ptr &  http_response_ptr,
finished_handler_t  handler = finished_handler_t() 
)
inlinestatic
static boost::shared_ptr<response_writer> pion::http::response_writer::create ( tcp::connection_ptr &  tcp_conn,
const http::request http_request,
finished_handler_t  handler = finished_handler_t() 
)
inlinestatic

creates new response_writer objects

Parameters
tcp_connTCP connection used to send the response
http_requestthe request we are responding to
handlerfunction called after the request has been sent
Returns
boost::shared_ptr<response_writer> shared pointer to the new writer object that was created

Definition at line 67 of file response_writer.hpp.

virtual void pion::http::response_writer::handle_write ( const boost::system::error_code &  write_error,
std::size_t  bytes_written 
)
inlineprotectedvirtual

called after the response is sent

Parameters
write_errorerror status from the last write operation
bytes_writtennumber of bytes sent by the last write operation

Implements pion::http::writer.

Definition at line 147 of file response_writer.hpp.

Referenced by bind_to_write_handler().

virtual void pion::http::response_writer::prepare_buffers_for_send ( http::message::write_buffers_t write_buffers)
inlineprotectedvirtual

initializes a vector of write buffers with the HTTP message information

Parameters
write_buffersvector of write buffers to initialize

Implements pion::http::writer.

Definition at line 126 of file response_writer.hpp.


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