GWTP Carstore sample application code splitting

105 views Asked by At

I launch the GWTP Carstore application

https://github.com/ArcBees/GWTP-Samples/tree/master/carstore

in super development mode. It has numerous tabs, each corresponding to a place annotated with @ProxyCodeSplit, for example

@ProxyCodeSplit
@NameToken(NameTokens.MANUFACTURER)
interface MyProxy extends ProxyPlace<ManufacturerPresenter> {
}

Clicking on each tab, I expected that each time a different javascript file would be loaded; however this was not the case, as can be seen from the Fiddler screenshot I attach.

enter image description here

One sees that all the Javascript was loaded already during startup (the various requests returning JSON were sent to server as I clicked different tabs).

Is the Carstore application configuration incomplete, or perhaps I am missing something here?

1

There are 1 answers

0
John Donn On

Well, if someone else comes to scratch his head over this: as I said, I saw that no code splitting occurred if I used Maven GWT plugin to launch Carstore in the super development mode, mvn clean gwt:run.

Trying to see whether no code splitting occurs also after deploying Carstore to Tomcat, I created the Carstore WAR with mvn clean package; it failed to deploy however (with Java 8, stack trace has

Caused by: java.lang.NullPointerException: No API environment is registered for this thread.
    at com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:179)

inside).

So I experimented with a simpler project which I had on my machine. Likewise (at least with the Maven GWT plugin configuration in my project's pom.xml) I saw that in the super development mode all the Javascript gets loaded on startup. However when I created the WAR of this simpler project and deployed it (successfully this time) to Tomcat, I did see additional Javascript files being loaded after the "place" was changed. Thus, after deployment to Tomcat, code splitting worked as expected.