#include <FileService.hpp>
Public Member Functions | |
virtual | ~DiskFileSender () |
default virtual destructor | |
void | send (void) |
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 < DiskFileSender > | create (DiskFile &file, pion::http::request_ptr &http_request_ptr, pion::tcp::connection_ptr &tcp_conn, unsigned long max_chunk_size=0) |
Protected Member Functions | |
DiskFileSender (DiskFile &file, pion::http::request_ptr &http_request_ptr, pion::tcp::connection_ptr &tcp_conn, unsigned long max_chunk_size) | |
void | handle_write (const boost::system::error_code &write_error, std::size_t bytes_written) |
Protected Attributes | |
logger | m_logger |
primary logging interface used by this class |
DiskFileSender: class used to send files to clients using HTTP responses
Definition at line 133 of file FileService.hpp.
pion::plugins::DiskFileSender::DiskFileSender | ( | DiskFile & | file, | |
pion::http::request_ptr & | http_request_ptr, | |||
pion::tcp::connection_ptr & | tcp_conn, | |||
unsigned long | max_chunk_size | |||
) | [protected] |
protected constructor restricts creation of objects (use create())
file | disk file object that should be sent | |
http_request_ptr | HTTP request that we are responding to | |
tcp_conn | TCP connection used to send the file | |
max_chunk_size | sets the maximum chunk size |
Definition at line 808 of file FileService.cpp.
References pion::plugins::DiskFile::getFilePath(), pion::plugins::DiskFile::getLastModifiedString(), pion::plugins::DiskFile::getMimeType(), pion::plugins::DiskFile::hasFileContent(), and m_logger.
Referenced by create().
static boost::shared_ptr<DiskFileSender> pion::plugins::DiskFileSender::create | ( | DiskFile & | file, | |
pion::http::request_ptr & | http_request_ptr, | |||
pion::tcp::connection_ptr & | tcp_conn, | |||
unsigned long | max_chunk_size = 0 | |||
) | [inline, static] |
creates new DiskFileSender objects
file | disk file object that should be sent | |
http_request_ptr | HTTP request that we are responding to | |
tcp_conn | TCP connection used to send the file | |
max_chunk_size | sets the maximum chunk size (default=0, unlimited) |
Definition at line 147 of file FileService.hpp.
References DiskFileSender().
Referenced by pion::plugins::FileService::operator()().
void pion::plugins::DiskFileSender::handle_write | ( | const boost::system::error_code & | write_error, | |
std::size_t | bytes_written | |||
) | [protected] |
handler called after a send operation has completed
write_error | error status from the last write operation | |
bytes_written | number of bytes sent by the last write operation |
Definition at line 934 of file FileService.cpp.
References pion::plugins::DiskFile::getFileSize(), m_logger, and send().
Referenced by send().
void pion::plugins::DiskFileSender::send | ( | void | ) |
Begins sending the file to the client. Following a call to this function, it is not thread safe to use your reference to the DiskFileSender object.
Definition at line 837 of file FileService.cpp.
References pion::plugins::DiskFile::getFileContent(), pion::plugins::DiskFile::getFilePath(), pion::plugins::DiskFile::getFileSize(), handle_write(), pion::plugins::DiskFile::hasFileContent(), and m_logger.
Referenced by handle_write().