views:

198

answers:

2

I'm trying to run the source version of my qooxdoo application from a web server. The application works fine when loaded from the file system but fails to load, when started from a web server.

+3  A: 

The source version is run off of the file system most of the time (i.e. opening it with the file: protocol in your browser). The source script just references source code and resources with relative paths, wherever they happen to be on your file system. This usually doesn’t lend itself well to being run from a web server. Even if you include the source directory of your application in an server-accessible path (somewhere down from its DocumentRoot or one of the defined Aliases), chances are that the source script references files which are outside the document scope of the web server.

So if you find yourself in the situation where you need to run a source version of your app from a web server, mind the following hints:

  • Make the source directory of your application accessible to the web server, so that it is reachable through a valid URL like http://your.web.server/path/to/yourapp/source/index.html.

  • Make sure all components that are used by your application, as there are the qooxdoo SDK itself, and any additional qooxdoo library or contribution that you use, are equally accessible by the web server.

    • In the case of contribs referenced through the contrib:// pseudo protocol in your application configuration, these are downloaded and stored in the download cache directory (config key cache/downloads), so make sure this path is included in your considerations.
  • Make sure the relative paths on the web server match those on your file system, e.g. if your app lives on the file system at /a/b/A/myapp and your qooxdoo installation is at /a/b/Z/qooxdoo-sdk and the server path to your app is /web/apps/myapp then make sure the server path to qooxdoo is /web/Z/qooxdoo-sdk so that relative references like ../Z/qooxdoo-sdk will work under the web server.

A simple way to achieve this is to map the DocumentRoot or an Alias to a directory in your file system that is a common parent to all involved qooxdoo components of your app.

Fabian Jakobs
+4  A: 

Lets say you have the qooxdoo framework in: /usr/pack/qooxdoo-1.0/frontend and your application in /home/user/myproject. Now add a symbolic link into the application directory like this:

ln -s ../../../../../../../usr/pack/qooxdoo-1.0/frontend qooxdoo

In the config.json file set the QOOXDOO_PATH to qooxdoo

In that way, all references to qooxdoo source should work regardless of the apparent depth of the local root. For the webserver you may have to allow FollowSymlink or something appropriate ...

PS this approach has the neat side effect of making your application also work when started on windows via \\server\user\myproject\source\index.html

Tobi Oetiker