2
我有一个GWT应用程序,我的标准GWT 8888端口与端口8080工作围绕GWT同源策略
运行的JAX-RS /新泽西/ Glassfish的服务comunicate上调试这是GWT代码:
StringBuffer postData = new StringBuffer();
postData.append(URL.encode("username")).append("=").append(URL.encode(user));
postData.append("&");
postData.append(URL.encode("password")).append("=").append(URL.encode(password));
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, "http://localhost:8888/gestdoc/resources/data/login");
builder.setHeader("Content-type", "application/x-www-form-urlencoded");
try {
builder.sendRequest(postData.toString(), new RequestCallback() {
public void onResponseReceived(Request request, Response response)
{
String responseText = response.getText();
String headers= response.getHeadersAsString();
String statusText= response.getStatusText();
int statusCode= response.getStatusCode();
String toString= response.toString();
System.out.println("responseText: "+responseText);
System.out.println("headers: "+headers);
System.out.println("statusTest: "+statusText);
System.out.println("statusCode: "+statusCode);
System.out.println("toString: "+toString);
GestoreUtenze.this.cddoc.loginResponse(true);
}
public void onError(Request request, Throwable exception) {
// exception handling
}
});
} catch (RequestException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
这是输出:
responseText:
headers:
statusTest:
statusCode: 0
toString: [email protected]
我有一个java批量客户机与我过我的球衣服务,都OK。
我看了很多文章,我想我有一个相同的原始政策问题。
我已经尝试了许多解决方案:
- 运行浏览器在那里我调试我与非同源策略(Chrome和Firefox)GWT应用
- 添加的行中我的GWT配置文件
- 我试图建立一个没有成功的代理。我能怎么做?
请问您能帮我解决这个问题吗?