所以我从第二个app模块接收RPC调用时遇到问题。无论我使用什么回调,无论我传递什么参数,呼叫总是被处理到最终服务器端,但不会触发onSuccess或onFailure。保证,方法服务器端被执行并返回有效值。电话似乎只是消失了,因为也没有出现错误。
我的读法是模块结构中有错误可能吗?
以下是我从以下位置开始RPC调用的类/视图的代码:
package de.hdm.reportgenerator.client;
import java.util.ArrayList;
import java.util.logging.Logger;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import de.hdm.core.client.ClientsideSettings;
import de.hdm.core.shared.AdministrationServiceAsync;
import de.hdm.core.shared.ReportGeneratorAsync;
import de.hdm.core.shared.bo.Profile;
import de.hdm.core.shared.bo.SearchProfile;
import de.hdm.core.shared.report.HTMLProfilesReport;
public class AllProfilesView extends UpdateReportGenerator {
private SearchProfile searchProfile = new SearchProfile();
private Boolean unseenChecked = null;
private ReportGeneratorAsync reportGenerator = ClientsideSettings.getReportGenerator();
private AdministrationServiceAsync adminService = ClientsideSettings.getAdministration();
private ScrollPanel scrollPanel = new ScrollPanel();
HTML verLine = new HTML(" <table style='display:inline;border-collapse:collapse;border:0'><tr><td style='padding:0'><img src='transparent.gif' width='1' height='500' style='background:grey'></td></tr></table>");
HTML horLine = new HTML("<hr style=\"width:100%;\" />");
Logger logger = ClientsideSettings.getLogger();
public AllProfilesView (Boolean unseenChecked, SearchProfile searchProfile){
logger.info("Zeile 33 APV ausgeführt");
this.searchProfile = searchProfile;
this.unseenChecked = unseenChecked;
logger.info("Zeile 37 APV ausgeführt");
}
/**
* Jeder Showcase besitzt eine einleitende �berschrift, die durch diese
* Methode zu erstellen ist.
*
* @see Showcase#getHeadlineText()
*/
// @Override
protected String getHeadlineText() {
return "Show Report - generated";
}
/**
* Jeder Showcase muss die <code>run()</code>-Methode implementieren. Sie
* ist eine "Einschubmethode", die von einer Methode der Basisklasse
* <code>ShowCase</code> aufgerufen wird, wenn der Showcase aktiviert wird.
*/
@Override
protected void run() {
//adminService.searchAndCompareProfiles(unseenChecked, searchProfile, comparedProfilesCallback());
reportGenerator.testCallback(testCallback());
logger.info("Zeile 61 ausgeführt");
scrollPanel.add(horLine);
RootPanel.get("Details").add(scrollPanel);
scrollPanel.setSize("100%", "100%");
logger.info("Zeile 66 ausgeführt");
}
private AsyncCallback<ArrayList<Profile>> comparedProfilesCallback() {
AsyncCallback<ArrayList<Profile>> asyncCallback = new AsyncCallback<ArrayList<Profile>>() {
@Override
public void onFailure(Throwable caught) {
ClientsideSettings.getLogger().severe("Error: " + caught.getMessage());
}
@Override
public void onSuccess(ArrayList<Profile> result) {
System.out.println("Zeile 85 APV ausgeführt");
scrollPanel.add(HTMLProfilesReport.generateAllProfilesReport(result));
System.out.println("Line 87 APV executed");
}
};
return asyncCallback;
}
private AsyncCallback<Integer> testCallback() {
AsyncCallback<Integer> asyncCallback = new AsyncCallback<Integer>() {
@Override
public void onFailure(Throwable caught) {
ClientsideSettings.getLogger().severe("Error: " + caught.getMessage());
System.out.println("Zeile 100 APV ausgeführt");
}
@Override
public void onSuccess(Integer result) {
System.out.println("Line 107 APV executed");
}
};
return asyncCallback;
}
}
这是我的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
<!-- Servlets -->
<servlet>
<servlet-name>SystemServiceServlet</servlet-name>
<servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value />
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>SystemServiceServlet</servlet-name>
<url-pattern>/_ah/spi/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>administrationService</servlet-name>
<servlet-class>de.hdm.core.server.AdministrationServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>administrationService</servlet-name>
<url-pattern>/editor/administration</url-pattern>
<url-pattern>/reportgenerator/administration</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>reportgenerator</servlet-name>
<servlet-class>de.hdm.core.server.ReportGeneratorImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>reportgenerator</servlet-name>
<url-pattern>/reportgenerator/reportgenerator</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>loginService</servlet-name>
<servlet-class>de.hdm.core.server.LoginServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>loginService</servlet-name>
<url-pattern>/editor/login</url-pattern>
<url-pattern>/reportgenerator/login</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>Editor.html</welcome-file>
</welcome-file-list>
这是模块gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN" "http://gwtproject.org/doctype/2.7.0/gwt-module.dtd">
<module rename-to='reportgenerator'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name="de.hdm.core.Core" />
<!-- Logger implementieren -->
<inherits name="com.google.gwt.logging.Logging" />
<set-property name="gwt.logging.enabled" value="TRUE" />
<set-property name="gwt.logging.logLevel" value="FINEST" />
<set-property name="gwt.logging.consoleHandler" value="ENABLED" />
<set-property name="gwt.logging.developmentModeHandler"
value="ENABLED" />
<set-property name="gwt.logging.hasWidgetsHandler" value="ENABLED" />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean' />
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class="de.hdm.reportgenerator.client.ReportgeneratorEntryPoint" />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='server' />
<source path='shared' />
<!-- allow Super Dev Mode -->
<add-linker name="xsiframe" />
</module>
我希望你能够帮助我,并且我已经包含了理解所需的所有信息。
此致 菲尔