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:
And after opening Administation Panel
in application:
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?
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
).