Thanks for the reply, do you mean something like this, but not this, this does 
not work:

void BlogRSSFeed::handleRequest(const Wt::Http::Request &request, 
Wt::Http::Response &response)
{
    const Wt::WEnvironment& env = Wt::WApplication::instance()->environment();
    Wt::WApplication *app = new Wt::WApplication(env); 
    Wt::WApplication::UpdateLock lock(app);
    if (lock)
    {
        app->messageResourceBundle().use("./app_root/ww-home", false);
    }
    // you can see I need to make my blog feed Multilingual, this is why I am 
doing all this 
    std::string url          = Wt::WString::tr("rss-url").toUTF8();
    std::string title_       = Wt::WString::tr("rss-title").toUTF8();
    std::string description_ = Wt::WString::tr("rss-description").toUTF8();
    ...
}

It crashes at the 1st line, 
my guess is that it does not like Wt::WApplication::instance()
Doesn't work
Wt::WApplication.environment()
and just to be honest, this is not very intuitive example,
since WApplication requires and WEnvironment, 
and WEnvironment requires an WApplication, 
its like what came firs the Chicken or the Egg,
I can't define just the WEnvironment, 
const Wt::WEnvironment& env = new Wt::WEnvironment();
I have tried every combination I can think of.

I have asked many time in many different scenarios how to create an 
WApplication object,
from a class that is not derived from WApplication, 
because I have never been able to figure it out,
and this is the main issue I am having and I can not find an answer in the 
forums, 
or any other post, nor could I find an example of anyone ever doing this,
so it would really help if someone could tell me that one line of code that 
will make this work?

I understand that this resource is stand alone, 
so deriving it from WApplication is not really an option,
yet this effects your own website, since its the same code,
and I notice you did not make the blog feed Multilingual,
and now I must ask why, 
since I figure you may have run into the same problem,
otherwise you would have done it yourself,
and least that is my thinking,
so my question is can this be done,
and if so how?

Thanks


On Wed, 2014-06-25 at 02:07 +0400, Nagaev Boris wrote:

> Hello!
> 
> Take application lock (Wt::WApplication::UpdateLock) from
> handleRequest() if you change WApplication (by changing message
> resource bundle). Multiple requests may happend simultaneously for a
> single resource.
> 
> To get WEnvironment from WApplication, use method environment().
> See 
> http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WApplication.html
> for full description of WApplication.
> 
> To get translated strings, use WString::tr() method. It works even in
> handleRequest().
> 
> 
> -
> Best regards,
> Boris Nagaev
> 
> 
> On Tue, Jun 24, 2014 at 7:01 AM, Jeffrey Scott Flesher Gmail
> <jeffrey.scott.fles...@gmail.com> wrote:
> > In the Example BlogRSSFeed, I want to use messageResourceBundle,
> > so in
> > BlogRSSFeed::handleRequest
> >
> > Wt::WApplication *app = Wt::WApplication::instance();
> > app->messageResourceBundle().use("appPath", false);
> >
> > I get a runtime error.
> >
> > Any ideas on how I can get this to function correctly?
> >
> > Also I don't know how to get an instance of WEnvironment from any class not
> > derived from WApplication, do you?
> > If I did, I could write a class to return the tr strings.
> >
> > Thanks
> > _______________________________________________
> > witty-interest mailing list
> > witty-interest@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/witty-interest
> >
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to