where is the json data when using GWT's RequestBuilder() ?

93 views
Skip to first unread message

Carl

unread,
Jun 7, 2013, 11:24:44 AM6/7/13
to web...@googlegroups.com
From a GWT app I'm calling my Web2py server app.

String jsonData = "{'example' : 'example data'}";
builder.setHeader("Accept", "application/json");
builder.setHeader("Content-type", "application/json");
builder.setHeader("Content-length", Integer.toString(jsonData.length()));
builder.sendRequest(jsonData, new RequestCallback() { ... }

Where in Web2py can I access jsonData?
I've looked thru 'request' but can't locate "example data".



Niphlod

unread,
Jun 7, 2013, 3:16:10 PM6/7/13
to web...@googlegroups.com
if you're using recent web2py releases, that are able to parse POST vars encoded in json, you should have them in request.vars as usual. Otherwise, see response.body.read()

Carl Roach

unread,
Jun 7, 2013, 4:54:38 PM6/7/13
to web...@googlegroups.com
thanks. both request.vars and response.body.read() are empty.

I'm calling my function: http://127.0.0.1:8000/init/default/call.jsp

I think it must be something in my Java GWT app that's not setting something for Web2py to identify that there is json data.



--
 
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/VM2rOQqQBmQ/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Niphlod

unread,
Jun 8, 2013, 9:46:16 AM6/8/13
to web...@googlegroups.com
independantly from the headers, whatever is sent is inside request.body.read() . if it's empty, you GWT isn't sending any data .
Reply all
Reply to author
Forward
0 new messages