I have developed a GWT application and also installed a Apache Solr Server on the localhost machine.
The Solr is working fine and the queries are returning the desired results.
Now for embedding the results in my GWT application I am sending a http request using GWT's RequestBuilder to the Solr server.
The query is reaching on the Solr as I can view it in the command prompt.
On the GWT side the request is successful as my onResponseRecieved()
is called. But the size of the response is 0 and also the status code is 0.
I am unable to find where is the problem.
Also, if there is a Same Origin Policy then the onError()
method should be run but it isn't.
Following is my sending and handling code
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();
}
Any Help will be appreciated!