Author |
Message |
14/05/2016 08:32:41
|
unger
Power User
Joined: 22/07/2008 05:19:28
Messages: 261
Offline
|
Hello,
I am looking for a solution to ensure that only one client instance of an application is startet.
The termination must happen before Dispatcher instantiation.
Is that something that should be managed within the starting process (javaws)?
Regards,
Joachim
|
|
|
14/05/2016 08:39:39
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5520
Offline
|
...you have to make sure by your server side appliaction which refuses to open up a second (meaningful) session.
Please note: put a SESSIONCLOSER into the outest page (BEANPROCESSING > SESIONCLOSER) so that the session is closed if the one (allowed) instance is closing. On dispatcher side the destroy of the dispatcher is called.
Regards, Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
14/05/2016 10:22:15
|
unger
Power User
Joined: 22/07/2008 05:19:28
Messages: 261
Offline
|
Hi Björn,
...you have to make sure by your server side appliaction which refuses to open up a second (meaningful) session.
That's a very late. Any servlet listener or filter means that the client has been loaded. What should happen then?
Do You (or anybody) have some clues what can be managed inside Java Webstart?
Regards,
Joachim
|
|
|
14/05/2016 10:29:34
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5520
Offline
|
Joachim,
compare the client with the browser. You cannot prevent the user from starting the browser! But the server side application has to rule things like "only one logon allowed".
Of course you could write an own Swing program calling the client internally, and this Swing program may do whatever is possible... ;-)
Regards, Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
06/06/2016 07:59:53
|
rheinrichs
Power User
Joined: 08/05/2009 10:05:36
Messages: 209
Offline
|
Hi Joachim,
I had the same requirement for my project.
One possible (my) solution:
- create something like this:
class JnlpDownloadServlet extends jnlp.sample.servlet.JnlpDownloadServlet
Example how the default works, you'll find in the Java Servlet JNLP example.
- First servlet request creates a session ID (Cookie_ID) and extend this to the JNLP query String.
- Create customiezed JNLP template like this:
<jnlp spec="1.0" codebase="$$codebase" href="$$name?$$querystring">
...
<argument>faces/yourapp/outer.jsp?$$querystring</argument>
- registered Dispatcher when created:
// register client context for link into an existing session
JnlpDownloadServlet.registerJnlpListener(this);
- Second call (to JNLP servlet) check the Cookie_ID and decide:
a) answer a JNLP call page (or)
b) send request to existing instance and answer a HTML page (mybe with force startup)
- Last point: Add WindowFocusListener (UIComponent) to your existing application. This check, if some startup parameter has to handle, when focus the current application window.
This works fine for me and only a single application is started.
Limitations:
- Only webstart oriented
- Empty browser window is left open. Close with java script will need user interaction (security dialog)
If you have any questions, just let me know...
regard,
Roland
|
|
|
|