Source Code Cross Referenced for NetletProxy.java in  » Portal » Open-Portal » com » sun » portal » netlet » proxy » 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.netlet.proxy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // @(#)NetletProxy.java 1.14     "@(#)NetletProxy.java	1.14 00/12/21 Sun Microsystems"
002:
003:        package com.sun.portal.netlet.proxy;
004:
005:        // JDK classes
006:
007:        import java.io.BufferedInputStream;
008:        import java.io.BufferedReader;
009:        import java.io.DataOutputStream;
010:        import java.io.FileOutputStream;
011:        import java.io.IOException;
012:        import java.io.InputStreamReader;
013:        import java.net.Socket;
014:        import java.net.SocketException;
015:        import java.util.ResourceBundle;
016:        import java.util.StringTokenizer;
017:        import java.util.logging.Level;
018:        import java.util.logging.Logger;
019:
020:        import javax.servlet.http.HttpServletRequest;
021:        import javax.servlet.http.HttpServletResponse;
022:
023:        import com.iplanet.services.comm.client.PLLNotificationServlet;
024:        import com.sun.portal.log.common.PortalLogger;
025:        import com.sun.portal.netlet.eproxy.GW;
026:        import com.sun.portal.netlet.eproxy.RProxyConnection;
027:        import com.sun.portal.rproxy.configservlet.client.GatewayProfile;
028:        import com.sun.portal.rproxy.configservlet.client.PlatformProfile;
029:        import com.sun.portal.rproxy.connectionhandler.GatewayServletResponse;
030:        import com.sun.portal.rproxy.connectionhandler.HTTPRequest;
031:        import com.sun.portal.rproxy.connectionhandler.HTTPSession;
032:        import com.sun.portal.rproxy.connectionhandler.Request;
033:        import com.sun.portal.rproxy.connectionhandler.Response;
034:        import com.sun.portal.rproxy.connectionhandler.Session;
035:        import com.sun.portal.rproxy.monitoring.MonitoringSubsystem;
036:        import com.sun.portal.rproxy.server.GatewayContextFactory;
037:        import com.sun.portal.rproxy.server.RequestProcessor;
038:        import com.sun.portal.util.GWDebug;
039:        import com.sun.portal.util.GWLocale;
040:        import com.sun.portal.util.GWNSSInit;
041:        import com.sun.portal.util.GWThreadPool;
042:        import com.sun.portal.util.NetletLogMgr;
043:        import com.sun.portal.util.ServiceIdentifier;
044:        import com.sun.portal.util.SystemProperties;
045:
046:        public class NetletProxy {
047:
048:            public static ResourceBundle eResources;
049:
050:            /*
051:             * private static String _server_host; private static String _server_port;
052:             * private static String _server_protocol;
053:             * 
054:             * public static final int DEFAULT_MAXECONN = 1000;
055:             */
056:            public static final String DEFAULT_PORT = "10555";
057:
058:            private static Logger logger = null;
059:
060:            static {
061:                System.setProperty("com.sun.portal.sra.component.type",
062:                        "nlproxy");
063:                if (logger == null) {
064:                    // The following will replace the %sraComponentType key in the log
065:                    // file with the key
066:                    // NetletProxy and generate the log file name . See the
067:                    // platform.conf file for the entire
068:                    // key
069:
070:                    logger = PortalLogger.getLogger(NetletProxy.class);
071:                }
072:
073:                try {
074:                    GWNSSInit.initialize();
075:                } catch (SocketException e1) {
076:                    if (GWDebug.debug.errorEnabled())
077:                        GWDebug.debug
078:                                .error("NetletProxy: Unable to initialize NSS -> "
079:                                        + e1);
080:                }
081:
082:                /*
083:                 * _server_host = SystemProperties.get("portal.server.host");
084:                 * _server_port = SystemProperties.get("portal.server.port");
085:                 * _server_protocol = SystemProperties.get("portal.server.protocol");
086:                 */
087:                try {
088:                    String profileName = System.getProperty(
089:                            "gateway.profilename", "default");
090:                    GatewayProfile.init("this-should-be-sid", profileName);
091:                    PlatformProfile.init("this-should-be-sid");
092:                } catch (Exception e) {
093:                    // logger.severe("NetletProxy: Unable to initialize
094:                    // GatewayProfile/PlatformProfile -> " + e);
095:                    logger.log(Level.SEVERE, "PSSRNTLT_CSPNPROXY000", e);
096:                    System.exit(1);
097:                }
098:                GWDebug.createDefault("srapNetletProxy");
099:
100:                ServiceIdentifier.createDefault("srapNetletProxy");
101:
102:                if (NetletLogMgr.loggingEnabled) {
103:                    StringBuffer logsb = new StringBuffer();
104:                    logsb.append("srapNetlet_").append(
105:                            SystemProperties.get("gateway.host").replace('-',
106:                                    '_')).append('_').append(
107:                            System
108:                                    .getProperty("gateway.profilename",
109:                                            "default").replace('-', '_'));
110:                    NetletLogMgr.createDefault(logsb.toString());
111:                    // logger.info("NetletProxy: Log file -> " + logsb.toString());
112:                    Object[] params1 = { logsb.toString() };
113:                    logger.log(Level.INFO, "PSSRNTLT_CSPNPROXY001", params1);
114:                }
115:
116:                GWLocale.createDefault();
117:                GWThreadPool.init();
118:
119:                GatewayContextFactory
120:                        .init(GatewayContextFactory.DSAME_INSTANCE);
121:            }
122:
123:            public static void main(String argv[]) {
124:
125:                // Switch uid to desired user.
126:                // NetletProxyUID SetUID = new NetletProxyUID();
127:                // SetUID.SwitchToUser();
128:                GW.setNumberOfInstances(1);
129:
130:                /*
131:                 * Added for RFE#4646305
132:                 */
133:                int portnum = 10555;
134:                try {
135:                    portnum = Integer.valueOf(
136:                            SystemProperties.get("netletproxy.port",
137:                                    DEFAULT_PORT)).intValue();
138:                    String portInfoFile = argv[0];
139:                    FileOutputStream fos = new FileOutputStream(portInfoFile,
140:                            true);
141:                    String str = "port=" + portnum + "\n";
142:                    byte b[] = str.getBytes();
143:                    fos.write(b);
144:                    fos.flush();
145:                    fos.close();
146:                } catch (Exception e) {
147:                    // logger.severe("Cannot write netlet proxy port to the output
148:                    // file");
149:                    logger.severe("PSSRNTLT_CSPNPROXY002");
150:                }
151:                // logger.info("Starting proxy at port -> " + portnum);
152:                Object[] params3 = { portnum + "" };
153:                logger.log(Level.INFO, "PSSRNTLT_CSPNPROXY003", params3);
154:                RProxyConnection.startHttps(portnum);
155:                MonitoringSubsystem.getInstance();
156:                /*
157:                 * EProxyConnection sc = new EProxyConnection(portnum); sc.start();
158:                 */
159:            }
160:
161:            public static void exit(int status) {
162:                System.exit(status);
163:            }
164:
165:            public static void processAmNotification(final Socket sock) {
166:                // Process Notification in a separate thread.
167:                Runnable r = new Runnable() {
168:                    public void run() {
169:                        try {
170:                            logger.info("PSSRNTLT_CSPNPROXY004");
171:                            sock.setSoTimeout(5000);
172:
173:                            BufferedReader reader = new BufferedReader(
174:                                    new InputStreamReader(sock.getInputStream()));
175:
176:                            String line = "";
177:                            HTTPRequest req = new HTTPRequest();
178:                            HTTPSession session = new HTTPSession(sock);
179:
180:                            while ((line = reader.readLine()).length() > 0)
181:                                req.addHeaderLine(line);
182:
183:                            if (req != null) {
184:                                if (req.getGatewayScheme().equals(
185:                                        Session.notificationURL)) {
186:                                    logger.info("PSSRNTLT_CSPNPROXY005");
187:                                    session.processNotificationRequest(req);
188:                                } else
189:                                    sock.close();
190:                            }
191:
192:                        } catch (Exception e) {
193:                            // TODO Auto-generated catch block
194:                            logger
195:                                    .severe("Error processing Notification Request from Access Manager");
196:                        }
197:                    }
198:                };
199:                new Thread(r).start();
200:            }
201:
202:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.