Source Code Cross Referenced for BaseMessageContext.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.core.MessageContext;
022:        import org.apache.commons.logging.Log;
023:        import org.apache.commons.logging.LogFactory;
024:
025:        import java.util.Collection;
026:        import java.util.Map;
027:        import java.util.Set;
028:
029:        /**
030:         * @author rott
031:         * 
032:         * BaseMessageContext is the base class for the two handler message contexts:
033:         * SoapMessageContext and LogicalMessageContext.  It delegates everything up to
034:         * the MEPContext, which itself delegates to the requestMC or responseMC, as
035:         * appropriate.
036:         * 
037:         */
038:        public class BaseMessageContext implements 
039:                javax.xml.ws.handler.MessageContext {
040:            private static final Log log = LogFactory
041:                    .getLog(BaseMessageContext.class);
042:
043:            protected MessageContext messageCtx;
044:
045:            /**
046:             * @param messageCtx
047:             */
048:            protected BaseMessageContext(MessageContext messageCtx) {
049:                this .messageCtx = messageCtx;
050:
051:                // Install an an AttachmentsAdapter between the 
052:                // jaxws attachment standard properties and the
053:                // MessageContext Attachments implementation.
054:                AttachmentsAdapter.install(messageCtx);
055:                TransportHeadersAdapter.install(messageCtx);
056:            }
057:
058:            /* (non-Javadoc)
059:             * @see java.util.Map#clear()
060:             */
061:            public void clear() {
062:                messageCtx.getMEPContext().clear();
063:            }
064:
065:            /* (non-Javadoc)
066:             * @see java.util.Map#containsKey(java.lang.Object)
067:             */
068:            public boolean containsKey(Object key) {
069:                return messageCtx.getMEPContext().containsKey(key);
070:            }
071:
072:            /* (non-Javadoc)
073:             * @see java.util.Map#containsValue(java.lang.Object)
074:             */
075:            public boolean containsValue(Object value) {
076:                return messageCtx.getMEPContext().containsValue(value);
077:            }
078:
079:            /* (non-Javadoc)
080:             * @see java.util.Map#entrySet()
081:             */
082:            public Set<java.util.Map.Entry<String, Object>> entrySet() {
083:                return messageCtx.getMEPContext().entrySet();
084:            }
085:
086:            /* (non-Javadoc)
087:             * @see java.util.Map#get(java.lang.Object)
088:             */
089:            public Object get(Object key) {
090:                // There are some properties that, in some cases, should not span the message exchange;
091:                // that is, they should come from only the current message context.  For others properties,
092:                // they should span the message exchange, meaning a property could be set on the request
093:                // and it will also be available on the response.  [JAXWS 2.0, Sec 9.4.1.1, pp. 110-113]
094:                Object returnValue = null;
095:                if (shouldPropertySpanMEP(key)) {
096:                    returnValue = messageCtx.getMEPContext().get(key);
097:                } else {
098:                    returnValue = messageCtx.getProperty((String) key);
099:                }
100:
101:                // For the HTTP_REQUEST_HEADERS and HTTP_RESPONSE_HEADERS, the CTS tests want a null returned 
102:                // if there are no headers.  Since we always put an instance of TransportHeadersAdapter,
103:                // which contains the headers, on the message context, return a null if it is empty.
104:                if (returnValue != null
105:                        && (returnValue instanceof  TransportHeadersAdapter)) {
106:                    TransportHeadersAdapter adapter = (TransportHeadersAdapter) returnValue;
107:                    if (adapter.isEmpty()) {
108:                        return null;
109:                    }
110:                }
111:                return returnValue;
112:            }
113:
114:            private boolean shouldPropertySpanMEP(Object key) {
115:                boolean shouldSpan = true;
116:                String keyString = (String) key;
117:
118:                // The CTS tests require that HTTP_REQUEST_HEADERS span the request and response contexts
119:                // on the service-provider, but do NOT span the request and response context on the 
120:                // service-requester.  So, for an INBOUND flow, do not allow HTTP_REQUEST_HEADERS to
121:                // span the request and response contexts.  The result is that the service-requester
122:                // inbound handler will not see the request headers while processing a response.
123:                Boolean outbound = (Boolean) messageCtx.getMEPContext().get(
124:                        MESSAGE_OUTBOUND_PROPERTY);
125:                if (outbound != null && !outbound)
126:                    if (javax.xml.ws.handler.MessageContext.HTTP_REQUEST_HEADERS
127:                            .equals(keyString)) {
128:                        shouldSpan = false;
129:                    }
130:                return shouldSpan;
131:            }
132:
133:            /* (non-Javadoc)
134:             * @see java.util.Map#isEmpty()
135:             */
136:            public boolean isEmpty() {
137:                return messageCtx.getMEPContext().isEmpty();
138:            }
139:
140:            /* (non-Javadoc)
141:             * @see java.util.Map#keySet()
142:             */
143:            public Set<String> keySet() {
144:                return messageCtx.getMEPContext().keySet();
145:            }
146:
147:            /* (non-Javadoc)
148:             * @see java.util.Map#put(java.lang.Object, java.lang.Object)
149:             */
150:            public Object put(String key, Object value) {
151:                return messageCtx.getMEPContext().put(key, value);
152:            }
153:
154:            /* (non-Javadoc)
155:             * @see java.util.Map#putAll(java.util.Map)
156:             */
157:            public void putAll(Map<? extends String, ? extends Object> t) {
158:                messageCtx.getMEPContext().putAll(t);
159:            }
160:
161:            /* (non-Javadoc)
162:             * @see java.util.Map#remove(java.lang.Object)
163:             */
164:            public Object remove(Object key) {
165:                return messageCtx.getMEPContext().remove(key);
166:            }
167:
168:            /* (non-Javadoc)
169:             * @see java.util.Map#size()
170:             */
171:            public int size() {
172:                return messageCtx.getMEPContext().size();
173:            }
174:
175:            /* (non-Javadoc)
176:             * @see java.util.Map#values()
177:             */
178:            public Collection<Object> values() {
179:                return messageCtx.getMEPContext().values();
180:            }
181:
182:            /* (non-Javadoc)
183:             * @see javax.xml.ws.handler.MessageContext#getScope(java.lang.String)
184:             */
185:            public Scope getScope(String s) {
186:                return messageCtx.getMEPContext().getScope(s);
187:            }
188:
189:            /* (non-Javadoc)
190:             * @see javax.xml.ws.handler.MessageContext#setScope(java.lang.String, javax.xml.ws.handler.MessageContext.Scope)
191:             */
192:            public void setScope(String s, Scope scope) {
193:                messageCtx.getMEPContext().setScope(s, scope);
194:            }
195:
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.