You can use the RequestBuilder class in GWT to make connections to
your server.
Below is the sample code that you can use (from
com.google.gwt.examples.http.client.GetExample )
public static void doGet(String url) {
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
url);
try {
Request response = builder.sendRequest(null, new RequestCallback
() {
public void onError(Request request, Throwable exception) {
// Code omitted for clarity
}
public void onResponseReceived(Request request, Response
response) {
// Code omitted for clarity
}
});
} catch (RequestException e) {
// Code omitted for clarity
}
}
POST is identical, except for the following lines --
builder.setHeader("Content-Type", "application/x-www-form-
urlencoded");
Request response = builder.sendRequest(postData, new RequestCallback()
{
--sri
On Sep 9, 5:47 am, Ittai <[email protected]> wrote:
> Hi All,
> I'm stepping into the world of AJAX and due to a need I have in strong
> built-in "Server Push" technologies I'm giving the Servlets 3.0 (under
> Java EE 6 preview) a try.
> I'm posting here because my client side will (hopefully) be based on
> GWT and after going over the StockWatcher tutorial and reading a bit
> about the Server-Client relationship I'm not sure what path I can
> take.
> I'm pretty sure I can't use the GWT-RPC mode because the
> RemoteServiceServlet class extends the previous HttpServlet which
> isn't helpfull for me.
> So basically what I'm asking is, if I have a servlet built on my
> server (Glassfish V3 preview) which is called with a
> HttpServletRequest and returns HttpServletResponse (of course while
> utilizing Asynchronous support of Servlets 3.0)
> how should I go about Implementing the handle to the call of my
> servlet and the receiving of the response in the GWT side?
> I have a feeling this is a very basic question but the whole AJAX
> thinking is very new to me.
>
> Thanks for reading so far,
> Ittai
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---