Source Code Cross Referenced for JWSDetectionApplet.java in  » Portal » Open-Portal » com » sun » portal » proxylet » client » jwsdetect » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.proxylet.client.jwsdetect 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.sun.portal.proxylet.client.jwsdetect;
002:
003:        /**
004:         * @author amitosh
005:         * Date: Apr 4, 2005
006:         */
007:        import java.applet.Applet;
008:        import java.net.ServerSocket;
009:        import java.net.Socket;
010:        import java.lang.reflect.*;
011:
012:        import netscape.javascript.JSObject;
013:
014:        public class JWSDetectionApplet extends Applet {
015:            StringBuffer buffer;
016:            private String jwsInstalled;
017:
018:            public void init() {
019:                buffer = new StringBuffer();
020:                addItem("initializing... ");
021:            }
022:
023:            public void start() {
024:                RegReader registryReader = RegReader.getInstance();
025:                boolean b = registryReader.detectJWSInstallation();
026:                jwsInstalled = (new Boolean(b)).toString();
027:
028:                try {
029:
030:                    // If "deployment.browser.path" is IE, start a temporary listener.
031:                    String browser = System.getProperty("java.library.path");
032:                    System.out.println("browser type " + browser);
033:                    if (browser != null
034:                            && browser.indexOf("Internet Explorer") != -1) {
035:                        try {
036:                            System.out.println("Starting listner on 58083...");
037:                            ServerSocket serverSocket = new ServerSocket(58083);
038:                            (new ServerSocketThread(serverSocket)).start();
039:                        } catch (Exception ignore) {
040:                        }
041:                    }
042:
043:                    JSObject win = JSObject.getWindow(this );
044:                    Object args[] = new Object[2];
045:                    args[0] = getJavaVersion();
046:                    args[1] = getJWSInstalled();
047:                    win.call("processJWSLaunch", args);
048:                } catch (Exception e) {
049:                    e.printStackTrace();
050:                }
051:            }
052:
053:            public String getJWSInstalled() {
054:                return jwsInstalled;
055:            }
056:
057:            public String getJavaVersion() {
058:                return System.getProperty("java.version");
059:            }
060:
061:            void addItem(String newWord) {
062:                System.out.println(newWord);
063:                buffer.append(newWord);
064:            }
065:
066:            /*
067:             * This listerner class accepts a request and bounces the JVM proxy settings
068:             */
069:            class ServerSocketThread extends Thread {
070:                private ServerSocket serverSocket = null;
071:
072:                ServerSocketThread(ServerSocket socket) {
073:                    super ("ServerSocketThread");
074:                    this .serverSocket = socket;
075:                }
076:
077:                public void run() {
078:                    boolean running = true;
079:                    try {
080:                        while (running) {
081:                            Socket client = serverSocket.accept();
082:
083:                            System.out.println("process request for " + client);
084:
085:                            // Make JVM re-read proxy configuration
086:                            // This is only required incase of IE browser
087:                            Class CResetProxyManager = null;
088:                            Method reset = null;
089:                            try {
090:                                CResetProxyManager = Class
091:                                        .forName("sun.plugin.net.proxy.PluginProxyManager");
092:                            } catch (ClassNotFoundException cnf) {
093:                                try {
094:                                    CResetProxyManager = Class
095:                                            .forName("com.sun.deploy.net.proxy.DynamicProxyManager");
096:                                } catch (ClassNotFoundException cnf1) {
097:                                    System.out
098:                                            .println("Unable to reset plugin proxy information for this JVM");
099:                                }
100:                            }
101:
102:                            if (CResetProxyManager != null) {
103:                                try {
104:                                    reset = CResetProxyManager.getMethod(
105:                                            "reset", null);
106:                                    reset.invoke(null, null);
107:                                } catch (Exception e) {
108:                                    System.out
109:                                            .println("Unable to reset plugin proxy information for this JVM");
110:                                }
111:                            }
112:
113:                            client.close();
114:                            running = false;
115:                            serverSocket.close();
116:                            serverSocket = null;
117:
118:                        }
119:                    } catch (Exception e) {
120:                        running = false;
121:                    }
122:                }
123:            } // End of ServerSocketThread
124:
125:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.