Source Code Cross Referenced for HandlerInvokerUtils.java in  » Web-Services-AXIS2 » jax-ws » org » apache » axis2 » jaxws » handler » 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 » jax ws » org.apache.axis2.jaxws.handler 
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.jaxws.handler;
020:
021:        import org.apache.axis2.jaxws.message.Protocol;
022:
023:        import javax.xml.ws.handler.Handler;
024:
025:        import java.util.List;
026:
027:        public class HandlerInvokerUtils {
028:
029:            /**
030:             * Invoke Inbound Handlers
031:             * @param requestMsgCtx
032:             */
033:            public static boolean invokeInboundHandlers(
034:                    MEPContext mepMessageCtx, List<Handler> handlers,
035:                    HandlerChainProcessor.MEP mep, boolean isOneWay) {
036:
037:                String bindingProto = null;
038:                if (mep.equals(HandlerChainProcessor.MEP.REQUEST)) // inbound request; must be on the server
039:                    bindingProto = mepMessageCtx.getEndpointDesc()
040:                            .getBindingType();
041:                else
042:                    // inbound response; must be on the client
043:                    bindingProto = mepMessageCtx.getEndpointDesc()
044:                            .getClientBindingID();
045:                Protocol proto = Protocol.getProtocolForBinding(bindingProto);
046:
047:                HandlerChainProcessor processor = new HandlerChainProcessor(
048:                        handlers, proto);
049:                // if not one-way, expect a response
050:                boolean success = true;
051:                try {
052:                    if (mepMessageCtx.getMessageObject().isFault()) {
053:                        processor.processFault(mepMessageCtx,
054:                                HandlerChainProcessor.Direction.IN);
055:                    } else {
056:                        success = processor.processChain(mepMessageCtx,
057:                                HandlerChainProcessor.Direction.IN, mep,
058:                                !isOneWay);
059:                    }
060:                } catch (RuntimeException re) {
061:                    /*
062:                     * handler framework should only throw an exception here if
063:                     * we are in the client inbound case.  Make sure the message
064:                     * context and message are transformed.
065:                     */
066:                    HandlerChainProcessor.convertToFaultMessage(mepMessageCtx,
067:                            re, proto);
068:                    // done invoking inbound handlers, be sure to set the access lock flag on the context to true
069:                    mepMessageCtx.setApplicationAccessLocked(true);
070:                    return false;
071:                }
072:
073:                if (!success && mep.equals(HandlerChainProcessor.MEP.REQUEST)) {
074:                    // uh-oh.  We've changed directions on the server inbound handler processing,
075:                    // This means we're now on an outbound flow, and the endpoint will not
076:                    // be called.  Be sure to mark the context and message as such.
077:
078:                    // done invoking inbound handlers, be sure to set the access lock flag on the context to true
079:                    mepMessageCtx.setApplicationAccessLocked(true);
080:                    return false;
081:                }
082:                // done invoking inbound handlers, be sure to set the access lock flag on the context to true
083:                mepMessageCtx.setApplicationAccessLocked(true);
084:                return true;
085:
086:            }
087:
088:            /**
089:             * Invoke OutboundHandlers
090:             * 
091:             * @param msgCtx
092:             */
093:            public static boolean invokeOutboundHandlers(
094:                    MEPContext mepMessageCtx, List<Handler> handlers,
095:                    HandlerChainProcessor.MEP mep, boolean isOneWay) {
096:
097:                if (handlers == null)
098:                    return true;
099:
100:                String bindingProto = null;
101:                if (mep.equals(HandlerChainProcessor.MEP.REQUEST)) // outbound request; must be on the client
102:                    bindingProto = mepMessageCtx.getEndpointDesc()
103:                            .getClientBindingID();
104:                else
105:                    // outbound response; must be on the server
106:                    bindingProto = mepMessageCtx.getEndpointDesc()
107:                            .getBindingType();
108:                Protocol proto = Protocol.getProtocolForBinding(bindingProto);
109:
110:                HandlerChainProcessor processor = new HandlerChainProcessor(
111:                        handlers, proto);
112:                // if not one-way, expect a response
113:                boolean success = true;
114:                try {
115:                    if (mepMessageCtx.getMessageObject().isFault()) {
116:                        processor.processFault(mepMessageCtx,
117:                                HandlerChainProcessor.Direction.OUT);
118:                    } else {
119:                        success = processor.processChain(mepMessageCtx,
120:                                HandlerChainProcessor.Direction.OUT, mep,
121:                                !isOneWay);
122:                    }
123:                } catch (RuntimeException re) {
124:                    /*
125:                     * handler framework should only throw an exception here if
126:                     * we are in the server outbound case.  Make sure the message
127:                     * context and message are transformed.
128:                     */
129:                    HandlerChainProcessor.convertToFaultMessage(mepMessageCtx,
130:                            re, proto);
131:                    return false;
132:                }
133:
134:                if (!success && mep.equals(HandlerChainProcessor.MEP.REQUEST)) {
135:                    // uh-oh.  We've changed directions on the client outbound handler processing,
136:                    // This means we're now on an inbound flow, and the service will not
137:                    // be called.  Be sure to mark the context and message as such.
138:                    return false;
139:                }
140:                return true;
141:
142:            }
143:
144:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.