I have multiple URLs accessing the same App, so I need a separate
appRoot (I can do this now, since I am accessing it through code) so I
can load the correct Templates for that URL and docRoot or resource for
each URL so I can have css, images and other static resources to be
unique to the URL.
css I can probably us useStyleSheet, not sure how much static resources
this will work for, but I have mp3, m4v, pdf, iso ... files as well as
images to account for.

but all the other static files I am not sure how to handle that, without
changing either docRoot or resources.

I also want the RSS Feed to be Translated, which the Wt site should
also, it makes no sense to not do that, unless you can not figure out a
way to do it, which is where I am at now.

This Library seems to be hard coded for only one appRoot, docRoot and
resource, this is very limiting unless you have another mechanism to
overwrite this behavior, by allowing each url to define its base folder,
you can avoid all this, but I do not see anywhere that you even take a
base folder into consideration, it seems to be based on the executable's
folder or relative to it, so adding a feature to define the base folder
would be the best option, since appRoot, docRoot and resource are all
relative to the base folder, this lifts that limit, but since I did not
find anything like this in the library, I started to hack what I could
find, but ran into this problem with WApplication, so what you are
saying is you can not access WApplication from outside the event loop,
which I seem to have verified, and why I keep asking this same question
over and over, because I was lead to believe it was possible if only I
knew how.

Do you have anything in the Library that can change the base Folders
location to be other then the executable's path?
Or do you know a better way to do this?

Thanks 

On Tue, 2014-07-01 at 16:10 +0400, Nagaev Boris wrote:
> Hello!
> 
> 
> 
> Changing server-global parameters (like docRoot) on per-application
> basis (from application event loop) is not supported. Could you tell
> more details about why you want this feature, so I can find more
> suitable workaround, please? For example, there are other options to
> keep multiple servers or applications inside one process or to change
> static files used (CSS theme).
> 
> 
> 
> Remember, WApplication::instance() aka wApp must be accessed only from
> application event loop, not from server-global code. And second, you
> should never create application manually. If you do not follow these
> rules, you'll get segfault.
> 
> 
> -
> Best regards,
> Boris Nagaev
> 
> 
> 
> 
> On Tue, Jul 1, 2014 at 12:04 AM, Jeffrey Scott Flesher Gmail
> <[email protected]> wrote:
> 
>         I need to use Wt::WApplication from a standalone function:
>         
>         In Configuration.C in need to change docRoot based on the URL (see 
> http://redmine.emweb.be/issues/3404):
>         
>         void Configuration::readOptions(const po::variables_map& vm)
>         {
>           if (vm.count("docroot"))
>           {
>             docRoot_ = vm["docroot"].as<std::string>();
>         
>          std::string myCDR;
>          // Get host Name
>          // const Wt::WEnvironment& env = new Wt::WEnvironment(); // is 
> protected, so you can not do this
>          Wt::WApplication *app = new Wt::WApplication(env);
>          Wt::WApplication *app = Wt::WApplication::instance();
>         
>         both of these cause segment fault
>         did not really get this far, since it crashed before even getting here
>         
>          MyApplication* myapp = boost::polymorphic_downcast(app);
>         
>         I want to change the docRoot based on the URL
>          std::string domainName = app->environment().hostName().c_str();
>          // Remove Port if it exist
>          unsigned pos = domainName.find(":");
>          if (pos > 0)
>            domainName = domainName.substr(0, pos);
>          // Now do a look up
>          if (!Wt::WApplication::readConfigurationProperty("customDocRoot-" + 
> domainName, myCDR))
>              Wt::log("error") << "WApplication::docRoot() 
> readConfigurationProperty not found customDocRoot-" << domainName << " in 
> wt_config.xml";
>          if (!myCDR.empty())
>            docRoot_ = myCDR.c_str();
>         
>         Since all I really need is a way to get the domainName and read from 
> wt_config, there might be other options.
>         ***
>         
>         Another example I never got to work is here
>         In BlogRSSFeed.C constructor, I need to change the 
> messageResourceBundle, ever attempt I make crashes with segment fault:
>           const Wt::WEnvironment& env = 
> Wt::WApplication::instance()->environment(); // segment fault WEnvironment& 
> WApplication::env()
>           Wt::WApplication *app = new Wt::WApplication(env);
>         or
>           Wt::WApplication* app = Wt::WApplication::instance(); // segment 
> fault
>         
>           Wt::WApplication::UpdateLock lock(app);  // 
> Wt::WApplication::instance() ~ segment fault in UpdateLock: impl_ = new 
> UpdateLockImpl(app);
>           if (lock) {
>                 app->messageResourceBundle().use(myDomainPath[domainName] + 
> "app_root/ww-home", false);
>           }
>         
>         I actually thought that maybe I could something like this:
>         server.addResource(&rssFeed, "/" + rootPrefix + "en/blog/feed/");
>         server.addResource(&rssFeed, "/" + rootPrefix + "cn/blog/feed/");
>         server.addResource(&rssFeed, "/" + rootPrefix + "ru/blog/feed/");
>         then just change the links in the app, or use a cookie to read what 
> language it is, not sure what is best, 
>         cookies are not so good, but I need a way to know what language they 
> want, which is not necessarily the default browsers language.
>         
>         I am sure that there is a way to do this, Boris gave me a good 
> description of how to go about doing this, 
>         but he is making me feel stupid, because ever way I try it, it still 
> crashes.
>         
>         I am stuck, and I really need to find a way to do this, I need an 
> example that does not produce a segment fault in these functions,
>         everyone says its easy, no problem just do this, well all I get is 
> crashes, I am sure once I see the right way of doing it,
>         it will then click in, but until then, I am stuck.
>         
>         Thanks
>         
>         
>         
> ------------------------------------------------------------------------------
>         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
>         [email protected]
>         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 
> [email protected] 
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to