Source Code Cross Referenced for SSLServerSocketImpl.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » xnet » provider » jsse » 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 » Apache Harmony Java SE » org package » org.apache.harmony.xnet.provider.jsse 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:
018:        /**
019:         * @author Alexander Y. Kleymenov
020:         * @version $Revision$
021:         */package org.apache.harmony.xnet.provider.jsse;
022:
023:        import org.apache.harmony.xnet.provider.jsse.SSLSocketImpl;
024:        import org.apache.harmony.xnet.provider.jsse.SSLParameters;
025:
026:        import java.io.IOException;
027:        import java.net.InetAddress;
028:        import java.net.Socket;
029:        import javax.net.ssl.SSLServerSocket;
030:
031:        /**
032:         * SSLServerSocket implementation
033:         * @see javax.net.ssl.SSLServerSocket class documentation for more information.
034:         */
035:        public class SSLServerSocketImpl extends SSLServerSocket {
036:
037:            // the sslParameters object incapsulates all the info
038:            // about supported and enabled cipher suites and protocols,
039:            // as well as the information about client/server mode of
040:            // ssl socket, whether it require/want client authentication or not,
041:            // and controls whether new SSL sessions may be established by this
042:            // socket or not.
043:            private final SSLParameters sslParameters;
044:
045:            // logger
046:            private Logger.Stream logger = Logger.getStream("ssocket");
047:
048:            /**
049:             * Ctor
050:             * @param   sslParameters:  SSLParameters
051:             * @throws  IOException
052:             */
053:            protected SSLServerSocketImpl(SSLParameters sslParameters)
054:                    throws IOException {
055:                super ();
056:                this .sslParameters = sslParameters;
057:            }
058:
059:            /**
060:             * Ctor
061:             * @param   port:   int
062:             * @param   sslParameters:  SSLParameters
063:             * @throws  IOException
064:             */
065:            protected SSLServerSocketImpl(int port, SSLParameters sslParameters)
066:                    throws IOException {
067:                super (port);
068:                this .sslParameters = sslParameters;
069:            }
070:
071:            /**
072:             * Ctor
073:             * @param   port:   int
074:             * @param   backlog:    int
075:             * @param   sslParameters:  SSLParameters
076:             * @throws  IOException
077:             */
078:            protected SSLServerSocketImpl(int port, int backlog,
079:                    SSLParameters sslParameters) throws IOException {
080:                super (port, backlog);
081:                this .sslParameters = sslParameters;
082:            }
083:
084:            /**
085:             * Ctor
086:             * @param   port:   int
087:             * @param   backlog:    int
088:             * @param   iAddress:   InetAddress
089:             * @param   sslParameters:  SSLParameters
090:             * @throws  IOException
091:             */
092:            protected SSLServerSocketImpl(int port, int backlog,
093:                    InetAddress iAddress, SSLParameters sslParameters)
094:                    throws IOException {
095:                super (port, backlog, iAddress);
096:                this .sslParameters = sslParameters;
097:            }
098:
099:            // --------------- SSLParameters based methods ---------------------
100:
101:            /**
102:             * This method works according to the specification of implemented class.
103:             * @see javax.net.ssl.SSLServerSocket#getSupportedCipherSuites()
104:             * method documentation for more information
105:             */
106:            public String[] getSupportedCipherSuites() {
107:                return CipherSuite.getSupportedCipherSuiteNames();
108:            }
109:
110:            /**
111:             * This method works according to the specification of implemented class.
112:             * @see javax.net.ssl.SSLServerSocket#getEnabledCipherSuites()
113:             * method documentation for more information
114:             */
115:            public String[] getEnabledCipherSuites() {
116:                return sslParameters.getEnabledCipherSuites();
117:            }
118:
119:            /**
120:             * This method works according to the specification of implemented class.
121:             * @see javax.net.ssl.SSLServerSocket#setEnabledCipherSuites(String[])
122:             * method documentation for more information
123:             */
124:            public void setEnabledCipherSuites(String[] suites) {
125:                sslParameters.setEnabledCipherSuites(suites);
126:            }
127:
128:            /**
129:             * This method works according to the specification of implemented class.
130:             * @see javax.net.ssl.SSLServerSocket#getSupportedProtocols()
131:             * method documentation for more information
132:             */
133:            public String[] getSupportedProtocols() {
134:                return (String[]) ProtocolVersion.supportedProtocols.clone();
135:            }
136:
137:            /**
138:             * This method works according to the specification of implemented class.
139:             * @see javax.net.ssl.SSLServerSocket#getEnabledProtocols()
140:             * method documentation for more information
141:             */
142:            public String[] getEnabledProtocols() {
143:                return sslParameters.getEnabledProtocols();
144:            }
145:
146:            /**
147:             * This method works according to the specification of implemented class.
148:             * @see javax.net.ssl.SSLServerSocket#setEnabledProtocols(String[])
149:             * method documentation for more information
150:             */
151:            public void setEnabledProtocols(String[] protocols) {
152:                sslParameters.setEnabledProtocols(protocols);
153:            }
154:
155:            /**
156:             * This method works according to the specification of implemented class.
157:             * @see javax.net.ssl.SSLServerSocket#setUseClientMode(boolean)
158:             * method documentation for more information
159:             */
160:            public void setUseClientMode(boolean mode) {
161:                sslParameters.setUseClientMode(mode);
162:            }
163:
164:            /**
165:             * This method works according to the specification of implemented class.
166:             * @see javax.net.ssl.SSLServerSocket#getUseClientMode()
167:             * method documentation for more information
168:             */
169:            public boolean getUseClientMode() {
170:                return sslParameters.getUseClientMode();
171:            }
172:
173:            /**
174:             * This method works according to the specification of implemented class.
175:             * @see javax.net.ssl.SSLServerSocket#setNeedClientAuth(boolean)
176:             * method documentation for more information
177:             */
178:            public void setNeedClientAuth(boolean need) {
179:                sslParameters.setNeedClientAuth(need);
180:            }
181:
182:            /**
183:             * This method works according to the specification of implemented class.
184:             * @see javax.net.ssl.SSLServerSocket#getNeedClientAuth()
185:             * method documentation for more information
186:             */
187:            public boolean getNeedClientAuth() {
188:                return sslParameters.getNeedClientAuth();
189:            }
190:
191:            /**
192:             * This method works according to the specification of implemented class.
193:             * @see javax.net.ssl.SSLServerSocket#setWantClientAuth(boolean)
194:             * method documentation for more information
195:             */
196:            public void setWantClientAuth(boolean want) {
197:                sslParameters.setWantClientAuth(want);
198:            }
199:
200:            /**
201:             * This method works according to the specification of implemented class.
202:             * @see javax.net.ssl.SSLServerSocket#getWantClientAuth()
203:             * method documentation for more information
204:             */
205:            public boolean getWantClientAuth() {
206:                return sslParameters.getWantClientAuth();
207:            }
208:
209:            /**
210:             * This method works according to the specification of implemented class.
211:             * @see javax.net.ssl.SSLServerSocket#setEnableSessionCreation(boolean)
212:             * method documentation for more information
213:             */
214:            public void setEnableSessionCreation(boolean flag) {
215:                sslParameters.setEnableSessionCreation(flag);
216:            }
217:
218:            /**
219:             * This method works according to the specification of implemented class.
220:             * @see javax.net.ssl.SSLServerSocket#getEnableSessionCreation()
221:             * method documentation for more information
222:             */
223:            public boolean getEnableSessionCreation() {
224:                return sslParameters.getEnableSessionCreation();
225:            }
226:
227:            // ------------- ServerSocket's methods overridings ----------------
228:
229:            /**
230:             * This method works according to the specification of implemented class.
231:             * @see java.net.ServerSocket#accept()
232:             * method documentation for more information
233:             */
234:            public Socket accept() throws IOException {
235:                if (logger != null) {
236:                    logger.println("SSLServerSocketImpl.accept ..");
237:                }
238:                SSLSocketImpl s = new SSLSocketImpl(
239:                        (SSLParameters) sslParameters.clone());
240:                implAccept(s);
241:                SecurityManager sm = System.getSecurityManager();
242:                if (sm != null) {
243:                    try {
244:                        sm.checkAccept(s.getInetAddress().getHostAddress(), s
245:                                .getPort());
246:                    } catch (SecurityException e) {
247:                        s.close();
248:                        throw e;
249:                    }
250:                }
251:                s.init();
252:                s.startHandshake();
253:                if (logger != null) {
254:                    logger
255:                            .println("SSLServerSocketImpl: accepted, initialized");
256:                }
257:                return s;
258:            }
259:
260:            /**
261:             * Returns the string representation of the object.
262:             */
263:            public String toString() {
264:                return "[SSLServerSocketImpl]";
265:            }
266:
267:            // -----------------------------------------------------------------
268:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.