To be precisely, response.getText() only returns a valid response if the content type is "application/xml" or "application/json", it does not work with content type "application/atom+xml" or any other content types.
Is this a bug, missing feature, or intended behavior? Thanks, Jervis Liu On 3月5日, 下午9时45分, jervisliu <[email protected]> wrote: > Hi all, > > I have a GWT + Atom/Pub based application. The GWT client talks to a > server which serves data in Atom/Pub. For example, a HTTP GET request > to URLhttp://localhost:8080/atomserver/itemsreturns data as below: > > HTTP/1.1 200 OK > Server: Apache-Coyote/1.1 > X-Powered-By: Servlet 2.4; JBoss-4.3.0.GA_CP02 (build: > SVNTag=JBPAPP_4_3_0_GA_CP02 date=200808051050)/JBossWeb-2.0 > Content-Type: application/atom+xml > Content-Length: 219 > Date: Thu, 05 Mar 2009 13:18:19 GMT > > <feed xmlns="http://www.w3.org/2005/Atom" xmlns:xml="http://www.w3.org/ > XML/1998/namespace" xml:base="http://127.0.0.1:8080/atomserver/ > items/"><title type="text">All items</title></feed> > > However, using GWT RequestBuilder to send a GET request to > URLhttp://localhost:8080/atomserver/items, returns an empty response. For > example in code snippet below, response.getText() returns null: > > RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, > URL.encode(url)); > > Request request = builder.sendRequest(null, new RequestCallback() { > public void onResponseReceived(Request request, Response response) > { > if (200 == response.getStatusCode()) { > String res = response.getText(); > } > > Can someone kindly confirm that this is a bug or GWT RequestBuilder is > designed in this way so that it only works with content type > "application/json"? Thanks. > > BTW, is there any other way I can use to make HTTP calls (GET|POST|PUT| > DELETE) in GWT? UnfortunatelyGoogle Atom Feed API does not work for > me, as it only supports HTTP GET. > > Thanks, > Jervis Liu --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
