开发者

gwt request (via RequestBuilder) causing response to be treated as JavaScript

The following code

    R开发者_开发百科equestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode("http://localhost:8080/xxxx/yyyy"));

try {
          Request request = builder.sendRequest(null, new RequestCallback() {
            public void onError(Request request, Throwable exception) {
            }

            public void onResponseReceived(Request request, Response response) {
            }

          });
        } catch (RequestException e) {
          possiblePages.clear(); possiblePages.addItem("could not connect to server");        
        }

Written in GWT/Java compiles to javascript that gives the following error (shown in firebug)

syntax error
[Break on this error] begin

"begin" is the first line of the text file that is returned from the url, so I see where it is getting it from, but why is it being treated as JavaScript?


Hey Matt, I have 2 ideas that you can try:

  1. Try explicitly setting the response's content type to "text/html" or "text/xml" in your servlet and see if that helps.
  2. Try clearing firefox's cache? I've seen a few rare cases where old gwt javascript gets cached and conflicts with new code.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜