23 #include "webview_reqproc.h" 24 #include <core/exception.h> 25 #include <logging/logger.h> 26 #include <webview/error_reply.h> 27 #include <fawkes_msgs/WebviewProcessRequest.h> 50 std::string &srv_name)
53 __srv_name = srv_name;
54 __logcomp = std::string(
"ROSWebviewRP[") + srv_name +
"]";
56 __srv_client = nh->serviceClient<fawkes_msgs::WebviewProcessRequest>(srv_name);
62 __srv_client.shutdown();
70 fawkes_msgs::WebviewProcessRequest srv;
71 srv.request.url = request->
url();
78 if (! __srv_client.exists()) {
80 "Service %s is no longer available",
83 }
else if (__srv_client.call(srv)) {
86 if (srv.response.wrap_in_page) {
95 std::vector<std::string>::iterator h;
96 for (h = srv.response.headers.begin(); h != srv.response.headers.end(); ++h)
108 "Execution of service %s failed: %s",
110 srv.response.error.c_str());
114 "Execution of service %s failed",
Fawkes library namespace.
ROSWebviewRequestProcessor(fawkes::LockPtr< ros::NodeHandle > nh, fawkes::Logger *logger, std::string &baseurl, std::string &srv_name)
Constructor.
void add_header(std::string header, std::string content)
Add a HTTP header.
virtual ~ROSWebviewRequestProcessor()
Destructor.
Base class for exceptions in Fawkes.
virtual fawkes::WebReply * process_request(const fawkes::WebRequest *request)
Process a request.
Web request meta data carrier.
const std::string & url() const
Get URL.