Salut,
glassfish_at_javadesktop.org wrote:
> I have been searching across the interwebs for an example to help walk me through using comet and glassfish. Not sure if this is also the correct location for this thread. If it is not could a Moderator please move it to the correct section.
Right place :-)
First just so everyone knows I am not a programmer. I am still
learning java as I have been going. I am doing a little side project to
do a proof of concept of using Java and comet to write a SCADA system.
Take a look at our official tutorial:
*
http://is.gd/2OwWh
This explain how you can enable and build a Comet application that will
work with GlassFish (only).
I have written a Java SE application that does all my polling for my
PLCs. I drew up a couple web pages that I would like to use comet to
push data to the page. I have not been able with any luck to get comet
to work. I am struggling how to figure out to make proper channels in
both the web page using JavaScript and also in my java application. All
the examples I have found all are just using web pages and do not
interface with a java application. If it is necessary I can move my
application to an Java EE app.
Take a look at Sreeni's blog that uses a Java Application:
*
http://is.gd/2OwZY
It use sockets. I think what you need to define is the protocol you want
to use (independently of using JavaScript, iframe or Java SE). In short,
what kind of format do you want to exchange between the client and the
server. You might want to take a look at the cometd project, which uses
JSON format:
*
http://cometd.org
I also recommend (don't know why :-)) to take a look at this Comet
Framework:
*
http://atmosphere.dev.java.net
This is a fair amount of samples/tutorials that should help you. If you
are interested to write a REST based Comet application, this project
could be useful, and will works with an technilogy supporting the http
protocol.
Could someone help me with a simple example that will take a variable
(int and string) from a java application and push those values to a HTML
page?
On your HTML side, just use an hidden iframe (see the tutorial above).
Iframe will receives your int/String etc. and display them as it is. or
course you can transform them using Javascript into something else.
I would greatly appreciate any help I receive.
Hope that help.
A+
--Jeanfrancois
> [Message sent by forum member 'jeep2007' (jeepindude2007_at_comcast.net)]
>
> http://forums.java.net/jive/thread.jspa?messageID=362766
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>