【发布时间】:2011-01-26 15:30:08
【问题描述】:
我正在尝试在我们的 gwt 应用程序中插入一个 jsp。我正在为此使用请求生成器。这是我的代码:
String url = "http://localhost:8080/my-spring-example/hello.htm";
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url);
RequestCallback callback = new RequestCallback() {
public void onError(Request request, Throwable exception) {
spring.setHTML("Die Daten konnten nicht geladen werden");
}
public void onResponseReceived(Request request, Response response) {
String responseAsText = response.getText();
if (responseAsText.equals("") || responseAsText == null ){
spring.setHTML("Der String ist leer");
} else {
spring.setHTML(responseAsText);
}
}
};
try {
rb.sendRequest(null, callback);
} catch (RequestException e) {
e.printStackTrace();
}
如果我打电话给http://localhost:8080/my-spring-example/hello.htm,萤火虫的反应是:
<head><title>Hello :: Spring 3 Application</title></head>
<body>
<h1>Hello World, Spring 3.0!</h1>
<p>Es gibt 32 Einträge</p>
</body>
如果我通过我们的 gwt 应用程序调用,firebug 中的响应是空字符串。
如果我打电话给http://localhost:8080/my-spring-example/hello.htm,wireshark 的响应是:
<head><title>Hello :: Spring 3 Application</title></head>\n
<body>\n
\t<h1>Hello World, Spring 3.0!</h1>\n
\t<p>Es gibt 32 Eintr\344ge</p>\n
</body>
如果我通过我们的 gwt 应用程序进行调用,wireshark 中的响应是相同的:
<head><title>Hello :: Spring 3 Application</title></head>\n
<body>\n
\t<h1>Hello World, Spring 3.0!</h1>\n
\t<p>Es gibt 32 Eintr\344ge</p>\n
</body>
我不明白,出了什么问题....调用正确,响应来了,但是发生了一些事情,所以 gwt 客户端只显示空字符串作为响应。我很困惑....
【问题讨论】:
标签: jsp gwt insert request response