在我们的应用程序中,我们使用 Sencha GXT和GWT 2.7 .
不幸的是,弹出窗口中经常显示以下错误:
Download of /path/deferredjs/SOMEGENERATEDID failed with status 404 ("Script Tag Failure - no status available")
它似乎只在部署新版本的应用程序时才会发生。清除浏览器缓存可以解决问题。
我发现这个错误发生在类ScriptTagLoadingStrategy.java
中在 GWT 中。
除了每次发生此问题时清除浏览器缓存之外,还有其他方法可以解决此问题吗?
最佳答案
您的 HTTP 服务器有关缓存的配置似乎未正确配置为与 GWT 配合使用。
-
*.nocache.*
不应该被缓存 - .cache.可以安全地缓存
文档中还有 Apache HTTP 服务器的示例配置。
*.nocache.js
文件是 a bootstrap script :
This file is responsible for choosing the correct version of your application to load for your client based on their browser and locale (...). The various versions of your application compliant to each browser / locale are the
<md5>.cache.html
application files.
简而言之:引导文件每次编译都会更改,并且是应用程序的“网关”。它选择哪个<md5>.cache.*
要加载的应用程序版本。它的名称必须是不变的,因为您是从主机页面引用它的。自 <md5>.cache.*
文件的名称会随着每次源代码的更改而更改(因为其名称是其内容的 MD5 哈希值),因此可以安全地缓存它们。
所以发生的情况是旧的引导脚本被缓存(并加载而不是新的),并且它试图加载应用程序的旧版本(*.cache.*
文件之一)。但是,这些文件可能已被编译/重新部署删除,因此 404
.
关于java - GWT 应用程序中出现错误 HTTP 404 ("Script Tag Failure - no status available"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28875651/