8 #ifndef _THRIFT_PROCESSOR_H_
9 #define _THRIFT_PROCESSOR_H_
11 #include <arpa/inet.h>
12 #include <boost/shared_ptr.hpp>
13 #include <thrift/protocol/TBinaryProtocol.h>
21 template <
class processor_type,
class handler_type>
27 using namespace apache::thrift::protocol;
28 using namespace apache::thrift::transport;
31 typedef TBinaryProtocol protocol_type;
33 boost::shared_ptr<in_transport_type> in_transport(
new in_transport_type(
request_p()));
34 boost::shared_ptr<out_transport_type> out_transport(
new out_transport_type(
response_p()));
35 boost::shared_ptr<protocol_type> in_protocol(
new protocol_type(in_transport));
36 boost::shared_ptr<protocol_type> out_protocol(
new protocol_type(out_transport));
40 boost::shared_ptr<handler_type> handler(
new handler_type());
41 handler->set_uwsgi_task(
this);
42 processor_type proc(handler);
46 if (proc.process(in_protocol, out_protocol, NULL)) {
51 }
catch (TTransportException& e) {
53 std::string(
"TTransportException: ") + std::string(e.what()));
68 #endif // _THRIFT_PROCESSOR_H_
http_response & response()
uwsgi_request * request_p()
void set_status(std::string status)
void set_header(std::string header, std::string value)
virtual bool handle_request()
void send_response()
Send the resonse back.
The base class for the uwsgi protocol implementation.
void set_exception(tasks_exception &e)
Set an exception to report an error.
http_response * response_p()
uwsgi_thrift_processor(net::socket &s)