10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package sun.net.www; 27 import java.net.URL; 28 import java.io.*; 29 import java.util.StringTokenizer; 30 import sun.misc.ManagedLocalsThread; 31 32 class MimeLauncher extends ManagedLocalsThread { 33 java.net.URLConnection uc; 34 MimeEntry m; 35 String genericTempFileTemplate; 36 InputStream is; 37 String execPath; 38 39 MimeLauncher (MimeEntry M, java.net.URLConnection uc, 40 InputStream is, String tempFileTemplate, String threadName) throws ApplicationLaunchException { 41 super(threadName); 42 m = M; 43 this.uc = uc; 44 this.is = is; 45 genericTempFileTemplate = tempFileTemplate; 46 47 /* get the application to launch */ 48 String launchString = m.getLaunchString(); 49 50 /* get a valid path to launch application - sets 51 the execPath instance variable with the correct path. 52 */ 53 if (!findExecutablePath(launchString)) { 54 /* strip off parameters i.e %s */ 55 String appName; 56 int index = launchString.indexOf(' '); 57 if (index != -1) { 58 appName = launchString.substring(0, index); 59 } 60 else { 61 appName = launchString; | 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package sun.net.www; 27 import java.net.URL; 28 import java.io.*; 29 import java.util.StringTokenizer; 30 31 class MimeLauncher extends Thread { 32 java.net.URLConnection uc; 33 MimeEntry m; 34 String genericTempFileTemplate; 35 InputStream is; 36 String execPath; 37 38 MimeLauncher (MimeEntry M, java.net.URLConnection uc, 39 InputStream is, String tempFileTemplate, String threadName) throws ApplicationLaunchException { 40 super(null, null, threadName, 0, false); 41 m = M; 42 this.uc = uc; 43 this.is = is; 44 genericTempFileTemplate = tempFileTemplate; 45 46 /* get the application to launch */ 47 String launchString = m.getLaunchString(); 48 49 /* get a valid path to launch application - sets 50 the execPath instance variable with the correct path. 51 */ 52 if (!findExecutablePath(launchString)) { 53 /* strip off parameters i.e %s */ 54 String appName; 55 int index = launchString.indexOf(' '); 56 if (index != -1) { 57 appName = launchString.substring(0, index); 58 } 59 else { 60 appName = launchString; |