http://redmine.emweb.be/http://redmine.emweb.be/favicon.ico?16934085252013-06-20T12:40:35ZRedmineWt - Support #1992: Add static resource to main application pathhttp://redmine.emweb.be/issues/1992?journal_id=56432013-06-20T12:40:35ZVitaly Volochaydhnotimba@yandex.ru
<ul></ul><p>And the other question is: what is a best way to pass data from static resource to WApplication.<br><br>
I thought about 2 ways:<br><br>
1) Emit signal from WResource::handleRequest() and somehow connect it with WApplication;<br><br>
2) Use WServer::post from WResource::handleRequest() for post data to same session.</p>
Wt - Support #1992: Add static resource to main application pathhttp://redmine.emweb.be/issues/1992?journal_id=56642013-06-22T19:02:31ZKoen Deforchekoen@emweb.be
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Feedback</i></li><li><strong>Assignee</strong> set to <i>Koen Deforche</i></li></ul><p>Hey,</p>
<p>By default, the application is deployed at '/' but you can change that using the ---deploy-path parameter, or by deploying the application on a different path using WServer API.</p>
<p>As to your second question, definitely the second method (2) is what you should do.</p>
<p>Regards,<br><br>
koen</p>
Wt - Support #1992: Add static resource to main application pathhttp://redmine.emweb.be/issues/1992?journal_id=58142013-07-08T13:55:06ZVitaly Volochaydhnotimba@yandex.ru
<ul></ul><p>Trying to process http requests like this:</p>
<p><code>Wt::WServer server(argv[0]);<br>
WebAppResource resource;<br>
server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);<br>
server.addEntryPoint(Wt::Application, createApplication);<br>
server.addResource(&resource, "/service");<br>
server.start()</code></p>
<p>and:<br><br>
void WebAppResource::handleRequest(const Request& request, Response& response)<br><br>
{<br><br>
MyWebApplication* app = dynamic_cast<MyWebApplication*>(WApplication::instance());<br><br>
WServer* server = WServer::instance();<br><br>
if (app && server)<br><br>
{<br><br>
server~~post(app~~>sessionId(), boost::bind(&MyWebApplication::processHttp, app,<br><br>
WString(request.queryString())));<br><br>
}<br><br>
}</p>
<p>but when 'handleRequest' is called WApplication::instance() always returns null-pointer although it allready created, so I can't post event. What should i do?</p>
Wt - Support #1992: Add static resource to main application pathhttp://redmine.emweb.be/issues/1992?journal_id=58152013-07-08T14:42:13ZKoen Deforchekoen@emweb.be
<ul></ul><p>Hey,</p>
<p>a static resource is not linked to a WApplication, and thus WApplication::instance() is null by definition. Also, handleRequest() expects a response so you need to provide one by the time the function exits (or create a continuation otherwise).</p>
<p>What do you really want to do? Perhaps you want to set a cookie from the WApplication which you then check in the resource request which identifies the application context in which the request is to be handled?</p>
<p>What's the use-case? Why not use a normal dynamic WResource() within the application context?</p>
<p>Regards,<br><br>
koen</p>
Wt - Support #1992: Add static resource to main application pathhttp://redmine.emweb.be/issues/1992?journal_id=60072013-07-30T11:56:22ZVitaly Volochaydhnotimba@yandex.ru
<ul></ul><p>Thanks for your answer I find another way to solve my problem.</p>
Wt - Support #1992: Add static resource to main application pathhttp://redmine.emweb.be/issues/1992?journal_id=60332013-07-31T09:49:45ZKoen Deforchekoen@emweb.be
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Closed</i></li><li><strong>Target version</strong> deleted (<del><i>3.3.0</i></del>)</li></ul>