GWT-Pratform PlaceManager 的问题 +杜松子酒

发布于 2024-12-05 13:00:18 字数 3589 浏览 0 评论 0原文

我尝试使用 GWT-Platform 执行某些操作,但是请按照本页中的示例进行操作:http://code.google.com/p/gwt-platform/wiki/GettingStarted?tm=6 简单的不起作用。

我收到以下错误:

java.lang.AssertionError:内部错误,传递给 updateHistory 的 PlaceRequest 与地点层次结构的尾部不匹配。 在 com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.updateHistory(PlaceManagerImpl.java:489) 在 com.gwtplatform.mvp.client.proxy.ProxyPlaceAbstract$3$1.execute(ProxyPlaceAbstract.java:208) 在 com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50) 在 com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:228) 在 com.google.gwt.core.client.impl.SchedulerImpl.flushPostEventPumpCommands(SchedulerImpl.java:388) 在 com.google.gwt.core.client.impl.SchedulerImpl$Flusher.execute(SchedulerImpl.java:78) 在 com.google.gwt.core.client.impl.SchedulerImpl.execute(SchedulerImpl.java:138) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) 在 sun.reflect.NativeMethodAccessorImpl.invoke(来源未知) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(来源未知) 在 java.lang.reflect.Method.invoke(来源未知) 在 com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 在 com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 在 com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) 在com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337) 在 com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218) 在 com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) 在 com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) 在 com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269) 在 com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) 在 com.google.gwt.core.client.impl.Impl.apply(Impl.java) 在 com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213) 在 sun.reflect.GenerateMethodAccessor29.invoke(来源未知) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(来源未知) 在 java.lang.reflect.Method.invoke(来源未知) 在 com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 在 com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 在 com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) 在 com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292) 在 com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546) 在 com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) 在 java.lang.Thread.run(来源不明)

当我尝试创建 PlaceRequest 时,

。我猜这是因为 PlaceManager 被注入了,而且,不知何故,它不是单例,而是遵循 wiki (http://code.google.com/p/gwt-platform/wiki/GettingStarted?tm=6#将所有内容绑定在一起):

安装 DefaultModule 可以让您不必执行以下所有绑定: 绑定(EventBus.class).to(SimpleEventBus.class).in(Singleton.class); 绑定(TokenFormatter.class).to(ParameterTokenFormatter.class).in(Singleton.class); 绑定(RootPresenter.class).asEagerSingleton(); 绑定(PlaceManager.class).to(MyPlaceManager.class).in(Singleton.class); 绑定(GoogleAnalytics.class).to(GoogleAnalyticsImpl.class).in(Singleton.class);

地方经理已经必须是单身人士......但是,它根本不起作用。

有人有这个问题吗?

I've trying to do something with GWT-Platform, but, following the examples in this page: http://code.google.com/p/gwt-platform/wiki/GettingStarted?tm=6 simple doesn't work.

I got the following error:

java.lang.AssertionError: Internal error, PlaceRequest passed to updateHistory doesn't match the tail of the place hierarchy.
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.updateHistory(PlaceManagerImpl.java:489)
at com.gwtplatform.mvp.client.proxy.ProxyPlaceAbstract$3$1.execute(ProxyPlaceAbstract.java:208)
at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:228)
at com.google.gwt.core.client.impl.SchedulerImpl.flushPostEventPumpCommands(SchedulerImpl.java:388)
at com.google.gwt.core.client.impl.SchedulerImpl$Flusher.execute(SchedulerImpl.java:78)
at com.google.gwt.core.client.impl.SchedulerImpl.execute(SchedulerImpl.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)

when I try to make a PlaceRequest.

I guess it occurs because PlaceManager is injected, and, someway, it aren't as singleton, but, following the wiki (http://code.google.com/p/gwt-platform/wiki/GettingStarted?tm=6#Binding_everything_together):

Installing DefaultModule saves you from having to perform all the following bindings:
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
bind(TokenFormatter.class).to(ParameterTokenFormatter.class).in(Singleton.class);
bind(RootPresenter.class).asEagerSingleton();
bind(PlaceManager.class).to(MyPlaceManager.class).in(Singleton.class);
bind(GoogleAnalytics.class).to(GoogleAnalyticsImpl.class).in(Singleton.class);

place manager already has to be a singleton... but, it simply dont work.

Someone has this issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情场扛把子 2024-12-12 13:00:18

刚刚在 gwtp 0.6 中遇到了这个问题,我找到了解决我的问题的方法。

问题原来是我在 ClientModule 类中绑定了 PlaceManager 的实现:

  protected void configure() {
    // Singletons
    install(new DefaultModule(ClientPlaceManager.class));
    ...

然后在演示者构造函数中自动绑定了相同的实现

  private ClientPlaceManager placeManager ; //wrong - should be the interface

  @Inject
  public FrameworkLayoutPresenter(final EventBus eventBus, final MyView view, final MyProxy proxy, 
      final ClientPlaceManager placeManager) //wrong - should be the interface
  {
    super(eventBus, view, proxy);
    this.placeManager = placeManager ;
    ...

但是我应该绑定接口 PlaceManager

  private PlaceManager placeManager ; 

  @Inject
  public FrameworkLayoutPresenter(final EventBus eventBus, final MyView view, final MyProxy proxy, 
      final PlaceManager placeManager) 
  {
    super(eventBus, view, proxy);
    this.placeManager = placeManager ;
    ...

Having just had this problem with gwtp 0.6, I found a solution for my problem.

The problem turned out to be that I bound my implementation of PlaceManager in the ClientModule class:

  protected void configure() {
    // Singletons
    install(new DefaultModule(ClientPlaceManager.class));
    ...

and then automatically bound my same implementation in the presenter constructor

  private ClientPlaceManager placeManager ; //wrong - should be the interface

  @Inject
  public FrameworkLayoutPresenter(final EventBus eventBus, final MyView view, final MyProxy proxy, 
      final ClientPlaceManager placeManager) //wrong - should be the interface
  {
    super(eventBus, view, proxy);
    this.placeManager = placeManager ;
    ...

But I should have bound the interface PlaceManager

  private PlaceManager placeManager ; 

  @Inject
  public FrameworkLayoutPresenter(final EventBus eventBus, final MyView view, final MyProxy proxy, 
      final PlaceManager placeManager) 
  {
    super(eventBus, view, proxy);
    this.placeManager = placeManager ;
    ...
晨光如昨 2024-12-12 13:00:18

每次我收到此异常时,都是因为我传递给 updateHistory 的 PlaceRequest 没有与当前地点相同的 NameToken,这是不合法的。
你到底想做什么?

Every time I get this exception, it's because the PlaceRequest I pass to updateHistory doesn't have the same NameToken as the current place, which is not legal.
What are you trying to do exactly ?

墨小沫ゞ 2024-12-12 13:00:18

如果您使用 GTWP 0.6,您可以通过以下方式使用 DefaultModule:

public class ClientModule extends AbstractPresenterModule {
    @Override
    protected void configure() {
         install(new DefaultModule(MyPlaceManager.class));
}

DefaultModule 负责绑定 EventBus、TokenFormatter、RootPresenter、PlaceManager 和 GoogleAnalytics。

In case you are using GTWP 0.6 you could use the DefaultModule in this way:

public class ClientModule extends AbstractPresenterModule {
    @Override
    protected void configure() {
         install(new DefaultModule(MyPlaceManager.class));
}

The DefaultModule takes care of Binding EventBus, TokenFormatter, RootPresenter, PlaceManager and GoogleAnalytics.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文