pion  5.0.6
Public Member Functions | Protected Member Functions
pion::http::plugin_server Class Reference

#include <plugin_server.hpp>

Inheritance diagram for pion::http::plugin_server:
Inheritance graph
[legend]
Collaboration diagram for pion::http::plugin_server:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

plugin_server: a server that handles HTTP connections using http::plugin_service plug-ins

Definition at line 31 of file plugin_server.hpp.


Constructor & Destructor Documentation

pion::http::plugin_server::plugin_server ( const unsigned int  tcp_port = 0) [inline, explicit]

creates a new plugin_server object

Parameters:
tcp_portport 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

Parameters:
endpointTCP 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

Parameters:
schedthe scheduler that will be used to manage worker threads
tcp_portport 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

Parameters:
schedthe scheduler that will be used to manage worker threads
endpointTCP endpoint used to listen for new connections (see ASIO docs)

Definition at line 80 of file plugin_server.hpp.


Member Function Documentation

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

Parameters:
resourcethe resource name or uri-stem to bind to the web service
service_ptra pointer to the web service

Definition at line 25 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

Parameters:
resourcethe resource name or uri-stem to bind to the web service
service_namethe name of the web service to load (searches plug-in directories and appends extensions)

Definition at line 35 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.

Parameters:
config_namethe name of the config file to parse

Definition at line 54 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

Parameters:
resourcethe resource name or uri-stem that identifies the web service
namethe name of the configuration option
valuethe value to set the option to

Definition at line 45 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().


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