#include <WebServer.hpp>
Inherits pion::net::HTTPServer.
Definition at line 31 of file WebServer.hpp.
Public Member Functions | |
| virtual | ~WebServer () |
| default destructor | |
| WebServer (const unsigned int tcp_port=0) | |
| WebServer (const boost::asio::ip::tcp::endpoint &endpoint) | |
| WebServer (PionScheduler &scheduler, const unsigned int tcp_port=0) | |
| WebServer (PionScheduler &scheduler, const boost::asio::ip::tcp::endpoint &endpoint) | |
| void | addService (const std::string &resource, WebService *service_ptr) |
| void | loadService (const std::string &resource, const std::string &service_name) |
| void | setServiceOption (const std::string &resource, const std::string &name, const std::string &value) |
| void | loadServiceConfig (const std::string &config_name) |
| virtual void | clear (void) |
| clears all the web services that are currently configured | |
Protected Member Functions | |
| virtual void | beforeStarting (void) |
| called before the TCP server starts listening for new connections | |
| virtual void | afterStopping (void) |
| called after the TCP server has stopped listening for new connections | |
Classes | |
| class | AuthConfigException |
| exception thrown if there is an error parsing the authorization config More... | |
| class | ConfigNotFoundException |
| exception thrown if the web service configuration file cannot be found More... | |
| class | ConfigParsingException |
| exception thrown if the plug-in file cannot be opened More... | |
| class | ServiceNotFoundException |
| exception thrown if a web service cannot be found More... | |
| class | WebServiceException |
| exception used to propagate exceptions thrown by web services More... | |
| pion::net::WebServer::WebServer | ( | const unsigned int | tcp_port = 0 |
) | [inline, explicit] |
creates a new WebServer object
| tcp_port | port number used to listen for new connections (IPv4) |
Definition at line 83 of file WebServer.hpp.
| pion::net::WebServer::WebServer | ( | const boost::asio::ip::tcp::endpoint & | endpoint | ) | [inline, explicit] |
creates a new WebServer object
| endpoint | TCP endpoint used to listen for new connections (see ASIO docs) |
Definition at line 94 of file WebServer.hpp.
| pion::net::WebServer::WebServer | ( | PionScheduler & | scheduler, | |
| const unsigned int | tcp_port = 0 | |||
| ) | [inline, explicit] |
creates a new WebServer object
| scheduler | the PionScheduler that will be used to manage worker threads | |
| tcp_port | port number used to listen for new connections (IPv4) |
Definition at line 106 of file WebServer.hpp.
| pion::net::WebServer::WebServer | ( | PionScheduler & | scheduler, | |
| const boost::asio::ip::tcp::endpoint & | endpoint | |||
| ) | [inline] |
creates a new WebServer object
| scheduler | the PionScheduler that will be used to manage worker threads | |
| endpoint | TCP endpoint used to listen for new connections (see ASIO docs) |
Definition at line 118 of file WebServer.hpp.
| void pion::net::WebServer::addService | ( | const std::string & | resource, | |
| WebService * | service_ptr | |||
| ) |
adds a new web service to the web server
| resource | the resource name or uri-stem to bind to the web service | |
| service_ptr | a pointer to the web service |
Definition at line 25 of file WebServer.cpp.
References pion::PluginManager< PLUGIN_TYPE >::add(), pion::net::HTTPServer::addResource(), pion::net::TCPServer::m_logger, pion::net::WebService::setResource(), and pion::net::HTTPServer::stripTrailingSlash().
| void pion::net::WebServer::loadService | ( | const std::string & | resource, | |
| const std::string & | service_name | |||
| ) |
loads a web service from a shared object file
| resource | the resource name or uri-stem to bind to the web service | |
| service_name | the name of the web service to load (searches plug-in directories and appends extensions) |
Definition at line 41 of file WebServer.cpp.
References pion::net::HTTPServer::addResource(), pion::PluginManager< PLUGIN_TYPE >::load(), pion::net::TCPServer::m_logger, and pion::net::HTTPServer::stripTrailingSlash().
Referenced by loadServiceConfig().
| void pion::net::WebServer::loadServiceConfig | ( | const std::string & | config_name | ) |
Parses a simple web service configuration file. Each line in the file starts with one of the following commands:
path VALUE : adds a directory to the web service search path service RESOURCE FILE : loads web service bound to RESOURCE from FILE option RESOURCE NAME=VALUE : sets web service option NAME to VALUE
Blank lines or lines that begin with # are ignored as comments.
| config_name | the name of the config file to parse |
Definition at line 74 of file WebServer.cpp.
References pion::PionPlugin::addPluginDirectory(), pion::PionPlugin::findConfigFile(), loadService(), pion::net::TCPServer::m_logger, pion::net::HTTPServer::setAuthentication(), and setServiceOption().
| void pion::net::WebServer::setServiceOption | ( | const std::string & | resource, | |
| const std::string & | name, | |||
| const std::string & | value | |||
| ) |
sets a configuration option for the web service associated with resource
| resource | the resource name or uri-stem that identifies the web service | |
| name | the name of the configuration option | |
| value | the value to set the option to |
Definition at line 57 of file WebServer.cpp.
References pion::net::TCPServer::m_logger, pion::PluginManager< PLUGIN_TYPE >::run(), pion::net::WebService::setOption(), and pion::net::HTTPServer::stripTrailingSlash().
Referenced by loadServiceConfig().
1.4.7