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 internal path for this resouce. Please note the resouce will be available only from current session in this case.
> In my case I use the environment env.hostName() to get the database > connection, so this causes me to change where I need to add this resource. env.hostName() is hostname passed in Host HTTP header. Why do you need it to connect to your database? Using Host header to determine database address may be dangerous, since everyone can tamper with Host header making your Wt application to connect to wrong database server. Wt application should know database connection parameters itself. On Mon, Mar 10, 2014 at 1:39 AM, Jeffrey Scott Flesher Gmail <jeffrey.scott.fles...@gmail.com> wrote: >> 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, this session object should >> be created along with the resource. > In my case I use the environment env.hostName() to get the database > connection, so this causes me to change where I need to add this resource. > > Thanks for any help. > > > On Sun, 2014-03-09 at 11:23 +0400, Nagaev Boris wrote: > > 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. If you want server-global resource, you > should initialize it and bind to server using addResource BEFORE > server start. If you need database session for you resource, this > session object should be created along with the resource. > > Regards, > Boris Nagaev > > > On Sun, Mar 9, 2014 at 4:50 AM, Jeffrey Scott Flesher Gmail > <jeffrey.scott.fles...@gmail.com> wrote: >> 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 Wizard Content Management System >> (CMS)"); >> env.server()->addResource(&rssFeed, "/wt/blog/feed/"); >> >> Is this the correct way to call addResource from the Constructor of home? >> >> Thanks for any help. >> >> >> >> ------------------------------------------------------------------------------ >> Subversion Kills Productivity. Get off Subversion & Make the Move to >> Perforce. >> With Perforce, you get hassle-free workflows. Merge that actually works. >> Faster operations. Version large binaries. Built-in WAN optimization and >> the >> freedom to use Git, Perforce or both. Make the move to Perforce. >> >> http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk >> _______________________________________________ >> witty-interest mailing list >> witty-interest@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/witty-interest >> > > ------------------------------------------------------------------------------ > Subversion Kills Productivity. Get off Subversion & Make the Move to > Perforce. > With Perforce, you get hassle-free workflows. Merge that actually works. > Faster operations. Version large binaries. Built-in WAN optimization and > the > freedom to use Git, Perforce or both. Make the move to Perforce. > http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk > _______________________________________________ > witty-interest mailing list > witty-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/witty-interest > > > ------------------------------------------------------------------------------ > Subversion Kills Productivity. Get off Subversion & Make the Move to > Perforce. > With Perforce, you get hassle-free workflows. Merge that actually works. > Faster operations. Version large binaries. Built-in WAN optimization and > the > freedom to use Git, Perforce or both. Make the move to Perforce. > http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk > _______________________________________________ > witty-interest mailing list > witty-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/witty-interest > ------------------------------------------------------------------------------ Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest