K
kenvc
I'm looking for ways to communicate to a running applet, from other
parts of the web page that are running standard HTML/javascript. The
context is that I have an existing Swing desktop app that I am
converting to run as an applet, but I want to move all the navigation
to HTML, while using existing forms in the applet. This is going to
let me gradually transition the Swing app to a web-based application,
reusing Swing forms inside a browser window until I have a chance to
rewrite them all using proper web development technologies. As a user
clicks on different navigation links in the HTML portion of the
screen, I want it to notify the running applet to switch to a
different form.
I can see different ways to approach this:
1. Ideally I'd like this to all happen client-side. Unfortunately (as
far as I know), an applet has only a single entry point (init) and
there is no way for an applet tag to invoke a method on a running
applet. (Right?) My application (applet) is going to be fairly big,
so I don't want to restart it every time just to display a new form.
Given these limitations, I thought I might have a small (hidden)
applet that the navigation invokes, and passes parameters telling it
what form is desired. Then applet-to-applet communication allows the
small applet to communicate with the (big) running applet, telling it
to switch screens.
2. If client-only communication can't be used, the other alternative I
can see is to have the navigation invoke a servlet, and then the
servlet send a message to the applet telling it what form to show.
How best to send this message, considering that my clients are running
over the Internet, through their own firewalls, etc.? I would guess
my communication needs to be tunneled through HTTP in order to work
through client firewalls, but I am not sure the best way to approach
this.
Thoughts? Suggestions?
Ken Van Camp
parts of the web page that are running standard HTML/javascript. The
context is that I have an existing Swing desktop app that I am
converting to run as an applet, but I want to move all the navigation
to HTML, while using existing forms in the applet. This is going to
let me gradually transition the Swing app to a web-based application,
reusing Swing forms inside a browser window until I have a chance to
rewrite them all using proper web development technologies. As a user
clicks on different navigation links in the HTML portion of the
screen, I want it to notify the running applet to switch to a
different form.
I can see different ways to approach this:
1. Ideally I'd like this to all happen client-side. Unfortunately (as
far as I know), an applet has only a single entry point (init) and
there is no way for an applet tag to invoke a method on a running
applet. (Right?) My application (applet) is going to be fairly big,
so I don't want to restart it every time just to display a new form.
Given these limitations, I thought I might have a small (hidden)
applet that the navigation invokes, and passes parameters telling it
what form is desired. Then applet-to-applet communication allows the
small applet to communicate with the (big) running applet, telling it
to switch screens.
2. If client-only communication can't be used, the other alternative I
can see is to have the navigation invoke a servlet, and then the
servlet send a message to the applet telling it what form to show.
How best to send this message, considering that my clients are running
over the Internet, through their own firewalls, etc.? I would guess
my communication needs to be tunneled through HTTP in order to work
through client firewalls, but I am not sure the best way to approach
this.
Thoughts? Suggestions?
Ken Van Camp