从 Web 服务器运行 qooxdoo 源版本

发布于 2024-08-18 01:13:17 字数 79 浏览 3 评论 0原文

我正在尝试从 Web 服务器运行 qooxdoo 应用程序的源版本。该应用程序在从文件系统加载时工作正常,但在从 Web 服务器启动时无法加载。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

手心的温暖 2024-08-25 01:13:17

假设您的 qooxdoo 框架位于:/usr/pack/qooxdoo-1.0/frontend 中,您的应用程序位于 /home/user/myproject 中。现在将符号链接添加到应用程序目录中,如下所示:

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

在 config.json 文件中将 QOOXDOO_PATH 设置为 qooxdoo

这样,所有引用无论本地根的表观深度如何,qooxdoo 源都应该可以工作。对于网络服务器,您可能必须允许 FollowSymlink 或适当的东西...

PS 这种方法有一个巧妙的副作用,即使您的应用程序在通过 \\server\user\myproject\source\index.html 在 Windows 上启动时也可以工作

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

開玄 2024-08-25 01:13:17

源版本大部分时间都在文件系统上运行(即在浏览器中使用 file: 协议打开它)。源脚本仅使用相对路径引用源代码和资源,无论它们位于文件系统上的任何位置。这通常不太适合从 Web 服务器运行。即使您将应用程序的源目录包含在服务器可访问的路径中(位于其 DocumentRoot 或定义的别名之一的某个位置),源脚本引用的文件也可能超出 Web 服务器的文档范围。

因此,如果您发现自己需要从 Web 服务器运行应用程序的源版本,请注意以下提示:

  • 使 Web 服务器可以访问应用程序的源目录,以便可以访问它通过有效的 URL,如 http://your.web.server/path/to/yourapp/source/index.html

  • 确保您的应用程序使用的所有组件(包括 qooxdoo SDK 本身以及您使用的任何其他 qooxdoo 库或贡献)均可以由 Web 服务器访问。

    • 如果您的应用程序配置中通过 contrib:// 伪协议引用了 contribs,这些内容将被下载并存储在下载缓存目录(config key cache/downloads)中,因此请确保您的考虑因素中包含此路径.
  • 确保网络服务器上的相对路径与您的文件系统上的相对路径相匹配,例如,如果您的应用程序位于以下文件系统上
    /a/b/A/myapp
    你的 qooxdoo 安装位置是
    /a/b/Z/qooxdoo-sdk
    您的应用程序的服务器路径是
    /web/apps/myapp
    然后确保 qooxdoo 的服务器路径是
    /web/Z/qooxdoo-sdk
    这样 ../Z/qooxdoo-sdk 这样的相对引用将在 Web 服务器下工作。

实现此目的的一个简单方法是将 DocumentRoot 或别名映射到文件系统中的目录,该目录是应用程序中所有涉及的 qooxdoo 组件的公共父目录。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文