I have created servlet which returns just a string. It works typing in
browser servlet url.
But when I try to get it  using RequestBulder i get response status
code 0! Please help!

url = http://localhost:8888/redirect.htm

public void requestProductsFromStock(String url){
            RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
url);

            try {
                builder.sendRequest(null, new RequestCallback() {
                    public void onError(Request request, Throwable exception) {
                        displayError("Couldn't retrieve JSON");
                }

                public void onResponseReceived(Request request, Response
response) {
                  if (200 == response.getStatusCode()) {
                          errorLabel.setText(response.getText());
                         // updateTable(asArrayOfProducts(response.getText()));
                  } else {
                    displayError("Couldn't retrieve JSON (" +
response.getStatusText()
                        + ")");
                  }
                }
              });
            } catch (RequestException e) {
              displayError("Couldn't retrieve JSON");
            }catch(Exception e){
                displayError(e.getMessage());
            }
        }



servlet code is

                PrintWriter out = res.getWriter();
                out.println("Hello!");
                out.close();

Why am I getting this stupid error code?! I tried in Chrome and
Mozilla..

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to