Article View: borland.public.jbuilder.java.language
Article #15203Re: Notify clients when a value has changed
From: mirko
Date: Mon, 05 Jul 1999 00:00
Date: Mon, 05 Jul 1999 00:00
109 lines
5050 bytes
5050 bytes
--------------4948D3E52C770518A129521F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
The best way to do what you need, is to use RMI, but do not carry an Event
Object, just a serializable one that you will build.
* Each Applet exports itself ( via RMI) and communicate to the Server its
reference
* The applet interface provides the method "void notify(Object theObj)"
* The Server maintains a Vector of active Applets
* When the event occurs, it build the "theObj" object, and calls notify of
each applet, passing it.
I hope it helps.
Notice that some browser cause a Security Exception when an applet try to
export itself, but everything should go anyway.. Please let me know how things
are doing!
CIAO
Konstantinidis Panagiotis wrote:
> I'm building a web-based application for an intranet and I need to
> notify all applets that are currently loaded in all clients of a value
> change (basically the primary key of a database which is incremented, by a
> servlet, when a new record is created).
>
> My first thought is a bound property which fires a propertyChange event
> and the applet listens and displays the new value of the primary key to the
> user. After determining that this is not sufficient I added RMI to the
> picture. But unfortunatelly once again my goal is not reached since RMI
> deals with objects that are serialized and events are not part of that.
>
> Theoritically this situation could be solved with ports communication.
> This means that the applets must have a thread listening to a specific port
> and everything that changes my primary key send data to that port. The
> problem that arises here is that I do not know all the hosts that
> potentially need this info, so the servlet wouldn't know in which IPs to
> send the data.
>
> Is the theoritical part right? Is there any other easier way to achieve
> what I need?
--------------4948D3E52C770518A129521F
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
The best way to do what you need, is to use RMI, but do not carry an Event
Object, just a serializable one that you will build.
<br>
<ul>
<li>
Each Applet exports itself ( via RMI) and communicate to the Server its
reference</li>
<li>
The applet interface provides the method "void notify(Object theObj)"</li>
<li>
The Server maintains a Vector of active Applets</li>
<li>
When the event occurs, it build the "theObj" object, and calls notify of
each applet, passing it.</li>
</ul>
I hope it helps.
<br>Notice that some browser cause a Security Exception when an applet
try to export itself, but everything should go anyway.. Please let me know
how things are doing!
<p>CIAO
<br>
<p>Konstantinidis Panagiotis wrote:
<blockquote TYPE=CITE> I'm building a web-based application
for an intranet and I need to
<br>notify all applets that are currently loaded in all clients of a value
<br>change (basically the primary key of a database which is incremented,
by a
<br>servlet, when a new record is created).
<p> My first thought is a bound property which fires
a propertyChange event
<br>and the applet listens and displays the new value of the primary key
to the
<br>user. After determining that this is not sufficient I added RMI to
the
<br>picture. But unfortunatelly once again my goal is not reached since
RMI
<br>deals with objects that are serialized and events are not part of that.
<p> Theoritically this situation could be solved with
ports communication.
<br>This means that the applets must have a thread listening to a specific
port
<br>and everything that changes my primary key send data to that port.
The
<br>problem that arises here is that I do not know all the hosts that
<br>potentially need this info, so the servlet wouldn't know in which IPs
to
<br>send the data.
<p> Is the theoritical part right? Is there any other
easier way to achieve
<br>what I need?</blockquote>
</html>
--------------4948D3E52C770518A129521F--
Technical Details
Message-ID:
<37807726.CCA804F3@ingce.unibo.it>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7lm6r7$pth$1@medousa.forthnet.gr>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,1f8877e7b737ee56 X-Google-Attributes: gidf74b3,public X-Google-Thread: f5d71,1f8877e7b737ee56 X-Google-Attributes: gidf5d71,public From: mirko <mviroli@ingce.unibo.it> Subject: Re: Notify clients when a value has changed Date: 1999/07/05 Message-ID: <37807726.CCA804F3@ingce.unibo.it> X-Deja-AN: 497307759 References: <7lm6r7$pth$1@medousa.forthnet.gr> X-Accept-Language: en Content-Type: multipart/alternative; boundary="------------4948D3E52C770518A129521F" X-Complaints-To: news@cineca.it X-Trace: news.cineca.it 931166108 28126 137.204.191.24 (5 Jul 1999 09:15:08 GMT) Organization: CINECA Mime-Version: 1.0 NNTP-Posting-Date: 5 Jul 1999 09:15:08 GMT Newsgroups: borland.public.jbuilder.java.language,comp.lang.java