|
pion-net
4.0.9
|
#include <FileService.hpp>
Inherits pion::net::WebService.
Classes | |
| class | DirectoryNotFoundException |
| exception thrown if the directory configured is not found More... | |
| class | FileNotFoundException |
| exception thrown if the file configured is not found More... | |
| class | FileReadException |
| exception thrown if we are unable to read a file from disk More... | |
| class | InvalidCacheException |
| exception thrown if the cache option is set to an invalid value More... | |
| class | InvalidOptionValueException |
| exception thrown if an option is set to an invalid value More... | |
| class | InvalidScanException |
| exception thrown if the scan option is set to an invalid value More... | |
| class | NotADirectoryException |
| exception thrown if the directory configuration option is not a directory More... | |
| class | NotAFileException |
| exception thrown if the file configuration option is not a file More... | |
| class | UndefinedResponseException |
| exception thrown if we do not know how to respond (should never happen) More... | |
Public Member Functions | |
| virtual void | setOption (const std::string &name, const std::string &value) |
| virtual void | operator() (pion::net::HTTPRequestPtr &request, pion::net::TCPConnectionPtr &tcp_conn) |
| handles requests for FileService | |
| virtual void | start (void) |
| called when the web service's server is starting | |
| virtual void | stop (void) |
| called when the web service's server is stopping | |
| void | setLogger (PionLogger log_ptr) |
| sets the logger to be used | |
| PionLogger | getLogger (void) |
| returns the logger currently in use | |
Public Member Functions inherited from pion::net::WebService | |
| WebService (void) | |
| default constructor | |
| virtual | ~WebService () |
| virtual destructor | |
| void | setResource (const std::string &str) |
| sets the URI stem or resource that is bound to the web service | |
| const std::string & | getResource (void) const |
| returns the URI stem or resource that is bound to the web service | |
| std::string | getRelativeResource (const std::string &resource_requested) const |
| returns the path to the resource requested, relative to the web service's location | |
Protected Types | |
| typedef PION_HASH_MAP< std::string, DiskFile, PION_HASH_STRING > | CacheMap |
| data type for map of file names to cache entries | |
| typedef PION_HASH_MAP< std::string, std::string, PION_HASH_STRING > | MIMETypeMap |
| data type for map of file extensions to MIME types | |
Protected Member Functions | |
| void | scanDirectory (const boost::filesystem::path &dir_path) |
| std::pair< CacheMap::iterator, bool > | addCacheEntry (const std::string &relative_path, const boost::filesystem::path &file_path, const bool placeholder) |
| void | sendNotFoundResponse (pion::net::HTTPRequestPtr &http_request, pion::net::TCPConnectionPtr &tcp_conn) |
Static Protected Member Functions | |
| static std::string | findMIMEType (const std::string &file_name) |
Protected Attributes | |
| PionLogger | m_logger |
| primary logging interface used by this class | |
FileService: web service that serves regular files
Definition at line 235 of file FileService.hpp.
|
protected |
adds a single file to the cache
| relative_path | path for the file relative to the root directory |
| file_path | actual path to the file on disk |
| placeholder | if true, the file's contents are not cached |
Definition at line 627 of file FileService.cpp.
References pion::plugins::DiskFile::getFileSize(), pion::plugins::DiskFile::read(), and pion::plugins::DiskFile::update().
|
staticprotected |
searches for a MIME type that matches a file
| file_name | name of the file to search for |
Definition at line 659 of file FileService.cpp.
|
protected |
adds all files within a directory to the cache
| dir_path | the directory to scan (sub-directories are included) |
Definition at line 597 of file FileService.cpp.
References pion::net::WebService::getResource().
|
virtual |
configuration options supported by FileService:
directory: all files within the directory will be made available file: cache: scan: max_chunk_size: writable:
Reimplemented from pion::net::WebService.
Definition at line 50 of file FileService.cpp.
References pion::PionPlugin::checkCygwinPath().
1.8.11