Re: [Wt-interest] How to access server variable from inside a WApplication constructor

2014-03-11 Thread Jeffrey Scott Flesher Gmail
Thanks that worked, now to integrate this into the program, the blog is now ready to use, one step at a time, this CMS is coming together, thanks for all the help. On Tue, 2014-03-11 at 10:35 +0400, Nagaev Boris wrote: > Hello, > > > > you can get hostname using Request::headerValue("Host"). >

Re: [Wt-interest] How to access server variable from inside a WApplication constructor

2014-03-10 Thread Nagaev Boris
Hello, you can get hostname using Request::headerValue("Host"). env.hostName() does not work, because you have no WEnvironment and WApplication objects in handleRequest() of global resource. On Tue, Mar 11, 2014 at 9:43 AM, Jeffrey Scott Flesher Gmail < jeffrey.scott.fles...@gmail.com> wrote:

Re: [Wt-interest] How to access server variable from inside a WApplication constructor

2014-03-10 Thread Jeffrey Scott Flesher Gmail
In function handleRequest, const Wt::Http::Request &request has several options, but none seem to return the URL, request.serverName() returns the server name, which is not the URL, so how do I get the URL name if I can not use env.hostName()? I noticed that if URL is not passed in, you have an if

Re: [Wt-interest] How to access server variable from inside a WApplication constructor

2014-03-10 Thread Jeffrey Scott Flesher Gmail
Hit send instead of save, disregard last message, sorry. Thanks for the tip on map, I am working on it now. On Mon, 2014-03-10 at 15:32 +0400, Nagaev Boris wrote: > Hello, > > > addChild(&rssFeed); > > > you should not use addChild with objects created on stack. > > addChild must be applied

Re: [Wt-interest] How to access server variable from inside a WApplication constructor

2014-03-10 Thread Jeffrey Scott Flesher Gmail
I wrote a function to map to connection pool, great idea thanks, I will have to rewrite BlogRSSFeed to not take any parameters, and use a map instead, but now my problem is BlogRSSFeed is derived from Wt::WResource, so env.hostName() is not accessible, so how do I tell handleRequest what the URL is

Re: [Wt-interest] How to access server variable from inside a WApplication constructor

2014-03-10 Thread Nagaev Boris
Hello, > addChild(&rssFeed); you should not use addChild with objects created on stack. addChild must be applied to dynamicaly allocated objects. You should create resource, wApp->addChild(resource) to prevent memory leak of resouce object. Then set internal path. But for RSS, you should not bin

Re: [Wt-interest] How to access server variable from inside a WApplication constructor

2014-03-09 Thread Jeffrey Scott Flesher Gmail
I am trying to write a CMS, my idea of how to handle multiple domains was to create an XML file which I read in the constructor of home in the wt-home example, so it uses the env.hostName() to get the name of the key id, if it fails to find a key id, it will use a default or just return a 404 error

Re: [Wt-interest] How to access server variable from inside a WApplication constructor

2014-03-09 Thread Nagaev Boris
Hello! > How do I bind the resource to the session, is there a function like > addResource that does the same thing? You can do this using application->addChild(resource) (this makes application to delete resource when it is deleted, normal memory management). Use WResource::setInternalPath to set

Re: [Wt-interest] How to access server variable from inside a WApplication constructor

2014-03-09 Thread Jeffrey Scott Flesher Gmail
> If you want session-specific resource, you should bind it to session (parent with application object and use WResource::url() to get URL. How do I bind the resource to the session, is there a function like addResource that does the same thing? > If you need database session for you resource, thi

Re: [Wt-interest] How to access server variable from inside a WApplication constructor

2014-03-08 Thread Nagaev Boris
Hello, at least, you should not change WServer from WApplication. Methods addResource and addEntryPoint should be called before server start (WServer::start()). If you want session-specific resource, you should bind it to session (parent with application object and use WResource::url() to get URL.

[Wt-interest] How to access server variable from inside a WApplication constructor

2014-03-08 Thread Jeffrey Scott Flesher Gmail
Moving the code in example wt-home from main into the home which is derived from WApplication, in order to setup the database based on URL, I found this crashes the system randomly, here is the Code: BlogRSSFeed rssFeed(*blogDb_, "Witty Wizard blog", "http://wittywizard.org/wt/blog";, "Witty Wi