Использовал это http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html руководство, чтобы понять основные понятия, но возникли проблемы при запуске моего приложения из Eclipse:
<code>15:48:04.384 [ERROR] [Main] Uncaught exception escaped
com.google.web.bindery.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.fail(AbstractRequestContext.java:727)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$5.onTransportFailure(AbstractRequestContext.java:1104)
at com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport$1.onResponseReceived(DefaultRequestTransport.java:140)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
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.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.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)
Caused by: java.lang.RuntimeException: Server Error 500 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 INTERNAL_SERVER_ERROR</title>
</head>
<body><h2>HTTP ERROR: 500</h2><pre>INTERNAL_SERVER_ERROR
RequestURI = / gwtRequest
Работает на причале: //
на com.google.web.bindery.requestfactory.shared.Receiver.onFailure (Receiver.java:44)
на com.google.web.bindery.requestfactory.shared.impl.AbstractRequest.onFail (AbstractRequest.java:118)
на com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.fail (AbstractRequestContext.java:707)
на com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext $ 5.onTransportFailure (AbstractRequestContext.java:1104)
на com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport $ 1.onResponseReceived (DefaultRequestTransport.java:140)
на com.google.gwt.http.client.Request.fireOnResponseReceived (Request.java:287)
на com.google.gwt.http.client.RequestBuilder $ 1.onReadyStateChange (RequestBuilder.java:395)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод)
at sun.reflect.NativeMethodAccessorImpl.invoke (неизвестный источник)
at 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)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод)
at sun.reflect.NativeMethodAccessorImpl.invoke (неизвестный источник)
at 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)
at java.lang.Thread.run (неизвестный источник)
Вот код, который не работает:
final EventBus eventBus = new SimpleEventBus();
final TestEntityRequestFactory requestFactory = GWT.create(TestEntityRequestFactory.class);
requestFactory.initialize(eventBus);
final Button button = new Button("omg");
RootPanel.get().add(button);
TestEntityRequest testEntityRequest = requestFactory.testEntityRequest();
Request<String> createReq = testEntityRequest.getOmg();
createReq.fire(new Receiver<String>() {
@Override
public void onSuccess(String arg0) {
button.setText(arg0);
}
});
Я знаю, что мой вопрос довольно абстрактный, пожалуйста, используйте комментарии, чтобы запросить необходимую информацию.