*.nocache.js 不会重新加载最新的代码更改(使用 Restlet 和 GWT)



我用Eclipse创建了一个示例GWT+AppEngine项目,并添加了一个contact.gwt.xml文件作为客户端。它是相应的*.contact.nocache.jscontact.html创建的,但未使用代码更改进行更新。我正在内部码头服务器上的本地主机上运行它。

这是我的文件。

联系方式.html

<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>contact</title>
<script type="text/javascript" laguage="javascript"
    src="contact/org.restlet.example.firstapplication.contact.nocache.js?dummyTimeParam=<%=System.currentTimeMillis() %>"></script>
</head>
<body>
    <h1>About a contact</h1>
    <table>
        <tr>
            <th>Contact 102</th>
            <th>Home address</th>
        </tr>
        <tr>
            <td id="contactContainer" style="vertical-align: top"></td>
            <td id="homeAddressContainer"></td>
        </tr>
        <tr>
            <td id="buttonContainer" colspan="2"></td>
        </tr>
    </table>
</body>
</html>

联系.GWT.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name="com.google.gwt.user.User" />
    <inherits name="org.restlet.Restlet" />
    <source path="client" />
    <source path="shared" />
    <inherits name='com.google.gwt.user.theme.clean.Clean' />
    <entry-point class='org.restlet.example.firstapplication.client.ContactModule' />
      <!-- allow Super Dev Mode -->
      <add-linker name="xsiframe"/>
</module>

appengine.web的相关部分.xml

  <static-files>
    <include path="**" />
    <!-- The following line requires App Engine 1.3.2 SDK -->
    <include path="**.nocache.*" expiration="0s" />
    <include path="**.cache.*" expiration="365d" />
    <exclude path="**.gwt.rpc" />
  </static-files>

Restlet应用程序模块

public class TestServerApplication extends Application {
    @Override
    public Restlet createInboundRoot() {
        Router router = new Router(getContext());
        Directory dir = new Directory(getContext(), "war:///");
        router.attachDefault(dir);
        router.attach("/contacts/123", ContactServerResource.class);
        return router;
    }
}

无论我在contact.html文件中所做的任何更改,它都会更新,但永远不会调用其相应 Java 文件的onModule()。它总是为.nocache.js文件获取 304 响应代码,该文件从"/war/contact/"位置获取相同的.cache.html文件。

我想,我需要按照这里所说的添加过滤器(如何清除 gwt 中的缓存?),但我不确定发生了什么以及如何在这里不使用 Java servlet 的情况下添加此过滤器。任何帮助将不胜感激。

我不知道

我现在是否可以删除这个问题。但这是我的一个愚蠢的错误。我从另一个项目中复制了代码,并将包名称更改为"org.example.contact"。 为以前的包创建的/war/<oldPackageName>/*.nocache.js仍然存在,并且正在 HTML 文件中链接。当我使用新包重新编译代码时,它创建了一个新的/war/<newPackageName>/*.nocache.js文件,但 HTML 仍然引用旧文件。一旦我弄清楚了编译过程,它就得到了修复。

最新更新