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


001:        /*
002:         * $Id: PProxyConnection.java,v 1.9 2005/11/30 11:27:03 ss150821 Exp $
003:         * $Source: /m/portal/ps/srap/src/com/sun/portal/netlet/eproxy/PProxyConnection.java,v $
004:         * $Log: PProxyConnection.java,v $
005:         * Revision 1.9  2005/11/30 11:27:03  ss150821
006:         * 6356996 - Srap Code base needs to save files in the unix file format and not windows
007:         *
008:         * Revision 1.8  2005/09/21 11:40:57  ss150821
009:         * 5044474 - Putting checkin back. Fixing the GW code to read data in seconds
010:         *
011:         * Revision 1.7  2005/02/25 09:49:20  ss150821
012:         * RFE 6223490 - SRA Should use JDK based logging, changed to start throwing the full stacktrace for the  exception in the logs
013:         *
014:         * Revision 1.6  2005/02/23 05:44:08  ss150821
015:         * RFE 6223490 - SRA Should use JDK based logging
016:         *
017:         * Revision 1.5  2004/10/26 09:20:17  ss150821
018:         * #6178980 - SRA security component should point to jss4.jar
019:         *
020:         * Revision 1.4  2004/08/23 14:46:28  ss144266
021:         * Removed Comment
022:         *
023:         * Revision 1.3  2004/07/26 09:48:45  vt126379
024:         * RFE#5075809, CRT#96
025:         *
026:         * Revision 1.2  2004/07/01 10:58:22  ss144266
027:         * END 2 END SSL Support for proxylet
028:         *
029:         * Revision 1.16  2003/09/10 11:38:29  rt130506
030:         * Fix for 4919515
031:         *
032:         * Revision 1.15  2003/09/09 19:16:54  mm132998
033:         * BugID : 4775343
034:         *
035:         * Revision 1.14  2003/08/19 05:08:39  bs126381
036:         * FIX for 4908128 - Gateway in HTTP mode listens on the loopback interface
037:         *
038:         * Revision 1.13  2003/08/05 06:23:23  bs126381
039:         * FIX for 4901035 - Netlet should run only on SSL
040:         *
041:         * Revision 1.12  2003/06/23 10:37:26  bs126381
042:         * netlet proxy doesnot allow any connection to go through
043:         *
044:         * Revision 1.11  2003/06/12 13:59:26  mm132998
045:         * Netlet applet - synch fix , persistent conn fix reqd due to bug in refactoring
046:         *
047:         * Revision 1.10  2003/06/10 12:23:07  mm132998
048:         * Bug : 4875896 , Fix for opening ServerSockets only to 127.0.0.1
049:         *
050:         * Revision 1.9  2003/05/30 12:54:28  mm132998
051:         * Session Validation at server side
052:         *
053:         * Revision 1.8  2003/05/27 07:24:11  rt130506
054:         * Netlet Proxy Changes
055:         *
056:         * Revision 1.7  2003/05/19 11:58:12  mm132998
057:         * Rewriter proxy changes
058:         *
059:         * Revision 1.6  2003/03/27 11:39:51  bs126381
060:         * Netlet on SSL, SunRay
061:         *
062:         * Revision 1.5.8.2  2003/01/29 08:21:31  bs126381
063:         * Netlet on SSL - Closing non Netlet connection in NetletProxy
064:         *
065:         * Revision 1.5.8.1  2003/01/27 09:41:40  bs126381
066:         * Netlet on SSL
067:         *
068:         * Revision 1.5  2002/10/21 12:56:53  sg134305
069:         * CRT (23)  - Refactored RProxy code related to starting the server.
070:         * Created a gatewaycontext interface which can be initialized with DSAME Context in production while test/default context during unit testing.
071:         *
072:         * Revision 1.4  2002/08/21 10:39:37  ss133690
073:         * Bug 4710658
074:         *
075:         * Revision 1.3  2002/08/16 15:13:05  bv131302
076:         * Hana CRT#1888 - Check log settings before logging
077:         *
078:         * Revision 1.2  2002/07/11 06:23:22  bs126381
079:         * Hana CRT#1610 - Removing checkAppSession()
080:         *
081:         * Revision 1.1  2002/06/14 09:31:01  rt130506
082:         * SRAP rebranding
083:         *
084:         * Revision 1.3  2002/06/11 16:02:07  bv131302
085:         * new branded
086:         *
087:         * Revision 1.2  2002/05/13 06:22:25  mm132998
088:         * Perf related modifications
089:         *
090:         * Revision 1.1  2002/03/21 14:47:25  mm132998
091:         * Bug ID : # 4655970 Hana CRT : # 615 Desc : Lihue PRD 7.4.1.1 - RProxy seperation
092:         *
093:         *
094:         */
095:        /*
096:         * RProxyConnection.java
097:         *
098:         * Created on March 20, 2002, 10:31 PM
099:         */
100:
101:        package com.sun.portal.netlet.eproxy;
102:
103:        import java.net.ServerSocket;
104:        import java.net.Socket;
105:        import java.net.SocketException;
106:        import java.util.logging.Level;
107:        import java.util.logging.Logger;
108:
109:        import com.sun.portal.log.common.PortalLogger;
110:        import com.sun.portal.rproxy.configservlet.client.GatewayProfile;
111:        import com.sun.portal.rproxy.server.RequestProcessor;
112:        import com.sun.portal.rproxy.server.ServerSocketFactory;
113:        import com.sun.portal.util.GWDebug;
114:        import com.sun.portal.util.GWThreadPool;
115:        import com.sun.portal.util.ServiceIdentifier;
116:        import com.sun.portal.util.SystemProperties;
117:
118:        /*
119:         * 
120:         * @author Mridul Muralidharan
121:         */
122:
123:        public class PProxyConnection extends ProxyConnection {
124:
125:            private boolean secureConnection;
126:
127:            private int port = 0;
128:
129:            private int exposedport = 0;
130:
131:            // private static Logger logger =
132:            // Logger.getLogger("com.sun.portal.sra.netlet");
133:            private static Logger logger = PortalLogger
134:                    .getLogger(PProxyConnection.class);
135:
136:            private RequestProcessor requestProcessor;
137:
138:            public static void startHttps(final int port) {
139:                Runnable r = new Runnable() {
140:                    public void run() {
141:                        PProxyConnection rpconn = new PProxyConnection(false,
142:                                port);
143:                        try {
144:                            rpconn.start();
145:                        } catch (SocketException e) {
146:                            if (GWDebug.debug.errorEnabled())
147:                                GWDebug.debug
148:                                        .error("PProxyConnection:startHttps(int) cannot start : "
149:                                                + e);
150:                        }
151:
152:                    }
153:                };
154:                Thread thread = new Thread(r);
155:                thread.start();
156:            }
157:
158:            public static void startHttps(final int exposedPort, final int port) {
159:                Runnable r = new Runnable() {
160:                    public void run() {
161:                        PProxyConnection rpconn = new PProxyConnection(false,
162:                                exposedPort, port);
163:                        try {
164:                            rpconn.start();
165:                        } catch (SocketException e) {
166:                            if (GWDebug.debug.errorEnabled())
167:                                GWDebug.debug
168:                                        .error("PProxyConnection:startHttps(int,int) cannot start : "
169:                                                + e);
170:                        }
171:
172:                    }
173:                };
174:                Thread thread = new Thread(r);
175:                thread.start();
176:            }
177:
178:            static boolean useAcceleratorSupport = false;
179:            static {
180:                String strUseAcceleratorSupport = SystemProperties.get(
181:                        "gateway.enable.accelerator", "false");
182:                if (strUseAcceleratorSupport != null) {
183:                    useAcceleratorSupport = strUseAcceleratorSupport.trim()
184:                            .equalsIgnoreCase("true");
185:                }
186:            }
187:
188:            private PProxyConnection(boolean secureConnection, int port) {
189:                super ("PProxyHTTPSThread", "epc1");
190:                this .secureConnection = secureConnection;
191:                this .port = port;
192:                requestProcessor = new RequestProcessor("http", port);
193:            }
194:
195:            private PProxyConnection(boolean secureConnection, int exposedPort,
196:                    int port) {
197:                super ("PProxyHTTPSThread", "epc1");
198:                this .secureConnection = secureConnection;
199:                this .port = port;
200:                this .exposedport = exposedPort;
201:
202:                requestProcessor = new RequestProcessor("http", exposedPort);
203:            }
204:
205:            protected ServerSocket makeServerSocket() {
206:
207:                if (this .secureConnection && useAcceleratorSupport
208:                        && ServiceIdentifier.isGateway()) {
209:                    return ServerSocketFactory.createSRAPServerSocket(port);
210:                }
211:                // logger.info("MakeServerSocket exposedport " + exposedport);
212:                Object[] params0 = { exposedport + "" };
213:                logger.log(Level.INFO, "PSSRNTLT_CSPNEPROX050", params0);
214:                return ServerSocketFactory
215:                        .createNormalServerSocket(exposedport);
216:            }
217:
218:            /**
219:             * Return true if its the Netlet Traffic, false otherwise.
220:             */
221:            protected void process(Socket connection, Integer logId) {
222:                try {
223:                    GWThreadPool.run(new PProxyThread(connection, logId));
224:                } catch (Exception ex) {
225:                    ex.printStackTrace();
226:                }
227:            }
228:
229:            /*
230:             * protected void process(Socket connection, Integer logId) { try { // Why
231:             * did i do this ??? //System.out.println("Setting timeout for accepted
232:             * socket to "+ timeout ); //connection.setSoTimeout(30000);
233:             * 
234:             * //System.out.println("Accepted new Connection " + connection ); new
235:             * RWGroupClear(connection, port, logId); } catch (Exception ex) {
236:             * ex.printStackTrace(); } }
237:             */
238:
239:            private static final String TIMEOUT = "RProxyPortTimeout";
240:
241:            private static final int DEFAULT_TIMEOUT = 1000 * 60;
242:
243:            private static final int timeout = GatewayProfile.getInt(TIMEOUT,
244:                    DEFAULT_TIMEOUT) * 1000;
245:
246:            class PProxyThread implements  Runnable {
247:
248:                private Socket connection;
249:
250:                private Integer logId;
251:
252:                public PProxyThread(Socket _connection, Integer _logId) {
253:                    connection = _connection;
254:                    logId = _logId;
255:                }
256:
257:                public void run() {
258:                    try {
259:                        connection.setSoTimeout(timeout);
260:                        new RWGroupClear(connection, port, logId);
261:
262:                    } catch (Exception e) {
263:                    }
264:
265:                }
266:
267:            } // class PProxyThread
268:
269:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.