http://redmine.emweb.be/http://redmine.emweb.be/favicon.ico?16934085252014-03-11T02:06:31ZRedmineWt - Feature #2754: WServer.addApplication()http://redmine.emweb.be/issues/2754?journal_id=84282014-03-11T02:06:31ZI. Lazaridisinfo@lazaridis.com
<ul></ul><p>from <a class="message" href="http://redmine.emweb.be/boards/1/topics/8655?r=8692#message-8692">RE: Blog Examples and Wt Best Practices</a></p>
<blockquote>
<p>> > >In this high-level code, one should not be forced to use "boost::bind(&createApplication, _1, blogDb)". This is just too much (this could be simplified, by changing the API call).</p>
<p>> > I don't understand the comment about boost::bind(): how could the API be changed to avoid this?<br><br>
><br><br>
> It starts with saying: "I want this, thus it's simpler for users". Then it's either solvable, or not. The ideal thing would be something like:<br><br>
><br><br>
> server.add(MyWtApplication, "/mypath")<br><br>
><br><br>
> (I'll open a topic on this, as this interests me technically, too) </p>
<p>And MyWtApplication is a class or a function?</p>
</blockquote>
<p>Don't know yet. The matter is general (at this point) and the question is:</p>
<p>If there is a solution to this, would you accept it?</p>
Wt - Feature #2754: WServer.addApplication()http://redmine.emweb.be/issues/2754?journal_id=84332014-03-11T09:17:39ZKoen Deforchekoen@emweb.be
<ul></ul><p>I. Lazaridis wrote: </p>
<blockquote>
<p>> And MyWtApplication is a class or a function? </p>
<p>Don't know yet. The matter is general (at this point) and the question is: </p>
<p>If there is a solution to this, would you accept it?</p>
</blockquote>
<p>Yes.</p>
<p>Although I would probably be inclined to rather use this to simplify WRun() as for example used in the hello world example, than to simplify WServer.</p>
<p>The idea would then be to simplify:</p>
<pre><code>WApplication *createApplication(const WEnvironment& env)
{
return new HelloApplication(env);
}
int main(int argc, char **argv)
{
return WRun(argc, argv, &createApplication);
}
</code></pre>
<p>with</p>
<pre><code>int main(int argc, char **argv)
{
return WRun(argc, argv, HelloApplication);
}
</code></pre>
<p>Regards,<br><br>
koen</p>
Wt - Feature #2754: WServer.addApplication()http://redmine.emweb.be/issues/2754?journal_id=84362014-03-11T10:26:11ZI. Lazaridisinfo@lazaridis.com
<ul></ul><p>This sounds like a better starting point.</p>
<p>With no additional parameters, one can already write this:</p>
<pre><code>int main(int argc, char **argv)
{
return WRun(argc, argv, HelloApplication::create);
}
</code></pre>
<p>HelloApplication has to provide a static create function:</p>
<pre><code>static WApplication *create(const WEnvironment& env)
{
return new HelloApplication(env);
}
</code></pre>
<p>The next step would be to try to eliminate the "::create" part in the WRun (possibly not possible).</p>
<p>Then to find a way for handling the additional parameters without the need of bind (and without any magic), etc. etc.</p>
<p>I know myself, I will not find peace if I don't find a solution for this (which makes everyone happy, users, you, me).</p>