JSONP uses script tags to permit the cross-domain call [1], AFAIK a script tag can't make a POST request so you're stuck putting the data in the URL.
[1] http://en.wikipedia.org/wiki/JSONP On Mon, Mar 26, 2012 at 4:13 PM, Blake McBride <[email protected]> wrote: > Greetings, > > I am using JsonpRequestBuilder to call a different server to get data. It > works fine. I can't see anyway of passing data from GWT client to the Java > servlet. It is important to me not to pass the data as part of the URL. > I'd like to receive the data on the servlet side as part of the request > object. For convinience, the following is what I have: > > Server side: > > protected void processRequest(HttpServletRequest request, > HttpServletResponse response) > throws ServletException, IOException { > String callback = request.getParameter("callback"); > PrintWriter out = response.getWriter(); > try { > out.print(callback + "(\"Hello there\")"); > } finally { > out.close(); > } > } > > Client side: > > public void onClick(ClickEvent event) { > > JsonpRequestBuilder jsonprb= new JsonpRequestBuilder(); > > jsonprb.requestString("http://localhost:8084/Arahant/GWTServlet", > > new AsyncCallback<String>() { > > @Override > > public void onFailure(Throwable caught) { > > Window.alert("Failure getting JSONP directly from remote > server"); > > } > > @Override > > public void onSuccess(String result) { > > Window.alert("Got " + result); > > } > > }); > > > -- > 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. -- 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.
