GWT not loading .js

1,148 views
Skip to first unread message

Martones

unread,
Oct 5, 2013, 5:00:29 PM10/5/13
to google-we...@googlegroups.com
Hey everyone,

I have this issue with 3 different GWT projects : 
I try to load app.exemple.com/index.php where index.php has the module/module.nocache.js include, I have a 404 error failing to load one of the permutation JSs' + the gwt css file. Wierdly enough the file called strips out the "module" folder from the path : 


Instead of ...com/module/... 

I have this problem on 3 different sites and GWT apps, one of which is MGWT and occurs on mobiles. Once I compile in pretty the problem disapears. Also a very troubling fact for me is that this only occurs when I use tethering from my 3G cellphone. Can this be a server problem ? 

I have no "user-agent" specification in my Module.gwt.xml.

Many thanks for any advice :)

Ludovit

Jens

unread,
Oct 5, 2013, 5:16:56 PM10/5/13
to google-we...@googlegroups.com
Maybe your 3G provider optimizes web pages on the fly and inlines JavaScript automatically? How does the HTML source of your index page look like once the browser has loaded it (use FireBug / Chrome/Safari DevTools)? Does it still contain <script src='<module-name>/app.nocache.js'/> ?

-- J.

Martones

unread,
Oct 6, 2013, 6:20:26 AM10/6/13
to google-we...@googlegroups.com
Hi Jens, 

This is exactly the case. The nocache.js is gone and there is a bunch of JS directly in the page. I first though that this is GWT behaviour but couldnt explain it to myself. 

I guess it means that the pretty compiled code is too havy to be included to the page. 
Do you think there is anything to be done to be able to use obfuscation ? (A dirty solution would be to place all the GWT files in the root folder ... :p ).

Many thanks !

Martones

unread,
Oct 8, 2013, 3:31:23 AM10/8/13
to google-we...@googlegroups.com
Anyone have any idea on this ? It seems strange to me that the ISP could do this kind of "alteration" to the code. Although the tests I did so far seem to confirm this : I tested my apps on two other ISPs mobiles and it worked. (There are 3 majors mobile ISPs here in France, one of which - SFR is doing this).

Am-I the only one having this problem ?

Many thanks !
Message has been deleted
Message has been deleted

Jens

unread,
Oct 8, 2013, 5:06:22 AM10/8/13
to google-we...@googlegroups.com
You could use it as a feature ;-)

I have a HostPageServlet that generates the index.html file and automatically inlines app.nocache.js along with other "one time information" I need on app start. This reduces the app startup time by minimizing the required network requests. All resources that need to be deployed are in folder named "public" so that GWT copies them automatically to the compilation output folder.

-- J.

Martones

unread,
Oct 8, 2013, 5:31:42 AM10/8/13
to google-we...@googlegroups.com
Oh my, my messages got all posted. I dont know why I didnt see them in my session. Sorry for the spam. I'm deleting the useless ones.

I see what you mean, but I dont have the possibility to change the relative path from where GWT fetches the permutations, do I ? I'm using quite a few code splitting too by the way.

Maybe I shall try to use public directory via the gwt.xml. Can I put all the JS (permutations, deferred,gwt folder, img bundles...) inside /public for example ? The thing is, I have more then one module on the server also, so that means that I shall put all the files together ? Or maybe something like /public/module1 and /public/module2.

Since the problem arrives only for one ISP, i need to make a solution that handles both cases ... so I cant realy use it as a feature :)

Jens

unread,
Oct 8, 2013, 6:16:19 AM10/8/13
to google-we...@googlegroups.com
Oh my, my messages got all posted. I dont know why I didnt see them in my session. Sorry for the spam. I'm deleting the useless ones.

I see what you mean, but I dont have the possibility to change the relative path from where GWT fetches the permutations, do I ? I'm using quite a few code splitting too by the way.

GWT always loads permutations/split points from the location where app.nocache.js is stored. You can not change that (unless you want to rewrite app.nocache.js after compilation) and normally you don't need to change that. You can copy all GWT compile output in any folder as long as everything is in the same folder.

 

Maybe I shall try to use public directory via the gwt.xml. Can I put all the JS (permutations, deferred,gwt folder, img bundles...) inside /public for example ?

You can put anything in the public folder. GWT just copies everything to the output folder. I have images, fonts, binary files, etc in the public folder. Doesn't really matter.

 
The thing is, I have more then one module on the server also, so that means that I shall put all the files together ? Or maybe something like /public/module1 and /public/module2.

To make it easier to understand I would create one public folder per GWT module and would put resources in it that are tied to that GWT module. Just give it a try. Create a public folder next to your client folder and put a file in it. Then do a draftCompile and take a look at the war folder. Also note that "public" is the default name of the public folder. You can modify that in your gwt.xml using <public path="public/module1" /> if you want to.

 

Since the problem arrives only for one ISP, i need to make a solution that handles both cases ... so I cant really use it as a feature :)

What I mean is that you could use that inlining solution always.

-- J.

Paul Mazzuca

unread,
Oct 8, 2013, 9:58:59 AM10/8/13
to google-we...@googlegroups.com
I ran into the same issue.  See the previous post.  I still don't have a solution for it.   Some questions that I have are (1) Is there a size threshold for when the carrier does not optimize the js in inline (2) Is there a way to whitelist a GWT site to not be optimized by the carrier (3) Is there a work around so that a GWT project can work?

This issue occurs on Sprint / Virgin Mobile USA 3G and 4G. 

Jens

unread,
Oct 8, 2013, 10:30:03 AM10/8/13
to google-we...@googlegroups.com

Jens, it that code public for always inlining? 

No as it contains some app specific code. But its really easy to implement.

Create index.tpl that contains the index.html code (host page). Instead of <script src="..app.nocache.js"/> you put a replacement tag in the file like $GWT_BOOTSTRAP_JS$. Then change your build script to include index.tpl and app.nocache.js for server deployment so that a server servlet can open both and read their content. Finally you replace the replacement tag with the app.nocache.js content and store the result in a static field for caching. Now you can write out the result to the browser.

We do this replacement strategy for inlining the GWT nocache.js file and for embedding JSON data like app version, user information, acls, etc.. The app reads that data directly from the host page and you don't have to do additional requests for fetching these data.

Whats important is that once you do inlining the app.nocache.js file, the HTTP response containing the generated index.html must have no-cache HTTP headers set.

-- J.

toon...@gmail.com

unread,
Oct 8, 2013, 10:45:39 AM10/8/13
to google-we...@googlegroups.com
I had the same problem with EE in the UK. Changing the URL to https fixed the problem.

-ken

Thomas Broyer

unread,
Oct 8, 2013, 10:47:01 AM10/8/13
to google-we...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages