users@grizzly.java.net

Re: Pojo client - a work in progress

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 07 Feb 2008 13:28:57 -0500

Peter Murray wrote:
>
> I have attached a small client which talks to the "counter" example.
> It works (renamed to counter2 for the moment) to the extent that it
> increments the counter and get the "success" message back.

This is great.

>
> Is my next step to set up a
> CometHandler<HttpServletResponse>
> class and have it listen for events from Comet as is done in the servlet?

Yes. But to be sure, are you using Grizzly Comet, Grizzlet or GlassFish v2?

Thanks. Let me know once you want to add you client stuff inside the
workspace.

-- Jeanfrancois


>
> Thanks...
>
>
> Peter
>
>
> PS when I have this working as a client for counter I would like to add
> it back to the example in SVN. Everyone in the world is not using AJAX :)
>
>
>
> public class CounterClient
> {
>
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args)
> {
> try
> {
>
> URL url = new
> URL("http://localhost:8080/counter2/long_polling");
> URLConnection conn = url.openConnection();
> conn.setDoOutput(true);
>
> BufferedWriter out =
> new BufferedWriter(new
> OutputStreamWriter(conn.getOutputStream()));
> out.write("/counter2/long_polling\r\n");
> out.flush();
> out.close();
> BufferedReader in =
> new BufferedReader(new
> InputStreamReader(conn.getInputStream()));
>
> String response;
> while ((response = in.readLine()) != null)
> {
> System.out.println(response);
> Thread.sleep(1);
> }
> //in.close();
> }
> catch (MalformedURLException ex)
> {
> System.out.println("Exception: " + ex.toString());
> }
> catch (IOException ex)
> {
> System.out.println("Exception: " + ex.toString());
> }
> catch (InterruptedException ex)
> {
> System.out.println("Exception: " + ex.toString());
> }
> }
> }
>
>
> Peter Murray
> Manager,
> Relationship Trading
>
> peter.murray_at_fxall.com
> Office: +1 646-268-9916
> Cell : +1 914-414-3727
> AIM : retepmurray
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>