我已经创建了Eclipse示例GWT + AppEngine项目,并添加了一个contact.gwt.xml
文件作为客户端。它对应*.contact.nocache.js
创建自contact.html
未更新代码更改。我在内部Jetty服务器上的本地主机上运行它。* .nocache.js未重新载入最新的代码更改(使用Restlet和GWT)
这是我的文件。
contact.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>
contact.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
文件。
我认为,我需要添加过滤器,如此处所述(how to clear cache in gwt?),但我不确定发生了什么以及如何在此处不使用Java servlet的情况下添加此过滤器。任何帮助,将不胜感激。
它看起来像你的'* .nocache.js'被缓存在浏览器中(或者在一些代理中)。尝试清除浏览器缓存并重新加载页面。如果有效,这将确认缓存问题,并且您需要以某种方式强制Web服务器发送缓存标头。 – Adam
感谢您的提示。从我的结局来看,这是一个错误。 – Junaid