MACE
1.0.0
|
00001 #ifndef _MACE_RPC_JSON_HTTP_CONNECTION_HPP_ 00002 #define _MACE_RPC_JSON_HTTP_CONNECTION_HPP_ 00003 #include <mace/rpc/json/connection.hpp> 00004 00005 namespace mace { namespace rpc { namespace json { 00006 00011 class http_connection : public mace::rpc::json::connection { 00012 public: 00013 enum http_method { POST, GET }; 00014 typedef boost::shared_ptr<http_connection> ptr; 00015 00016 http_connection( const std::string& url = "" ); 00017 ~http_connection(); 00018 00019 void set_url( const std::string& url ); 00020 void set_http_method( const std::string& method ); // POST / GET 00021 void set_path( const std::string& path ); 00022 void set_args( const std::string& args ); 00023 void set_header( const std::string key, const std::string& value ); 00024 boost::optional<std::string> get_header( const std::string& key ); 00025 00026 protected: 00027 virtual void send( const json::value& msg, const connection::pending_result::ptr& pr ); 00028 virtual void send( const json::value& msg ); 00029 00030 private: 00031 class http_connection_private* my; 00032 00033 }; 00034 00035 } } } // mace::rpc::json 00036 00037 #endif