0

I have created a sample GWT+AppEngine project with Eclipse and added one contact.gwt.xml file as a client. It's corresponding *.contact.nocache.js created from contact.html is not being updated with code changes. I am running it on localhost on internal Jetty server.

Here are my files.

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>

Relevant part of 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 Application module

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;
    }

}

Whatever changes I make in contact.html file, it's updated but its corresponding Java file's onModule() is never called. It always gets 304 response code for .nocache.js file which gets the same .cache.html file from "/war/contact/" location.

I think, I need to add Filter as told here (how to clear cache in gwt?) but I am not sure what's going on and how to add this filter without using Java servlets here. Any help would be appreciated.

Community
  • 1
  • 1
Junaid
  • 1,668
  • 7
  • 30
  • 51
  • 1
    It looks like your `*.nocache.js` is being cached in the browser (or maybe in some proxy). Try to clear browser cache and reload the page. If it works, that would confirm the cache problem and you would need to somehow force the web server to send cache headers. – Adam Jul 08 '16 at 17:52
  • Thanks for your tip. It was one error from my end. – Junaid Jul 09 '16 at 18:34

1 Answers1

0

I don't know if I can delete this question now. But it was one stupid error from my end. I had copied the code from another project and changed the package name to "org.example.contact". /war/<oldPackageName>/*.nocache.js created for previous package was still there and was being linked in the HTML file. When I recompiled the code with new package, it created a new /war/<newPackageName>/*.nocache.js file but HTML was still referring to the old one. Once I figured out the compilation process, it got fixed.

Junaid
  • 1,668
  • 7
  • 30
  • 51