01: /*
02: * Detects the type of Client VM
03: *
04: * @author Rajesh T
05: * @date 18-July-2003
06: */
07: package com.sun.portal.netlet.client.applet;
08:
09: import java.applet.Applet;
10: import java.applet.AppletContext;
11: import java.net.URL;
12:
13: public class NetletEnvDetect extends Applet {
14: boolean JSSEdetected = false;
15:
16: public void init() {
17: System.out.println("NetletEnvDetect init ");
18: AppletContext appContext = this .getAppletContext();
19: String configURL = this .getParameter("configURL");
20:
21: /*
22: boolean proxyletMode = false;
23: String proxyletEnabledParameter =
24: System.getProperty("com.sun.portal.proxylet.proxyletMode");
25: if(proxyletEnabledParameter != null && proxyletEnabledParameter.equals("true")){
26: proxyletMode = true;
27: }
28: */
29: if (configURL != null && configURL.startsWith("/")) {
30: System.out.println("NetletEnvDetect : proxylet running");
31: String codebaseURL = this .getCodeBase().toString();
32: int hostIndex = codebaseURL.indexOf("/");
33: int portIndex = codebaseURL.indexOf("/", hostIndex + 2);
34: configURL = codebaseURL.substring(0, portIndex) + configURL;
35: }
36: System.out.println("NetletEnvDetect configURL : " + configURL);
37:
38: try {
39: Class.forName("javax.net.ssl.SSLContext");
40: configURL = configURL + "?func=makeNetletFrame&JSSE=true";
41: appContext.showDocument(new URL(configURL), "_self");
42: } catch (Exception e) {
43: System.out
44: .println("JSSE not supported, Loading Native Netlet");
45: try {
46: configURL = configURL + "?func=makeNetletFrame";
47: appContext.showDocument(new URL(configURL), "_self");
48: } catch (Exception e1) {
49: e1.printStackTrace();
50: }
51: }
52: }
53: }
|