10 #ifndef __PION_PLUGIN_SERVICE_HEADER__
11 #define __PION_PLUGIN_SERVICE_HEADER__
14 #include <boost/noncopyable.hpp>
15 #include <pion/config.hpp>
16 #include <pion/error.hpp>
17 #include <pion/algorithm.hpp>
18 #include <pion/http/request.hpp>
19 #include <pion/tcp/connection.hpp>
30 private boost::noncopyable
46 virtual void operator()(http::request_ptr& http_request_ptr, tcp::connection_ptr& tcp_conn) = 0;
54 virtual void set_option(
const std::string& name,
const std::string& value) {
55 BOOST_THROW_EXCEPTION(
error::bad_arg() << error::errinfo_arg_name(name) );
65 inline void set_resource(
const std::string& str) { m_resource = str; }
68 inline const std::string&
get_resource(
void)
const {
return m_resource; }
72 if (resource_requested.size() <=
get_resource().size()) {
85 std::string m_resource;
virtual ~plugin_service()
virtual destructor
const std::string & get_resource(void) const
returns the URI stem or resource that is bound to the web service
void set_resource(const std::string &str)
sets the URI stem or resource that is bound to the web service
virtual void set_option(const std::string &name, const std::string &value)
virtual void stop(void)
called when the web service's server is stopping
virtual void operator()(http::request_ptr &http_request_ptr, tcp::connection_ptr &tcp_conn)=0
static std::string url_decode(const std::string &str)
escapes URL-encoded strings (a%20value+with%20spaces)
plugin_service(void)
default constructor
exception thrown for an invalid configuration argument or option
std::string get_relative_resource(const std::string &resource_requested) const
returns the path to the resource requested, relative to the web service's location ...
virtual void start(void)
called when the web service's server is starting