Re: GWT offline

876 views
Skip to first unread message

Shawn Brown

unread,
Jun 18, 2012, 12:54:08 AM6/18/12
to google-we...@googlegroups.com
> Can i use gwt offline? if so, how? I havent been able to get it to work
> offline for over a week

Yes you can. What have you done?

My approach (=no guarantee to be best practice) is to:

1) use a linker to make the offline manifest (one for each permutation)
2) timestamp, rename, and map to appname.nocache.js** (done in linker)
3) use a servlet filter to return the manifest for the right
browser/language permutation

**appname.nocache.js is needed to load GWT but doesn't cache right
(assuming you have it set not to cache, and if you allow it to cache,
the user won't get timely updates right)? So I cache it under a
different timestamped file name, and map to it in the manifest. For
ex.:
FALLBACK:
/appname/appname.nocache.js /appname/appname.1339975521875.js

Then if the browser is online and loads a new manifest [yes of course
the manifest includes #timestamp in it], it will update the cache to
the new version.

Anyway, you aren't saying what isn't working so I assume you are not
looking at the chrome developer console. It nicely logs out
Application Cache Progress (or failure )events.

Shawn

dominikz

unread,
Jun 18, 2012, 4:31:05 AM6/18/12
to google-we...@googlegroups.com
2) timestamp, rename, and map to appname.nocache.js** (done in linker)

We had the same problem. But instead of doing what you did, we found in the doc that the nocache.js file should be returned by HTTP servers as non-cachable. This solves the issue. You just write a servlet that sets Headers when delivering that file. 

Shawn Brown

unread,
Jun 18, 2012, 5:03:41 AM6/18/12
to google-we...@googlegroups.com
> We had the same problem. But instead of doing what you did, we found in the
> doc that the nocache.js file should be returned by HTTP servers as
> non-cachable. This solves the issue. You just write a servlet that sets
> Headers when delivering that file.

OK but I don't understand. Isn't *.nocache.js needed to bootstrap
(i.e. load) the GWT code?
If *.nocache.js isn't cached by the browser, then how does the offline
version load -- [it can't get it from the server!!!]?

If I have extra time to try an offline version that hasn't set a
backup to load I will. I don't see how it would work though unless
the browser is 1) really storing *.nocache.js [even though you set the
header in the servlet not to] and just refreshing it everytime or 2)
not really needing *.nocache.js. I don't think either of those things
is true but I can't test it right now.

Shawn

dominikz

unread,
Jun 18, 2012, 6:51:04 AM6/18/12
to google-we...@googlegroups.com
I think you're confusing two different things:
- browser cache
- Application Cache (the feature added in HTML5)

They are 2 different caches.
A browser can (and will) store nochache.js file in Application Cache (HTML5) even if it is not storing it in regular browser cache.

Shawn Brown

unread,
Jun 18, 2012, 7:43:44 AM6/18/12
to google-we...@googlegroups.com
Yeah I think you are right. Thanks man.

dominikz

unread,
Jun 18, 2012, 8:23:32 AM6/18/12
to google-we...@googlegroups.com
FYI: 

We took the servlet for tomcat from here:


I remember GWT docs were having an example on how to do that for Apache. After the transfere to 'developers.google.com' site, I cannot find it. I'm sure it's there somewhere. So if you are interested, just browse their docs and it'll be there.

Thomas Broyer

unread,
Jun 18, 2012, 10:23:57 AM6/18/12
to google-we...@googlegroups.com

dominikz

unread,
Jun 18, 2012, 11:54:22 AM6/18/12
to google-we...@googlegroups.com
I'm wondering what has darken my mind in such a way that I couldn't find it easily.

Thanks

Thomas Broyer

unread,
Jun 18, 2012, 12:59:41 PM6/18/12
to google-we...@googlegroups.com


On Monday, June 18, 2012 5:54:22 PM UTC+2, dominikz wrote:
I'm wondering what has darken my mind in such a way that I couldn't find it easily.

Don't worry, it does it to me all the time too ;-)

I know it's easy to find, but can't find it without opening at least 5 pages. 

Joseph Lust

unread,
Jun 18, 2012, 8:32:25 PM6/18/12
to google-we...@googlegroups.com
Thomas,

Is there any way to constrict the search on the GWT DevGuide  page to just GWT Developer pages? I really like other docs pages where you can just type and get the relevant pages, rather than digging. Like you, I've read all of them, but can spend up to 10 minutes trying to find a section I've read before.

The only way I know right now is 
<yourQuery> site:developers.google.com

Thanks,
Joseph

Thomas Broyer

unread,
Jun 19, 2012, 3:21:55 AM6/19/12
to google-we...@googlegroups.com
Just tried “site:developers.google.com in-url:web-toolkit in-url:DevGuide perfect caching”, seems to be working OK. 

Daniel Kurka

unread,
Jun 21, 2012, 3:06:10 PM6/21/12
to google-we...@googlegroups.com
mgwt has a mechanism for running GWT apps offline (we need it for mobile phones because they are not always connected) but it runs with pure GWT apps as well.

see: http://code.google.com/p/mgwt/wiki/HTML5Manifest

2012/6/19 Abraham Lin <atomknig...@gmail.com>
The following should work:


You can use the same construct in the general Google search engine.

-Abraham 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Qk_Z2sp8SZ8J.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Reply all
Reply to author
Forward
0 new messages