pion-net
4.0.9
|
#include <FileService.hpp>
Inherits noncopyable.
Public Member Functions | |
virtual | ~DiskFileSender () |
default virtual destructor | |
void | send (void) |
void | setLogger (PionLogger log_ptr) |
sets the logger to be used | |
PionLogger | getLogger (void) |
returns the logger currently in use | |
Static Public Member Functions | |
static boost::shared_ptr < DiskFileSender > | create (DiskFile &file, pion::net::HTTPRequestPtr &request, pion::net::TCPConnectionPtr &tcp_conn, unsigned long max_chunk_size=0) |
Protected Member Functions | |
DiskFileSender (DiskFile &file, pion::net::HTTPRequestPtr &request, pion::net::TCPConnectionPtr &tcp_conn, unsigned long max_chunk_size) | |
void | handleWrite (const boost::system::error_code &write_error, std::size_t bytes_written) |
Protected Attributes | |
PionLogger | 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::net::HTTPRequestPtr & | request, | ||
pion::net::TCPConnectionPtr & | tcp_conn, | ||
unsigned long | max_chunk_size | ||
) | [protected] |
protected constructor restricts creation of objects (use create())
file | disk file object that should be sent |
request | 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 745 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::net::HTTPRequestPtr & | request, | ||
pion::net::TCPConnectionPtr & | tcp_conn, | ||
unsigned long | max_chunk_size = 0 |
||
) | [inline, static] |
creates new DiskFileSender objects
file | disk file object that should be sent |
request | 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::handleWrite | ( | 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 850 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 768 of file FileService.cpp.
References pion::plugins::DiskFile::getFileContent(), pion::plugins::DiskFile::getFilePath(), pion::plugins::DiskFile::getFileSize(), handleWrite(), pion::plugins::DiskFile::hasFileContent(), and m_logger.
Referenced by handleWrite().