Hey Pau,

2008/7/6 Pau Garcia i Quiles <[EMAIL PROTECTED]>:
>>> Am I wrong? Shouldn't "--docroot" be enforced? Or maybe something like
>>> BinReloc ( http://autopackage.org/docs/binreloc/ ) to use the
>>> directory where the binary is as the root? (I like docroot enforced
>>> better, FWIW)
>>
> Sorry, I didn't explain exactly well :-)
>
> Look for instance at the 'composer' example, in ComposeExample.C:
>
>   WApplication *app = new WApplication(env);
>   app->messageResourceBundle().use("composer");
>   app->useStyleSheet("composer.css");
>
> As no path is specified, WApplication::useStyleSheet looks for
> 'composer.css' in the directory you are when you start the
> application, not in docroot, not where the binary is. Same thing for
> WMessageResourceBundle::use. That's the problem I found: I was
> expecting Wt to look for composer.xml and composer.css in docroot.

Now I get it.

> WApplication::docroot returning a string with the docroot, then
> loading the XML, CSS, CSV files, etc like this:
>
>   WApplication *app = new WApplication(env);
>   app->messageResourceBundle().use(app->docroot() + "composer");
>   app->useStyleSheet(app->docroot() + "composer.css");
>
> Then, in the 'charts' example, you'd do:
>   std::istream << ( app->docroot() + "file.csv" )

Unfortunately, as far as I can tell, there is no robust way to
implement docroot() when using the FastCGI adapter...

The --docroot is really something that affects the web server, and I
think it should not be confused with paths that are important to the
application. For example, the above example makes the assumption that
--deploy-path='/', you would probably want something that combines
docroot and deploy-path to get to the physical location of the
application, but then why go through all the trouble if 'binreloc'
does exactly that.

But since Wt itself does not do anything with the information provided
by 'binreloc', it is perhaps wiser to add binreloc() to your
application if you want that and leave it out of the library (it is
nothing related to Web Toolkit stuff) ?

I think --docroot and the location where you read files should not
necessarily be the same. In fact, only files that need to be served by
the web server should be in docroot, and anything else should ideally
be out of the docroot? That is not how the examples, for simplicity,
are organized, but adding an API and coding the examples to that API
would be even worse ?

Regards,
koen

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to