#include <plugin_server.hpp>
Inherits pion::http::server.
Public Member Functions | |
virtual | ~plugin_server () |
default destructor | |
plugin_server (const unsigned int tcp_port=0) | |
plugin_server (const boost::asio::ip::tcp::endpoint &endpoint) | |
plugin_server (scheduler &sched, const unsigned int tcp_port=0) | |
plugin_server (scheduler &sched, const boost::asio::ip::tcp::endpoint &endpoint) | |
void | add_service (const std::string &resource, http::plugin_service *service_ptr) |
void | load_service (const std::string &resource, const std::string &service_name) |
void | set_service_option (const std::string &resource, const std::string &name, const std::string &value) |
void | load_service_config (const std::string &config_name) |
virtual void | clear (void) |
clears all the web services that are currently configured | |
Protected Member Functions | |
virtual void | before_starting (void) |
called before the TCP server starts listening for new connections | |
virtual void | after_stopping (void) |
called after the TCP server has stopped listening for new connections |
plugin_server: a server that handles HTTP connections using http::plugin_service plug-ins
Definition at line 31 of file plugin_server.hpp.
pion::http::plugin_server::plugin_server | ( | const unsigned int | tcp_port = 0 |
) | [inline, explicit] |
creates a new plugin_server object
tcp_port | port number used to listen for new connections (IPv4) |
Definition at line 45 of file plugin_server.hpp.
pion::http::plugin_server::plugin_server | ( | const boost::asio::ip::tcp::endpoint & | endpoint | ) | [inline, explicit] |
creates a new plugin_server object
endpoint | TCP endpoint used to listen for new connections (see ASIO docs) |
Definition at line 56 of file plugin_server.hpp.
pion::http::plugin_server::plugin_server | ( | scheduler & | sched, | |
const unsigned int | tcp_port = 0 | |||
) | [inline, explicit] |
creates a new plugin_server object
sched | the scheduler that will be used to manage worker threads | |
tcp_port | port number used to listen for new connections (IPv4) |
Definition at line 68 of file plugin_server.hpp.
pion::http::plugin_server::plugin_server | ( | scheduler & | sched, | |
const boost::asio::ip::tcp::endpoint & | endpoint | |||
) | [inline] |
creates a new plugin_server object
sched | the scheduler that will be used to manage worker threads | |
endpoint | TCP endpoint used to listen for new connections (see ASIO docs) |
Definition at line 80 of file plugin_server.hpp.
void pion::http::plugin_server::add_service | ( | const std::string & | resource, | |
http::plugin_service * | 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 27 of file http_plugin_server.cpp.
References pion::plugin_manager< PluginType >::add(), pion::http::server::add_resource(), pion::tcp::server::m_logger, pion::http::plugin_service::set_resource(), and pion::http::server::strip_trailing_slash().
void pion::http::plugin_server::load_service | ( | 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 37 of file http_plugin_server.cpp.
References pion::http::server::add_resource(), pion::plugin_manager< PluginType >::load(), pion::tcp::server::m_logger, pion::http::plugin_service::set_resource(), and pion::http::server::strip_trailing_slash().
Referenced by load_service_config().
void pion::http::plugin_server::load_service_config | ( | 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 56 of file http_plugin_server.cpp.
References pion::plugin::add_plugin_directory(), pion::plugin::find_config_file(), load_service(), pion::tcp::server::m_logger, pion::http::server::set_authentication(), and set_service_option().
void pion::http::plugin_server::set_service_option | ( | 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 47 of file http_plugin_server.cpp.
References pion::tcp::server::m_logger, pion::plugin_manager< PluginType >::run(), pion::http::plugin_service::set_option(), and pion::http::server::strip_trailing_slash().
Referenced by load_service_config().