Source Code Cross Referenced for SSLServerIOEventDispatch.java in  » Web-Services-AXIS2 » kernal » org » apache » axis2 » transport » nhttp » 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 » Web Services AXIS2 » kernal » org.apache.axis2.transport.nhttp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */
019:        package org.apache.axis2.transport.nhttp;
020:
021:        import java.io.IOException;
022:
023:        import javax.net.ssl.SSLContext;
024:        import javax.net.ssl.SSLException;
025:
026:        import org.apache.http.impl.DefaultHttpRequestFactory;
027:        import org.apache.http.impl.nio.DefaultNHttpServerConnection;
028:        import org.apache.http.impl.nio.reactor.SSLIOSession;
029:        import org.apache.http.impl.nio.reactor.SSLIOSessionHandler;
030:        import org.apache.http.impl.nio.reactor.SSLMode;
031:        import org.apache.http.nio.NHttpServiceHandler;
032:        import org.apache.http.nio.reactor.IOEventDispatch;
033:        import org.apache.http.nio.reactor.IOSession;
034:        import org.apache.http.nio.util.HeapByteBufferAllocator;
035:        import org.apache.http.params.HttpParams;
036:
037:        public class SSLServerIOEventDispatch implements  IOEventDispatch {
038:
039:            private static final String NHTTP_CONN = "AXIS2.NHTTP_CONN";
040:            private static final String SSL_SESSION = "AXIS2.SSL_SESSION";
041:
042:            private final NHttpServiceHandler handler;
043:            private final SSLContext sslcontext;
044:            private final SSLIOSessionHandler sslHandler;
045:            private final HttpParams params;
046:
047:            public SSLServerIOEventDispatch(final NHttpServiceHandler handler,
048:                    final SSLContext sslcontext,
049:                    final SSLIOSessionHandler sslHandler,
050:                    final HttpParams params) {
051:                super ();
052:                if (handler == null) {
053:                    throw new IllegalArgumentException(
054:                            "HTTP service handler may not be null");
055:                }
056:                if (sslcontext == null) {
057:                    throw new IllegalArgumentException(
058:                            "SSL context may not be null");
059:                }
060:                if (params == null) {
061:                    throw new IllegalArgumentException(
062:                            "HTTP parameters may not be null");
063:                }
064:                this .handler = new LoggingNHttpServiceHandler(handler);
065:                this .params = params;
066:                this .sslcontext = sslcontext;
067:                this .sslHandler = sslHandler;
068:            }
069:
070:            public SSLServerIOEventDispatch(final NHttpServiceHandler handler,
071:                    final SSLContext sslcontext, final HttpParams params) {
072:                this (handler, sslcontext, null, params);
073:            }
074:
075:            public void connected(final IOSession session) {
076:
077:                SSLIOSession sslSession = new SSLIOSession(session,
078:                        this .sslcontext, this .sslHandler);
079:
080:                LoggingNHttpServerConnection conn = new LoggingNHttpServerConnection(
081:                        new LoggingIOSession(sslSession),
082:                        new DefaultHttpRequestFactory(),
083:                        new HeapByteBufferAllocator(), this .params);
084:
085:                session.setAttribute(NHTTP_CONN, conn);
086:                session.setAttribute(SSL_SESSION, sslSession);
087:
088:                this .handler.connected(conn);
089:
090:                try {
091:                    sslSession.bind(SSLMode.SERVER, this .params);
092:                } catch (SSLException ex) {
093:                    this .handler.exception(conn, ex);
094:                    sslSession.shutdown();
095:                }
096:            }
097:
098:            public void disconnected(final IOSession session) {
099:                DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session
100:                        .getAttribute(NHTTP_CONN);
101:                this .handler.closed(conn);
102:            }
103:
104:            public void inputReady(final IOSession session) {
105:                DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session
106:                        .getAttribute(NHTTP_CONN);
107:                SSLIOSession sslSession = (SSLIOSession) session
108:                        .getAttribute(SSL_SESSION);
109:                try {
110:                    synchronized (sslSession) {
111:                        if (sslSession.isAppInputReady()) {
112:                            conn.consumeInput(this .handler);
113:                        }
114:                        sslSession.inboundTransport();
115:                    }
116:                } catch (IOException ex) {
117:                    this .handler.exception(conn, ex);
118:                    sslSession.shutdown();
119:                }
120:            }
121:
122:            public void outputReady(final IOSession session) {
123:                DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session
124:                        .getAttribute(NHTTP_CONN);
125:                SSLIOSession sslSession = (SSLIOSession) session
126:                        .getAttribute(SSL_SESSION);
127:                try {
128:                    synchronized (sslSession) {
129:                        if (sslSession.isAppOutputReady()) {
130:                            conn.produceOutput(this .handler);
131:                        }
132:                        sslSession.outboundTransport();
133:                    }
134:                } catch (IOException ex) {
135:                    this .handler.exception(conn, ex);
136:                    sslSession.shutdown();
137:                }
138:            }
139:
140:            public void timeout(final IOSession session) {
141:                DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session
142:                        .getAttribute(NHTTP_CONN);
143:                SSLIOSession sslSession = (SSLIOSession) session
144:                        .getAttribute(SSL_SESSION);
145:                this .handler.timeout(conn);
146:                synchronized (sslSession) {
147:                    if (sslSession.isOutboundDone()
148:                            && !sslSession.isInboundDone()) {
149:                        // The session failed to terminate cleanly
150:                        sslSession.shutdown();
151:                    }
152:                }
153:            }
154:
155:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.