Hey,
2015-07-04 4:09 GMT+02:00 K. Frank <kfrank2...@gmail.com>:
> Just to confirm, is the following the minimal wthttpd server?
>
> #include <Wt/WApplication>
> #include <Wt/WEnvironment>
>
> using namespace Wt;
>
> WApplication *createApplication(const WEnvironment& env) {
> return new WApplication (env);
> }
>
> int main (int argc, char **argv) {
> return WRun (argc, argv, &createApplication);
> }
>
> Note, I do not derive from WApplication -- I just instantiate a plain
> WApplication and pass it to WRun. (Of course my app has no
> dynamic content, but I guess the WApplication is the wthttpd server
> and the call to WRun starts it up. Is this correct?
>
You should even be able to do like this (without a callback):
int main (int argc, char **argv) {
WServer server(argc, argv, WTHTTP_CONFIGURATION);
if (server.start()) {
WServer::waitForShutdown();
server.stop();
}
return 0;
}
But later you will have a dynamic application, so your solution might then
be better.
WRun(), or server.start(), starts the httpd server. The createApplication()
callback
is used only for the dynamic sessions -- for each session there's a call to
this callback
function.
> If I had set "--deploy-path=/" (rather than "--deploy-path=/dummy")
> then "http://localhost/" would have shown the "blank" web page of
> the "empty" WApplication app. (To see index.html I would have to
> use "http://localhost/index.html".)
>
> Is this all correct?
>
Yes.
> You will need to implement a main() function to instantiate the server.
>
> Just to confirm, main needs to call WRun with a pointer to a function
> that returns a (pointer to a) WApplication object. (That is, there is not,
> for example, some function call such as WApplication::start_wthttpd()
> that starts an "empty" wthttpd server.) Is this correct?
>
There is, see above. WRun() simply instantiates a server, configures and
starts it.
Regards,
koen
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest