Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // global scope
- boost::shared_ptr<HTTP::HTTPService> PhotoUploaderPlugin::globalHTTPService;
- boost::weak_ptr<ProxyHandler> PhotoUploaderPlugin::globalProxyHandler;
- void PhotoUploaderPlugin::StaticInitialize()
- {
- // Place one-time initialization stuff here; note that there isn't an absolute guarantee that
- // this will only execute once per process, just a guarantee that it won't execute again until
- // after StaticDeinitialize is called
- globalHTTPService = HTTP::HTTPService::create("127.0.0.1", 0, K_LOCALHOST); // Auto-select port
- boost::shared_ptr<ProxyHandler> proxy(boost::make_shared<ProxyHandler>());
- globalProxyHandler = proxy;
- globalHTTPService->registerHandler(proxy);
- }
- void PhotoUploaderPlugin::StaticDeinitialize()
- {
- // Place one-time deinitialization stuff here
- globalHTTPService->terminate();
- globalHTTPService.reset(); // Release the shared_ptr
- }
- // Later on (for example in your API class) to get the URI of the web server:
- FB::URI base_uri = getPlugin()->m_http->getBaseUri();
- // Note that getPlugin() is the function generated by default in your
- // root JSAPI class that returns an instance to your plugin object
Add Comment
Please, Sign In to add comment