0

I am new to GWT and GWTP. I know what is GWT Code Split and GWTP Proxy Code Split. I've already red:

http://www.gwtproject.org/doc/latest/DevGuideCodeSplitting.html http://dev.arcbees.com/gwtp/core/presenters/creating-places.html

I assumed that I understand it. So I've like to used.:

I have application with Administration panel, where only part of users can access. So there is no need to download Administration panel related code for all. So in Administration Presenter I've added @ProxyCodeSplit like follow:

public class AdminAreaPresenter extends Presenter<AdminAreaPresenter.MyView, AdminAreaPresenter.MyProxy> {
    @ProxyCodeSplit
    @NameToken(Routing.Url.admin)
    @UseGatekeeper(IsAdminGatekeeper.class)
    public interface MyProxy extends TabContentProxyPlace<AdminAreaPresenter> {}

    @TabInfo(container = AppPresenter.class)
    static TabData getTabLabel(IsAdminGatekeeper adminGatekeeper) {
        return new MenuEntryGatekeeper(Routing.Label.admin, 1, adminGatekeeper);
    }

    public interface MyView extends View {}

    AppPresenter appPresenter;

    @Inject
    AdminAreaPresenter(EventBus eventBus, MyView view, MyProxy proxy, AppPresenter appPresenter) {
        super(eventBus, view, proxy, AppPresenter.SLOT_TAB_CONTENT);
        this.appPresenter = appPresenter;
    }
}

In other Presenters I have @ProxyStandard instead of @ProxyCodeSplit.

I've run app and log in. then I've opened Network tab in chrome's developer console:

enter image description here

And after opening Administation Panel in application: enter image description here

As You can see, there is no new resources added to application.

My main app presenter AppPresenter implements interfaces AsyncCallStartHandler, AsyncCallFailHandler, AsyncCallSucceedHandler from: com.gwtplatform.mvp.client.proxy. and I override those methods:

@ProxyEvent
@Override
public void onAsyncCallStart(AsyncCallStartEvent event) {
    Window.alert("Async start");
    getView().setTopMessage("Loading...");
}
@ProxyEvent
@Override
public void onAsyncCallFail(AsyncCallFailEvent event) {
    Window.alert("Async fail");
    getView().setTopMessage("Oops, something went wrong...");
}
@ProxyEvent
@Override
public void onAsyncCallSucceed(AsyncCallSucceedEvent event) {
    Window.alert("Async success");
    getView().setTopMessage(null);
}

And when I enter AdmininArea I am getting to allerts: "Async start", "Async success". So I think that everythink work, but unfortunatelly I don't see any changes in resources. Please help. Am I doing something wrong or what?

masterdany88
  • 5,041
  • 11
  • 58
  • 132
  • 1
    Did you test it in Debug Mode (Super Dev Mode) or using the production compile? AFAIK in Debug Mode code splitting is disabled. – Ümit Jul 16 '16 at 17:43
  • I've only tested it in super Dev mode. What do You mean by 'is disabled' whole src is downloaded at once. Or download is every time I change place that have code split?- which is happening – masterdany88 Jul 17 '16 at 10:16
  • 1
    No code split points will be generated and the entire application is donwloaded at once. If you change any code, SDM will re-compile the app and again the entire code will be downloaded. In order to test the code splitting, try to run it in production mode. – Ümit Jul 17 '16 at 13:09
  • How to run in production mode? I use https://gwt-maven-plugin.github.io/gwt-maven-plugin/ And on backend I have spring framework. Currently I run app on tomcat from Eclipse with this plugin https://github.com/gwt-plugins/gwt-eclipse-plugin – masterdany88 Jul 18 '16 at 07:58
  • Did you already deploy your app somewhere ? Basically you need to compile your GWT app (`mvn gwt:compile`) and then make sure that your `index.jsp` of your backend can load the GWT output. – Ümit Jul 18 '16 at 09:01
  • I struggle with openshift, but no luck so far. I will try to run tomcat outside the Eclipse IDE, so the plugin won't run SuperDevMode. – masterdany88 Jul 18 '16 at 11:40
  • Ok. I've tested and it works, If You could post it as an answer I could accept this and close the post. Thanks – masterdany88 Jul 18 '16 at 12:44
  • ok added the answer – Ümit Jul 18 '16 at 13:38

1 Answers1

1

Code splitting is disabled in SuperDevMode because it is not compatible with the incremental compiler and would also slow down compilation (see this issue).

To test code splitting, compile your GWT application (mvn clean install gwt:compile) and test it in production mode (take war file from target directory and put it in f.e.: Tomcat server catalog: webapps).

masterdany88
  • 5,041
  • 11
  • 58
  • 132
Ümit
  • 17,379
  • 7
  • 55
  • 74