#include <Main/globals.hxx>
#include <Main/util.hxx>
+#include <Network/HTTPClient.hxx>
#include <Viewer/renderer.hxx>
#include <osgDB/ReadFile>
return 0;
}
+ //----------------------------------------------------------------------------
+ simgear::HTTP::Client* FGCanvasSystemAdapter::getHTTPClient() const
+ {
+ FGHTTPClient* http =
+ static_cast<FGHTTPClient*>(globals->get_subsystem("http"));
+
+ if( http )
+ return http->client();
+
+ SG_LOG( SG_IO,
+ SG_ALERT,
+ "FGCanvasSystemAdapter: Failed to get HTTP subsystem" );
+ return 0;
+ }
+
}
virtual void addCamera(osg::Camera* camera) const;
virtual void removeCamera(osg::Camera* camera) const;
virtual osg::Image* getImage(const std::string& path) const;
+ virtual simgear::HTTP::Client* getHTTPClient() const;
};
}
naRef initNasalHTTP(naRef globals, naContext c)
{
using simgear::HTTP::Request;
+ typedef Request* (Request::*HTTPCallback)(const Request::Callback&);
NasalRequest::init("http.Request")
.member("url", &Request::url)
.member("method", &Request::method)
.member("reason", &Request::responseReason)
.member("readyState", &Request::readyState)
.method("abort", static_cast<void (Request::*)()>(&Request::abort))
- .method("done", &Request::done)
- .method("fail", &Request::fail)
- .method("always", &Request::always);
+ .method("done", static_cast<HTTPCallback>(&Request::done))
+ .method("fail", static_cast<HTTPCallback>(&Request::fail))
+ .method("always", static_cast<HTTPCallback>(&Request::always));
using simgear::HTTP::FileRequest;
NasalFileRequest::init("http.FileRequest")