GWT 응용 프로그램을 개발했으며 localhost 컴퓨터에 Apache Solr 서버를 설치했습니다.XML 응답이 외부 SOLR 서버에서 GWT에 표시되지 않습니까?
Solr이 정상적으로 작동하고 쿼리가 원하는 결과를 반환합니다.
이제 내 GWT 응용 프로그램에 결과를 포함시키기 위해 GWT의 RequestBuilder를 사용하여 HTTP 요청을 Solr 서버로 보냈습니다.
명령 프롬프트에서 볼 수있는 것처럼 쿼리가 Solr에 도달했습니다.
GWT 쪽에서 내 onResponseRecieved()
이 호출되면 요청이 성공합니다. 그러나 응답의 크기는 0이고 상태 코드는 0입니다.
어디서 문제가 있는지 찾을 수 없습니다.
또한 동일한 출처 정책이있는 경우 onError()
메서드를 실행해야하지만 그렇지는 않습니다.
내 코드 어떤 도움을 이해할 수있을 것이다
String url = "http://localhost:8983/solr/select/?q=bname:"+whatBox.getText()+"&version=2.2&start=0&rows=10&indent=on";
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, URL.encode(url));
System.out.println("here");
try{
Request req = rb.sendRequest(null, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
System.out.println("in res");
System.out.println(response.getHeadersAsString());
RootPanel.get("content").clear();
RootPanel.get("content").add(new Label(response.getText()));
}
@Override
public void onError(Request request, Throwable exception) {
// TODO Auto-generated method stub
System.out.println("error");
}
});
}catch(RequestException e){
e.printStackTrace();
}
에게 전송하고 처리하는 다음!