JDK-6740227 : DnD: file associations don't work for dragged out applets
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,linux,windows
  • CPU: generic,x86
  • Submitted: 2008-08-22
  • Updated: 2010-09-08
  • Resolved: 2009-01-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6u12 b01Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
A customer (see Comments for details) indicates that he has tried to specify a file assocation for a JNLP-launched applet which he then drags out of the browser to the desktop. The file association is correctly produced, but when a file of that type is double-clicked, there is currently no way for the applet to discover what file was selected, because it does not have a main() method and we are not doing anything to pass along the command line arguments to the applet. A mechanism for doing this will need to be created and documented.
We need to provide some way of exposing the command-line arguments to the given applet. A reasonable way might be to define the applet parameter

  _numArgs

as containing an integer (in the form of a String) indicating the number of arguments, and

  _arg0
  _arg1
  ...
  _arg(n)

where n == _numArgs - 1 as the incoming command line arguments. This information would need to be set up by the JNLP2Viewer class before launching the applet. Also, the underlying launcher will need to pass up the additional command line arguments, and the argument checking in JNLP2Viewer will need to be adjusted.

Comments
EVALUATION The JNLP2Viewer also sets the _numargs and _arg0 parameters so that a JNLP applet can retrieve the name of the file which has been associated with the applet. The applet can use the getParameters to retrieve those 2 parameters: getParameter("_numargs"); getParameter("_arg0"); For a JNLP applet which supports single instance, on a subsequent launch of the same applet, the applet can retrieve the file name via the newActivation method of its SingleInstanceListener implementation. For example: // Implementation the SingleInstanceListener for this applet class SISListener implements SingleInstanceListener { public void newActivation(String[] params) { // your code to handle the new arguments here for(int i=0; i<params.length; i++) { System.out.println("SISListener.newActivation param "+i+": "+params[i]); } } }
08-10-2008

SUGGESTED FIX http://sa.sfbay.sun.com/projects/deployment_data/6u12/6740227.5
06-10-2008

EVALUATION A fix is to handle the relaunch of an applet of the following type by uniformly going through the Web Start's Main class which will invoke JNLP2Viewer reflectively. - from a shortcut created via a JNLP applet associated with the applet-desc element; - from a shortcut by dragging out a OOPP-JNLP style applet; - from a file association. As a result of this fix, portion of the fix for 6691243 has been reverted. Specifically, the "-draggedApplet" flag processing in launcher.c and the changes in WinInstallHandler and UnixInstallHandler which adds the "-draggedApplet" to the command line for relaunching of a dragged-out applet.
06-10-2008