Greetings,
I have a GWT app talking to a Java servlet just fine except I can't seem to
pass data. I've already spent a day on it. Any help would be greatly
appreciated.
I am using JsonpRequestBuilder and attempting to get around SOP. Here is
my server code:
public class GWTServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String callback = request.getParameter("callback");
PrintWriter out = response.getWriter();
try {
out.print(callback + "([{\"Hello\": \"world\"}]);");
} finally {
out.close();
}
}....
Here is my GWT code:
public void onClick(ClickEvent event) {
JsonpRequestBuilder jsonprb= new JsonpRequestBuilder();
jsonprb.requestObject("http://localhost:8084/XXX/GWTServlet",
new AsyncCallback() {
@Override
public void onFailure(Throwable caught) {
Window.alert("Failure getting JSONP directly from remote
server");
}
@Override
public void onSuccess(Object result) {
Window.alert("Got response");
JavaScriptObject res = (JavaScriptObject) result;
Window.alert(res.toSource());
}
});
I get the "Got response" message. I am also able to put break points on
the frontend or backend and it gets to where I expect. The problem is that
I can't seem to get at the data send from the server. I don't know what to
do in onSuccess().
Of course, once I get this working I will have the same challenge going the
other way. Help is greatly appreciated.
Blake McBride
--
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.