Source Code Cross Referenced for MustUnderstandUtils.java in  » Web-Services-AXIS2 » jax-ws » org » apache » axis2 » jaxws » dispatchers » 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.dispatchers 
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.dispatchers;
020:
021:        import org.apache.axiom.soap.SOAPEnvelope;
022:        import org.apache.axiom.soap.SOAPHeaderBlock;
023:        import org.apache.axis2.context.MessageContext;
024:        import org.apache.axis2.description.AxisDescription;
025:        import org.apache.axis2.description.AxisOperation;
026:        import org.apache.axis2.description.AxisService;
027:        import org.apache.axis2.description.Parameter;
028:        import org.apache.axis2.jaxws.description.EndpointDescription;
029:        import org.apache.axis2.jaxws.description.OperationDescription;
030:        import org.apache.commons.logging.Log;
031:        import org.apache.commons.logging.LogFactory;
032:
033:        import javax.xml.namespace.QName;
034:
035:        import java.util.ArrayList;
036:        import java.util.Iterator;
037:
038:        /**
039:         * Static utility methods used in processing mustUnderstand headers relative to JAXWS.
040:         */
041:        public class MustUnderstandUtils {
042:            private static final Log log = LogFactory
043:                    .getLog(MustUnderstandUtils.class);
044:
045:            /**
046:             * Mark all headers for JAXWS SEI method paramaters as understood.  Note that per the JAXWS
047:             * 2.0 specification, a header is considered understood if it used by as a parameter for 
048:             * any method on the SEI, not just the method corresponding to the incoming operation.  
049:             * See Section 10.2.1 item 3.a which specifically says "mapped to method parameters
050:             * in the service endpoint interface".
051:             * 
052:             * @param msgContext
053:             */
054:            public static void markUnderstoodHeaderParameters(
055:                    MessageContext msgContext) {
056:                if (msgContext == null) {
057:                    return;
058:                }
059:
060:                SOAPEnvelope envelope = msgContext.getEnvelope();
061:                if (envelope.getHeader() == null) {
062:                    return;
063:                }
064:
065:                ArrayList understoodHeaderQNames = MustUnderstandUtils
066:                        .getHeaderParamaterList(msgContext);
067:                if (understoodHeaderQNames == null) {
068:                    return;
069:                }
070:
071:                // Passing in null will get headers targeted for NEXT and ULTIMATE RECEIVER
072:                Iterator headerBlocks = envelope.getHeader()
073:                        .getHeadersToProcess(null);
074:                while (headerBlocks.hasNext()) {
075:                    SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) headerBlocks
076:                            .next();
077:                    QName headerQN = headerBlock.getQName();
078:                    if (understoodHeaderQNames.contains(headerQN)) {
079:                        headerBlock.setProcessed();
080:                        if (log.isDebugEnabled()) {
081:                            log
082:                                    .debug("Header marked as processed by JAXWS MustUnderstandChecker: "
083:                                            + headerQN);
084:                        }
085:                    }
086:                }
087:            }
088:
089:            /**
090:             * Return an ArrayList of QNames corresponding to SOAP headers which map to method parameters
091:             * for any methods on the corresponding SEI and the SOAP handlers.
092:             * 
093:             * @param msgContext
094:             * @return ArrayList of QNames for all header parameters for an SEI and SOAP handlers.  
095:             *         The list may be empty but will not be null.
096:             */
097:            public static ArrayList getHeaderParamaterList(
098:                    MessageContext msgContext) {
099:                ArrayList returnList = new ArrayList();
100:                // Build a list of understood headers for all the operations under the service
101:                AxisService axisService = msgContext.getAxisService();
102:                if (log.isDebugEnabled()) {
103:                    log
104:                            .debug("Building list of understood headers for all operations under "
105:                                    + axisService);
106:                }
107:                if (axisService != null) {
108:                    ArrayList understoodHeaders;
109:
110:                    // examine SEI methods
111:                    Iterator operationIterator = axisService.getOperations();
112:                    if (operationIterator != null) {
113:                        while (operationIterator.hasNext()) {
114:                            AxisOperation operation = (AxisOperation) operationIterator
115:                                    .next();
116:                            understoodHeaders = getSEIMethodHeaderParameterList(operation);
117:                            if (log.isDebugEnabled()) {
118:                                log.debug("Adding headers from operation "
119:                                        + operation + "; headers = "
120:                                        + understoodHeaders);
121:                            }
122:                            if (understoodHeaders != null
123:                                    && !understoodHeaders.isEmpty()) {
124:                                returnList.addAll(understoodHeaders);
125:                            }
126:                        }
127:                    }
128:
129:                    // examine handlers
130:                    understoodHeaders = getHandlersHeaderParameterList(axisService);
131:                    if (log.isDebugEnabled()) {
132:                        log
133:                                .debug("Adding headers from SOAP handlers; headers = "
134:                                        + understoodHeaders);
135:                    }
136:                    if (understoodHeaders != null
137:                            && !understoodHeaders.isEmpty()) {
138:                        returnList.addAll(understoodHeaders);
139:                    }
140:                }
141:                return returnList;
142:            }
143:
144:            /**
145:             * Return an ArrayList of QNames corresponding to SOAP headers which map to method parameters
146:             * for a specific operation.
147:             * 
148:             * @param axisOperation
149:             * @return ArrayList of header QNames for all header paramters on an operation, or null if none.
150:             */
151:            public static ArrayList getSEIMethodHeaderParameterList(
152:                    AxisOperation axisOperation) {
153:                return getHeaderParameterList(axisOperation,
154:                        OperationDescription.HEADER_PARAMETER_QNAMES);
155:            }
156:
157:            /**
158:             * Return an ArrayList of QNames that is a collection of SOAP handlers 
159:             * 
160:             * @param axisService
161:             * @return ArrayList of header QNames.     
162:             */
163:            public static ArrayList getHandlersHeaderParameterList(
164:                    AxisService axisService) {
165:                return getHeaderParameterList(axisService,
166:                        EndpointDescription.HANDLER_PARAMETER_QNAMES);
167:            }
168:
169:            private static ArrayList getHeaderParameterList(
170:                    AxisDescription axisDescription, String paramName) {
171:                Parameter headerQNamesParameter = axisDescription
172:                        .getParameter(paramName);
173:                if (headerQNamesParameter == null) {
174:                    if (log.isDebugEnabled()) {
175:                        log.debug("Parameter not on " + axisDescription + "; "
176:                                + paramName);
177:                    }
178:                    return null;
179:                }
180:
181:                ArrayList understoodHeaderQNames = (ArrayList) headerQNamesParameter
182:                        .getValue();
183:                if (understoodHeaderQNames == null
184:                        || understoodHeaderQNames.isEmpty()) {
185:                    if (log.isDebugEnabled()) {
186:                        log.debug("Parameter value is empty: "
187:                                + axisDescription + "; " + paramName);
188:                    }
189:                    return null;
190:                }
191:
192:                return understoodHeaderQNames;
193:            }
194:
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.