pion-net  4.0.9
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
pion::plugins::DiskFileSender Class Reference

#include <FileService.hpp>

Inherits noncopyable.

List of all members.

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

Detailed Description

DiskFileSender: class used to send files to clients using HTTP responses

Definition at line 133 of file FileService.hpp.


Constructor & Destructor Documentation

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())

Parameters:
filedisk file object that should be sent
requestHTTP request that we are responding to
tcp_connTCP connection used to send the file
max_chunk_sizesets 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().


Member Function Documentation

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

Parameters:
filedisk file object that should be sent
requestHTTP request that we are responding to
tcp_connTCP connection used to send the file
max_chunk_sizesets 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

Parameters:
write_errorerror status from the last write operation
bytes_writtennumber 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().

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().


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