0

In my web application we are using java applet with java web start (jnlp) for showing ticket and printing from client machine using the selected data from web application. If the print is successful, then server gets related notification according to which we take further action. Is there any alternative to it as I want to avoid installing jre in browser and different settings in the client machine? Problem with the existing system is that if a client declines accepting certificate then we are not able to print ticket from the client's printer and we don't get any response. If the user declines accepting the certificate then the server should get notified about it. Any help will be appreciated.

Cerbrus
  • 70,800
  • 18
  • 132
  • 147
DpkTheJavaCoder
  • 117
  • 1
  • 10

1 Answers1

1

If the user declines accepting the certificate then the server should get notified about it.

Provide a parameter/propety in the JNLP file unique to the customer or that launch. When the app. is set up and on-screen, have it 'phone home' to the server with the unique identifier.

Those clients that don't reply with the unique value either refused the certificate or had the app. crash fatally before appearing on-screen.

The property element & System.getProperty(String)

JNLP property element

The JNLP property element is part of the resources section of the JNLP file.

The property element defines a system property that will be available through the System.getProperty and System.setProperties methods. It has two required attributes: name and value. For example:

<property name="key" value="overwritten"/>

Properties set in the jnlp file will normally be set by Java Web Start after the VM is started but before the application is invoked. ..

System.getProperty

See the docs for System.getProperty(String).

public static String getProperty(String key)

Gets the system property indicated by the specified key.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • Thanks for the reply. I'll give it a try. Is there anything else beside applet which I can use to achieve the same result? – DpkTheJavaCoder Jun 30 '14 at 12:00
  • *"is there anything else beside applet which I can use to achieve the same result?"* Sure, a free floating desktop app. (e.g. using a `JFrame`) also launched using JWS. In fact, it's a lot easier than dealing with the applet/browsers/JRE interaction bugs that plague embedded applets. I often ask people [why applet at all?](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/) – Andrew Thompson Jun 30 '14 at 12:05
  • But can I send data from web app to free floating desktop app for printing? – DpkTheJavaCoder Jun 30 '14 at 12:08
  • Can u please send some SSCCE for doing this (setting param/property) and using them? – DpkTheJavaCoder Jul 01 '14 at 06:49
  • An SSCCE (one single chunk of text to copy/paste) of this is not possible in that it involves both code and a JNLP file at the very least. Also SO is not a code factory. OTOH, see the above update for a start on the solution. – Andrew Thompson Jul 01 '14 at 07:06
  • Now I am able to set and get property from jnlp file, but when I am trying to get property from dynamic jnlp (created using a servlet), I am getting null. I am setting property like this:. Can u please tell me what I am doing wrong? I am using java6. – DpkTheJavaCoder Jul 04 '14 at 11:13
  • Be sure to check the JNLP output of the servlet using JaNeLA, available [here](https://drive.google.com/folderview?id=0B5B9wDXIGw9lUnJaUjA2cmlVRE0). – Andrew Thompson Jul 04 '14 at 11:16
  • Try it again. It worked for me just moments ago, and has worked for others in the past. – Andrew Thompson Jul 04 '14 at 11:35
  • JNLP output is correct but I am not able to get the value (getting null). – DpkTheJavaCoder Jul 07 '14 at 05:36