cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r691301 - in /cxf/branches/2.1.x-fixes: ./ bin/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/ rt/frontend/ja...
Date Tue, 02 Sep 2008 16:22:28 GMT
Author: dkulp
Date: Tue Sep  2 09:22:27 2008
New Revision: 691301

URL: http://svn.apache.org/viewvc?rev=691301&view=rev
Log:
Merged revisions 689572 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r689572 | dkulp | 2008-08-27 15:15:32 -0400 (Wed, 27 Aug 2008) | 2 lines
  
  Performance improvement by not mapping the jaxws properties back and forth all the time.  Wrapper the message directly and map on get/put.
........

Removed:
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/bin/DoMerges.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/BindingProviderImpl.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerInInterceptor.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageContextImpl.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/DispatchSOAPHandlerInterceptor.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep  2 09:22:27 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689855
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689855

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Sep  2 09:22:27 2008
@@ -1 +1 @@
-/cxf/trunk:1-686342,686344-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689855,690638
+/cxf/trunk:1-686342,686344-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689855,690638

Modified: cxf/branches/2.1.x-fixes/bin/DoMerges.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/bin/DoMerges.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/bin/DoMerges.java (original)
+++ cxf/branches/2.1.x-fixes/bin/DoMerges.java Tue Sep  2 09:22:27 2008
@@ -58,7 +58,11 @@
         if (c == 'N') {
             return;
         }
-        Process p = Runtime.getRuntime().exec(new String[] {"svn", "commit", "-F", "svnmerge-commit-message.txt"});
+        Process p = Runtime.getRuntime().exec(new String[] {"svn", "resolved", "."});
+        if (p.waitFor() != 0) {
+            Thread.sleep(10);
+        }
+        p = Runtime.getRuntime().exec(new String[] {"svn", "commit", "-F", "svnmerge-commit-message.txt"});
         BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
         String line = reader.readLine();
         while (line != null) {

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/BindingProviderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/BindingProviderImpl.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/BindingProviderImpl.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/BindingProviderImpl.java Tue Sep  2 09:22:27 2008
@@ -27,7 +27,9 @@
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.EndpointReference;
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
 
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
 
 public class BindingProviderImpl implements BindingProvider {
@@ -62,7 +64,9 @@
 
     public Map<String, Object> getResponseContext() {
         if (null == responseContext.get()) {
-            responseContext.set(new HashMap<String, Object>());
+            responseContext.set(new WrappedMessageContext(new HashMap<String, Object>(),
+                                                          null,
+                                                          Scope.APPLICATION));
         }
         return responseContext.get();
     }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Tue Sep  2 09:22:27 2008
@@ -48,6 +48,7 @@
 import javax.xml.ws.Response;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext.Scope;
 import javax.xml.ws.http.HTTPBinding;
 import javax.xml.ws.http.HTTPException;
 import javax.xml.ws.soap.SOAPBinding;
@@ -66,11 +67,11 @@
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.interceptor.InterceptorProvider;
 import org.apache.cxf.interceptor.MessageSenderInterceptor;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.jaxws.handler.logical.DispatchLogicalHandlerInterceptor;
 import org.apache.cxf.jaxws.handler.soap.DispatchSOAPHandlerInterceptor;
 import org.apache.cxf.jaxws.interceptors.DispatchInDatabindingInterceptor;
 import org.apache.cxf.jaxws.interceptors.DispatchOutDatabindingInterceptor;
-import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
@@ -140,14 +141,17 @@
             }
             
             
-            Map<String, Object> reqContext = new HashMap<String, Object>(this.getRequestContext());
+            Map<String, Object> reqContext = new HashMap<String, Object>();
+            WrappedMessageContext ctx = new WrappedMessageContext(reqContext,
+                                                                  null,
+                                                                  Scope.APPLICATION);
+            ctx.putAll(this.getRequestContext());
             Map<String, Object> respContext = this.getResponseContext();
             // clear the response context's hold information
             // Not call the clear Context is to avoid the error 
             // that getResponseContext() would be called by Client code first
             respContext.clear();
             
-            ContextPropertiesMapping.mapRequestfromJaxws2Cxf(reqContext);
             message.putAll(reqContext);
             //need to do context mapping from jax-ws to cxf message
             
@@ -220,8 +224,6 @@
                     Message inMsg = waitResponse(exchange);
                     respContext.putAll(inMsg);
                     getConduitSelector().complete(exchange);
-                    //need to do context mapping from cxf message to jax-ws 
-                    ContextPropertiesMapping.mapResponsefromCxf2Jaxws(respContext);
                     return cl.cast(inMsg.getContent(Object.class));
                 }
             }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java Tue Sep  2 09:22:27 2008
@@ -20,21 +20,30 @@
 package org.apache.cxf.jaxws;
 
 import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import javax.activation.DataHandler;
 import javax.xml.ws.handler.MessageContext;
 import javax.xml.ws.handler.MessageContext.Scope;
 import javax.xml.ws.soap.SOAPFaultException;
 
+import org.apache.cxf.attachment.AttachmentImpl;
 import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.headers.Header;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.jaxws.context.WebServiceContextImpl;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
-import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
+import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.service.invoker.Factory;
 import org.apache.cxf.service.invoker.FactoryInvoker;
 import org.apache.cxf.service.invoker.SingletonFactory;
@@ -75,8 +84,7 @@
     
     protected Object invoke(Exchange exchange, final Object serviceObject, Method m, List<Object> params) {
         // set up the webservice request context 
-        MessageContext ctx = 
-            ContextPropertiesMapping.createWebServiceContext(exchange);
+        WrappedMessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);
         
         Map<String, Scope> scopes = CastUtils.cast((Map<?, ?>)ctx.get(WrappedMessageContext.SCOPES));
         Map<String, Object> handlerScopedStuff = new HashMap<String, Object>();
@@ -97,14 +105,70 @@
         List<Object> res = CastUtils.cast((List)super.invoke(exchange, serviceObject, m, params));
         
         for (Map.Entry<String, Object> key : handlerScopedStuff.entrySet()) {
-            ctx.put(key.getKey(), key.getValue());
-            ctx.setScope(key.getKey(), Scope.HANDLER);
+            ctx.put(key.getKey(), key.getValue(), Scope.HANDLER);
         }
                 
         //update the webservice response context
-        ContextPropertiesMapping.updateWebServiceContext(exchange, ctx);
+        updateWebServiceContext(exchange, ctx);
         //clear the WebServiceContextImpl's ThreadLocal variable
         WebServiceContextImpl.clear();
         return res;
     }
+    
+    
+    private Message createResponseMessage(Exchange exchange) {
+        if (exchange == null) {
+            return null;
+        }
+        Message m = exchange.getOutMessage();
+        if (m == null && !exchange.isOneWay()) {
+            Endpoint ep = exchange.get(Endpoint.class);
+            m = ep.getBinding().createMessage();
+            exchange.setOutMessage(m);
+        }
+        return m;
+    }
+
+    private void updateWebServiceContext(Exchange exchange, MessageContext ctx) {
+        // Guard against wrong type associated with header list.
+        // Need to copy header only if the message is going out.
+        if (ctx.containsKey(Header.HEADER_LIST) 
+                && ctx.get(Header.HEADER_LIST) instanceof List<?>) {
+            List list = (List) ctx.get(Header.HEADER_LIST);
+            if (list != null && !list.isEmpty()) {
+                SoapMessage sm = (SoapMessage) createResponseMessage(exchange);
+                Iterator iter = list.iterator();
+                while (iter.hasNext()) {
+                    sm.getHeaders().add((Header) iter.next());
+                }
+            }
+        }
+        if (exchange.getOutMessage() != null) {
+            Message out = exchange.getOutMessage();
+            if (out.containsKey(Message.PROTOCOL_HEADERS)) {
+                Map<String, List<String>> heads = CastUtils
+                    .cast((Map<?, ?>)exchange.getOutMessage().get(Message.PROTOCOL_HEADERS));
+                if (heads.containsKey("Content-Type")) {
+                    List<String> ct = heads.get("Content-Type");
+                    exchange.getOutMessage().put(Message.CONTENT_TYPE, ct.get(0));
+                    heads.remove("Content-Type");
+                }
+            }
+            Map<String, DataHandler> dataHandlers  
+                = CastUtils.cast((Map<?, ?>)out.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
+            if (dataHandlers != null && !dataHandlers.isEmpty()) {
+                Collection<Attachment> attachments = out.getAttachments();
+                if (attachments == null) {
+                    attachments = new ArrayList<Attachment>();
+                    out.setAttachments(attachments);
+                }
+                for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet()) {
+                    Attachment att = new AttachmentImpl(entry.getKey(), entry.getValue());
+                    attachments.add(att);
+                }
+            }
+            out.remove(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+        }
+    }
+
 }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java Tue Sep  2 09:22:27 2008
@@ -55,7 +55,6 @@
 import org.apache.cxf.frontend.MethodDispatcher;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
-import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
 import org.apache.cxf.service.model.BindingOperationInfo;
 
@@ -160,9 +159,6 @@
         
         Map<String, Object> context = new HashMap<String, Object>();
 
-        // need to do context mapping from jax-ws to cxf message
-        ContextPropertiesMapping.mapRequestfromJaxws2Cxf(reqContext);
-
         context.put(Client.REQUEST_CONTEXT, reqContext);
         context.put(Client.RESPONSE_CONTEXT, respContext);
        
@@ -208,8 +204,6 @@
             }
         }
         
-        // need to do context mapping from cxf message to jax-ws
-        ContextPropertiesMapping.mapResponsefromCxf2Jaxws(respContext);
         Map<String, Scope> scopes = CastUtils.cast((Map<?, ?>)respContext.get(WrappedMessageContext.SCOPES));
         if (scopes != null) {
             for (Map.Entry<String, Scope> scope : scopes.entrySet()) {
@@ -314,6 +308,7 @@
     private Map<String, Object> getRequestContextCopy() {
         Map<String, Object> realMap = new HashMap<String, Object>();
         WrappedMessageContext ctx = new WrappedMessageContext(realMap,
+                                                              null,
                                                               Scope.APPLICATION);
         // thread local contexts reflect currentRequestContext as of 
         // last call to getRequestContext()
@@ -338,7 +333,9 @@
 
     public Map<String, Object> getResponseContext() {
         if (null == responseContext.get()) {
-            responseContext.set(new HashMap<String, Object>());
+            responseContext.set(new WrappedMessageContext(new HashMap<String, Object>(),
+                                                          null,
+                                                          Scope.APPLICATION));
         }        
         return responseContext.get();
     }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java Tue Sep  2 09:22:27 2008
@@ -20,124 +20,354 @@
 package org.apache.cxf.jaxws.context;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
 
+import javax.activation.DataHandler;
+import javax.xml.ws.BindingProvider;
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
 
+import org.apache.cxf.attachment.LazyAttachmentCollection;
+import org.apache.cxf.binding.soap.SoapBindingConstants;
+import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 
 public class WrappedMessageContext implements MessageContext {
     public static final String SCOPES = WrappedMessageContext.class.getName() + ".SCOPES";
     
-    private final Map<String, Object> contextMap;
-    private final Message message;
+    private static Map<String, String> cxf2jaxwsMap = new HashMap<String, String>();
+    private static Map<String, String> jaxws2cxfMap = new HashMap<String, String>();
+    
+    static {
+        cxf2jaxwsMap.put(Message.ENDPOINT_ADDRESS, 
+                          BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+        cxf2jaxwsMap.put(Message.MAINTAIN_SESSION,
+                         BindingProvider.SESSION_MAINTAIN_PROPERTY);
+        
+        cxf2jaxwsMap.put(Message.HTTP_REQUEST_METHOD,
+                          MessageContext.HTTP_REQUEST_METHOD);
+        cxf2jaxwsMap.put(Message.RESPONSE_CODE, 
+                          MessageContext.HTTP_RESPONSE_CODE);        
+        cxf2jaxwsMap.put(Message.PATH_INFO, 
+                          MessageContext.PATH_INFO);
+        cxf2jaxwsMap.put(Message.QUERY_STRING, 
+                          MessageContext.QUERY_STRING);
+        cxf2jaxwsMap.put("HTTP.REQUEST", 
+                         MessageContext.SERVLET_REQUEST);
+        cxf2jaxwsMap.put("HTTP.RESPONSE", 
+                         MessageContext.SERVLET_RESPONSE);
+        cxf2jaxwsMap.put("HTTP.CONTEXT", 
+                         MessageContext.SERVLET_CONTEXT);
+       
+        jaxws2cxfMap.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
+                         Message.ENDPOINT_ADDRESS);
+        jaxws2cxfMap.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, 
+                         Message.MAINTAIN_SESSION);
+                
+        jaxws2cxfMap.put(MessageContext.HTTP_REQUEST_METHOD,
+                         Message.HTTP_REQUEST_METHOD);
+        jaxws2cxfMap.put(MessageContext.HTTP_RESPONSE_CODE,
+                         Message.RESPONSE_CODE);        
+        jaxws2cxfMap.put(MessageContext.PATH_INFO,
+                         Message.PATH_INFO);
+        jaxws2cxfMap.put(MessageContext.QUERY_STRING,
+                         Message.QUERY_STRING);
+        
+        jaxws2cxfMap.put(MessageContext.SERVLET_REQUEST, 
+                         "HTTP.REQUEST"); 
+        jaxws2cxfMap.put(MessageContext.SERVLET_RESPONSE, 
+                         "HTTP.RESPONSE");
+        jaxws2cxfMap.put(MessageContext.SERVLET_CONTEXT, 
+                        "HTTP.CONTEXT");
+        
+        jaxws2cxfMap.put(BindingProvider.SOAPACTION_URI_PROPERTY, SoapBindingConstants.SOAP_ACTION);
+    }
+
+    private final Map<String, Object> message;
+    private final Map<String, Object> reqMessage;
+    private final Exchange exchange;
     private Map<String, Scope> scopes;
     private Scope defaultScope;
 
     public WrappedMessageContext(Message m) {
-        this(m, m, Scope.HANDLER);
+        this(m, Scope.HANDLER);
     }
     public WrappedMessageContext(Message m, Scope defScope) {
-        this(m, m, defScope);
-    }
-    
-    public WrappedMessageContext(Map<String, Object> m, Scope defScope) {
-        this(null, m, defScope);
-    }
-    
-    public WrappedMessageContext(Message m, Map<String, Object> map, Scope defScope) {
+        this(m, m.getExchange(), defScope);
+    }    
+    public WrappedMessageContext(Map<String, Object> m, Exchange ex, Scope defScope) {
         message = m;
-        contextMap = map;
+        exchange = ex;
         defaultScope = defScope;
-        scopes = CastUtils.cast((Map<?, ?>)contextMap.get(SCOPES));
-        if (scopes == null && message != null && message.getExchange() != null) { 
-            if (isRequestor() && !isOutbound() && m.getExchange().getOutMessage() != null) {
-                scopes = CastUtils.cast((Map<?, ?>)m.getExchange().getOutMessage().get(SCOPES));
-                copyScopedProperties(m.getExchange().getOutMessage());
-                m.put(SCOPES, scopes);
-            } else if (!isRequestor() && isOutbound() && m.getExchange().getInMessage() != null) {
-                scopes = CastUtils.cast((Map<?, ?>)m.getExchange().getInMessage().get(SCOPES));
-                copyScopedProperties(m.getExchange().getInMessage());
-                m.put(SCOPES, scopes);
+        scopes = CastUtils.cast((Map<?, ?>)message.get(SCOPES));
+        
+        if (isResponse() && exchange != null) {
+            if (isRequestor()) {
+                reqMessage = exchange.getOutMessage();
+            } else {
+                reqMessage = exchange.getInMessage();
             }
+        } else {
+            reqMessage = null;
+        }
+        
+        if (scopes == null && reqMessage != null) {
+            scopes = CastUtils.cast((Map<?, ?>)reqMessage.get(SCOPES));
+            m.put(SCOPES, scopes);
+            copyScoped(message);
         }
         if (scopes == null) {
             scopes = new HashMap<String, Scope>();
-            contextMap.put(SCOPES, scopes);
+            message.put(SCOPES, scopes);
+        }
+    }
+    private void copyScoped(Map<String, Object> msg) {
+        for (String s : scopes.keySet()) {
+            message.put(s, msg.get(s));
         }
     }
     
-    protected final void copyScopedProperties(Message m) {
-        for (String k : scopes.keySet()) {
-            if (!contextMap.containsKey(k)
-                && !MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(k)) {
-                contextMap.put(k, m.get(k));
-            }
+    private String mapKey(String key) {
+        String k2 = jaxws2cxfMap.get(key);
+        if (k2 != null) {
+            return k2;
         }
+        return key;
+    }
+    private String mapKeyReverse(String key) {
+        String k2 = cxf2jaxwsMap.get(key);
+        if (k2 != null) {
+            return k2;
+        }
+        if (Message.PROTOCOL_HEADERS.equals(key)) {
+            return isResponse() ? MessageContext.HTTP_RESPONSE_HEADERS : MessageContext.HTTP_REQUEST_HEADERS;
+        }
+        return key;
+    }
+    
+    
+    protected final boolean isResponse() {
+        return isOutbound() ^ isRequestor();
     }
     protected final boolean isRequestor() {
-        return Boolean.TRUE.equals(contextMap.containsKey(Message.REQUESTOR_ROLE));
+        return Boolean.TRUE.equals(message.containsKey(Message.REQUESTOR_ROLE));
     }
     protected final boolean isOutbound() {
-        Exchange ex = message.getExchange();
         return message != null 
-            && (message == ex.getOutMessage()
-                || message == ex.getOutFaultMessage());
+            && exchange != null
+            && (message == exchange.getOutMessage()
+                || message == exchange.getOutFaultMessage());
     }
     
     public final Message getWrappedMessage() {
-        return message;
+        return message instanceof Message ? (Message)message : null;
     }
     
     public void clear() {
-        contextMap.clear();      
+        //just clear the JAXWS things....
+        for (String key : jaxws2cxfMap.keySet()) {
+            remove(key);
+        }
     }
 
     public final boolean containsKey(Object key) {
-        return contextMap.containsKey(key);
+        return message.containsKey(mapKey((String)key));
     }
 
     public final boolean containsValue(Object value) {
-        return contextMap.containsValue(value);
+        return message.containsValue(value);
     }
 
-    public final Set<Entry<String, Object>> entrySet() {
-        return contextMap.entrySet();
+    public Object get(Object key) {
+        String mappedkey = mapKey((String)key);
+        Object ret = message.get(mappedkey);
+        if (ret == null) {
+            if (Message.class.getName().equals(mappedkey)) {
+                return message;
+            }
+            if (exchange != null) {
+                ret = exchange.get(mappedkey);
+                if (ret != null) {
+                    return ret;
+                }
+            }
+            if (MessageContext.INBOUND_MESSAGE_ATTACHMENTS.equals(key)) {
+                if (isOutbound()) {
+                    ret = reqMessage.get(key);
+                }
+                ret = createAttachments(getWrappedMessage(), MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
+            } else if (MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS.equals(key)) {
+                ret = createAttachments(createResponseMessage(), MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+            } else if (MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(key)) {
+                ret = isOutbound();
+            } else if (MessageContext.HTTP_REQUEST_HEADERS.equals(key)) {
+                if (!isResponse()) {
+                    ret = message.get(Message.PROTOCOL_HEADERS);
+                } else if (reqMessage != null && !isRequestor()) {
+                    ret = reqMessage.get(Message.PROTOCOL_HEADERS);
+                }
+            } else if (MessageContext.HTTP_RESPONSE_HEADERS.equals(key)) {
+                Map mp = null;
+                if (isResponse()) {
+                    mp = (Map)message.get(Message.PROTOCOL_HEADERS);
+                } else if (exchange != null) {
+                    //may have to create the out message and add the headers
+                    Message tmp = createResponseMessage();
+                    if (tmp != null) {
+                        ret = (Map)tmp.get(Message.PROTOCOL_HEADERS);
+                    }
+                }
+                ret = mp;
+            } else if (BindingProvider.USERNAME_PROPERTY.equals(key)) {
+                AuthorizationPolicy authPolicy =
+                    (AuthorizationPolicy)message.get(AuthorizationPolicy.class.getName());
+                if (authPolicy != null) {
+                    ret = authPolicy.getUserName();
+                }
+            } else if (BindingProvider.PASSWORD_PROPERTY.equals(key)) {
+                AuthorizationPolicy authPolicy =
+                    (AuthorizationPolicy)message.get(AuthorizationPolicy.class.getName());
+                if (authPolicy != null) {
+                    ret = authPolicy.getPassword();
+                }
+            }
+            
+            if (ret == null && reqMessage != null) { 
+                ret = reqMessage.get(mappedkey);
+            }
+        }
+        return ret;
     }
 
-    public final Object get(Object key) {
-        Object ret = contextMap.get(key);
-        if (ret == null
-            && Message.class.getName().equals(key)) {
-            return message;
+    private Message createResponseMessage() {
+        if (exchange == null || isRequestor()) {
+            return null;
         }
-        return ret;
+        Message m = exchange.getOutMessage();
+        if (m == null && !exchange.isOneWay()) {
+            Endpoint ep = exchange.get(Endpoint.class);
+            m = ep.getBinding().createMessage();
+            exchange.setOutMessage(m);
+        }
+        return m;
     }
+    private Object createAttachments(Message mc, String propertyName) {
 
+        Collection<Attachment> attachments = mc.getAttachments();
+        Map<String, DataHandler> dataHandlers = getDHMap(attachments);
+        mc.put(propertyName, 
+               dataHandlers);
+        scopes.put(propertyName, Scope.APPLICATION);
+        return dataHandlers;
+    }    
+    private static Map<String, DataHandler> getDHMap(Collection<Attachment> attachments) {
+        Map<String, DataHandler> dataHandlers = null;
+        if (attachments != null) {
+            if (attachments instanceof LazyAttachmentCollection) {
+                dataHandlers = ((LazyAttachmentCollection)attachments).createDataHandlerMap();
+            } else {
+                //preserve the order of iteration
+                dataHandlers = new LinkedHashMap<String, DataHandler>();
+                for (Attachment attachment : attachments) {
+                    dataHandlers.put(attachment.getId(), attachment.getDataHandler());
+                }
+            }
+        }
+        return dataHandlers == null ? new LinkedHashMap<String, DataHandler>() : dataHandlers;
+    }    
     public final boolean isEmpty() {
-        return contextMap.isEmpty();
+        return message.isEmpty();
     }
 
+    // map to jaxws
     public final Set<String> keySet() {
-        return contextMap.keySet();
+        Set<String> set = new HashSet<String>();
+        for (String s : message.keySet()) {
+            set.add(s);
+            set.add(mapKeyReverse(s));
+        }
+        return Collections.unmodifiableSet(set);
     }
+    public final Set<Entry<String, Object>> entrySet() {
+        Set<Entry<String, Object>> set = new HashSet<Entry<String, Object>>();
+        for (Map.Entry<String, Object> s : message.entrySet()) {
+            set.add(s);
+            
+            final String s2 = mapKeyReverse(s.getKey());
+            final Object o = s.getValue();
+            if (s2.equals(s.getKey())) {
+                Map.Entry<String, Object> entry = new Map.Entry<String, Object>() {
+                    public String getKey() {
+                        return s2;
+                    }
+                    public Object getValue() {
+                        return o;
+                    }
+                    public Object setValue(Object value) {
+                        throw new UnsupportedOperationException();
+                    }
+                };
+                set.add(entry);
+            }
+        }
+        return Collections.unmodifiableSet(set);
+    }
+
 
     public final Object put(String key, Object value) {
-        if (!MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(key)
-            && !scopes.containsKey(key)) {
-            scopes.put(key, defaultScope);
-        }
-        return contextMap.put(key, value);
+        return put(key, value, defaultScope);
     }
     public final Object put(String key, Object value, Scope scope) {
-        if (!MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(key)) {
-            scopes.put(key, scope);
+        String mappedKey = mapKey(key);
+        if (!MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(mappedKey)) {
+            scopes.put(mappedKey, scope);
+        }
+        if ((MessageContext.HTTP_RESPONSE_HEADERS.equals(key)
+            || MessageContext.HTTP_RESPONSE_CODE.equals(key)
+            || MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS.equals(key)
+            || MessageContext.HTTP_RESPONSE_CODE.equals(key))
+            && !isResponse() && !isRequestor()) { 
+            Message tmp = createResponseMessage();
+            if (tmp != null) {
+                if (MessageContext.HTTP_RESPONSE_HEADERS.equals(key)) {
+                    return tmp.put(Message.PROTOCOL_HEADERS, value);
+                } else {
+                    return tmp.put(mappedKey, value);
+                }
+            }
+            return null;
+        } else if (BindingProvider.USERNAME_PROPERTY.equals(key)) {
+            AuthorizationPolicy authPolicy =
+                (AuthorizationPolicy)message.get(AuthorizationPolicy.class.getName());
+            if (authPolicy == null) {
+                authPolicy = new AuthorizationPolicy();
+                message.put(AuthorizationPolicy.class.getName(), authPolicy);
+            }
+            String ret = authPolicy.getUserName();
+            authPolicy.setUserName((String)value);
+            return ret;
+        } else if (BindingProvider.PASSWORD_PROPERTY.equals(key)) {
+            AuthorizationPolicy authPolicy =
+                (AuthorizationPolicy)message.get(AuthorizationPolicy.class.getName());
+            if (authPolicy == null) {
+                authPolicy = new AuthorizationPolicy();
+                message.put(AuthorizationPolicy.class.getName(), authPolicy);
+            }
+            String ret = authPolicy.getPassword();
+            authPolicy.setPassword((String)value);
+            return ret;
+        } else {
+            return message.put(mappedKey, value);
         }
-        return contextMap.put(key, value);
     }
 
     public final void putAll(Map<? extends String, ? extends Object> t) {
@@ -147,16 +377,17 @@
     }
 
     public final Object remove(Object key) {
+        key = mapKey((String)key);
         scopes.remove(key);
-        return contextMap.remove(key);
+        return message.remove(key);
     }
 
     public final int size() {
-        return contextMap.size();
+        return message.size();
     }
 
     public final Collection<Object> values() {
-        return contextMap.values();
+        return message.values();
     }
 
     public final void setScope(String key, Scope arg1) {

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java Tue Sep  2 09:22:27 2008
@@ -120,24 +120,18 @@
     }
 
     public boolean invokeLogicalHandlers(boolean requestor, LogicalMessageContext context) {
-        context.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, isOutbound());
         return invokeHandlerChain(logicalHandlers, context);
     }
 
     public boolean invokeLogicalHandlersHandleFault(boolean requestor, LogicalMessageContext context) {
-        context.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, isOutbound());
         return invokeHandlerChainHandleFault(logicalHandlers, context);
     }
 
     public boolean invokeProtocolHandlers(boolean requestor, MessageContext context) {
-        context.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, isOutbound());
-
         return invokeHandlerChain(protocolHandlers, context);
     }
 
     public boolean invokeProtocolHandlersHandleFault(boolean requestor, MessageContext context) {
-        context.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, isOutbound());
-
         return invokeHandlerChainHandleFault(protocolHandlers, context);
     }
 
@@ -248,7 +242,6 @@
         if (LOG.isLoggable(Level.FINE)) {
             LOG.log(Level.FINE, "invoking handlers, direction: " + (outbound ? "outbound" : "inbound"));
         }
-        setMessageOutboundProperty(ctx);
 
         if (!outbound) {
             handlerChain = reverseHandlerChain(handlerChain);

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java Tue Sep  2 09:22:27 2008
@@ -25,7 +25,6 @@
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.jaxws.handler.AbstractJAXWSHandlerInterceptor;
 import org.apache.cxf.jaxws.handler.HandlerChainInvoker;
-import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptorChain;
@@ -51,9 +50,7 @@
         LogicalMessageContextImpl lctx = new LogicalMessageContextImpl(message);
         invoker.setLogicalMessageContext(lctx);
         boolean requestor = isRequestor(message);
-        
-        ContextPropertiesMapping.mapCxf2Jaxws(message.getExchange(), lctx, requestor);          
-        
+
         if (!invoker.invokeLogicalHandlers(requestor, lctx) && requestor) {
             if (isOutbound(message)) {
                 // client side outbound - the request message becomes the

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerInInterceptor.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerInInterceptor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerInInterceptor.java Tue Sep  2 09:22:27 2008
@@ -33,7 +33,6 @@
 import org.apache.cxf.jaxws.handler.AbstractJAXWSHandlerInterceptor;
 import org.apache.cxf.jaxws.handler.HandlerChainInvoker;
 import org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor;
-import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
@@ -63,7 +62,6 @@
             setupBindingOperationInfo(message.getExchange(), lctx);
         }
         
-        ContextPropertiesMapping.mapCxf2Jaxws(message.getExchange(), lctx, requestor);
         if (!invoker.invokeLogicalHandlers(requestor, lctx)) {
             if (!requestor) {
                 //server side 

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java Tue Sep  2 09:22:27 2008
@@ -36,7 +36,6 @@
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.jaxws.handler.AbstractJAXWSHandlerInterceptor;
 import org.apache.cxf.jaxws.handler.HandlerChainInvoker;
-import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptorChain;
@@ -106,8 +105,6 @@
             invoker.setLogicalMessageContext(lctx);
             boolean requestor = isRequestor(message);
             
-            ContextPropertiesMapping.mapCxf2Jaxws(message.getExchange(), lctx, requestor);
-            
             
             XMLStreamReader reader = (XMLStreamReader)message.get("LogicalHandlerInterceptor.INREADER");
             SOAPMessage origMessage = null;

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageContextImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageContextImpl.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageContextImpl.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageContextImpl.java Tue Sep  2 09:22:27 2008
@@ -19,8 +19,11 @@
 
 package org.apache.cxf.jaxws.handler.logical;
 
+import java.util.Map;
+
 import javax.xml.ws.LogicalMessage;
 import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
 
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.message.Message;
@@ -35,5 +38,25 @@
     public LogicalMessage getMessage() {
         return new LogicalMessageImpl(this);
     }
+    
+    public Object get(Object key) {
+        Object o = super.get(key);
+        if (MessageContext.HTTP_RESPONSE_HEADERS.equals(key)
+            || MessageContext.HTTP_REQUEST_HEADERS.equals(key)) {
+            Map mp = (Map)o;
+            if (mp != null) {
+                if (mp.isEmpty()) {
+                    return null;
+                }
+                if (!isResponse() && MessageContext.HTTP_RESPONSE_HEADERS.equals(key)) {
+                    return null;
+                }
+                if (isRequestor() && MessageContext.HTTP_REQUEST_HEADERS.equals(key)) {
+                    return null;
+                }
+            }
+        }
+        return o;
+    }
 
 }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/DispatchSOAPHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/DispatchSOAPHandlerInterceptor.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/DispatchSOAPHandlerInterceptor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/DispatchSOAPHandlerInterceptor.java Tue Sep  2 09:22:27 2008
@@ -37,7 +37,6 @@
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxws.handler.AbstractProtocolHandlerInterceptor;
 import org.apache.cxf.jaxws.handler.HandlerChainInvoker;
-import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptorChain;
@@ -125,10 +124,7 @@
     
     @Override
     protected MessageContext createProtocolMessageContext(SoapMessage message) {
-        SOAPMessageContextImpl sm = new SOAPMessageContextImpl(message);
-        boolean requestor = isRequestor(message);
-        ContextPropertiesMapping.mapCxf2Jaxws(message.getExchange(), sm, requestor);
-        return sm;
+        return new SOAPMessageContextImpl(message);
     }
 
     public void handleFault(SoapMessage message) {

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java Tue Sep  2 09:22:27 2008
@@ -56,7 +56,6 @@
 import org.apache.cxf.interceptor.OutgoingChainInterceptor;
 import org.apache.cxf.jaxws.handler.AbstractProtocolHandlerInterceptor;
 import org.apache.cxf.jaxws.handler.HandlerChainInvoker;
-import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
@@ -230,8 +229,6 @@
     protected MessageContext createProtocolMessageContext(SoapMessage message) {
         SOAPMessageContextImpl sm = new SOAPMessageContextImpl(message);
         
-        boolean requestor = isRequestor(message);
-        ContextPropertiesMapping.mapCxf2Jaxws(message.getExchange(), sm, requestor);
         Exchange exch = message.getExchange();
         setupBindingOperationInfo(exch, sm);
         SOAPMessage msg = sm.getMessage();

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java Tue Sep  2 09:22:27 2008
@@ -24,6 +24,7 @@
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import javax.xml.bind.JAXBContext;
@@ -117,5 +118,25 @@
     private SoapMessage getWrappedSoapMessage() {
         return (SoapMessage)getWrappedMessage();
     }
+    
+    public Object get(Object key) {
+        Object o = super.get(key);
+        if (MessageContext.HTTP_RESPONSE_HEADERS.equals(key)
+            || MessageContext.HTTP_REQUEST_HEADERS.equals(key)) {
+            Map mp = (Map)o;
+            if (mp != null) {
+                if (mp.isEmpty()) {
+                    return null;
+                }
+                if (!isRequestor() && isOutbound() && MessageContext.HTTP_RESPONSE_HEADERS.equals(key)) {
+                    return null;
+                }
+                if (isRequestor() && isOutbound() && MessageContext.HTTP_REQUEST_HEADERS.equals(key)) {
+                    return null;
+                }
+            }
+        }
+        return o;
+    }
    
 }

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java Tue Sep  2 09:22:27 2008
@@ -972,10 +972,6 @@
 
         invoker.invokeLogicalHandlers(requestorProperty, lmc);
 
-        assertNotNull(message.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
-        assertEquals(outboundProperty, message.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
-        // assertNotNull(message.get(ObjectMessageContext.REQUESTOR_ROLE_PROPERTY));
-        // assertEquals(requestorProperty, message.get(ObjectMessageContext.REQUESTOR_ROLE_PROPERTY));
         assertTrue("handler not invoked", logicalHandlers[0].isHandleMessageInvoked());
         assertTrue("handler not invoked", logicalHandlers[1].isHandleMessageInvoked());
         assertTrue(invoker.getInvokedHandlers().contains(logicalHandlers[0]));

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java?rev=691301&r1=691300&r2=691301&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java Tue Sep  2 09:22:27 2008
@@ -18,11 +18,9 @@
  */
 package org.apache.cxf.jaxws.support;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.LinkedList;
-import java.util.List;
 import java.util.Map;
 
 import javax.activation.DataHandler;
@@ -30,16 +28,16 @@
 import javax.mail.util.ByteArrayDataSource;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
 
 
 import org.apache.cxf.attachment.AttachmentImpl;
-import org.apache.cxf.headers.Header;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
-import org.easymock.EasyMock;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -48,7 +46,6 @@
     private static final String ADDRESS = "test address";
     private static final String REQUEST_METHOD = "GET";
     private static final String HEADER = "header";
-    private static final Integer RESPONSE_CODE = 401; 
     
     private Map<String, Object> message = new HashMap<String, Object>();
     private Map<String, Object> requestContext = new HashMap<String, Object>();
@@ -67,35 +64,6 @@
         responseContext.clear();
     }
     
-    @Test
-    public void testMapRequestfromJaxws2Cxf() {
-        Object address = requestContext.get(Message.ENDPOINT_ADDRESS);
-        assertNull("address should be null", address);
-        ContextPropertiesMapping.mapRequestfromJaxws2Cxf(requestContext);
-        address = requestContext.get(Message.ENDPOINT_ADDRESS);
-        assertNotNull("address should not be null", address);
-        assertEquals("address should get from requestContext", address, ADDRESS + "jaxws");
-        message.putAll(requestContext);
-        address = message.get(Message.ENDPOINT_ADDRESS);        
-        assertNotNull("address should not be null", address);
-        assertEquals("address should get from requestContext", address, ADDRESS + "jaxws");
-        Object header = message.get(Message.PROTOCOL_HEADERS);
-        assertEquals("the message PROTOCOL_HEADERS should be updated", header, HEADER + "jaxws");
-    }
-    
-    @Test
-    public void testMapResponseCxf2Jaxws() {        
-        responseContext.putAll(message);
-        Object requestMethod = responseContext.get(MessageContext.HTTP_REQUEST_METHOD);
-        assertNull("requestMethod should be null", requestMethod);
-        ContextPropertiesMapping.mapResponsefromCxf2Jaxws(responseContext);
-        requestMethod = responseContext.get(MessageContext.HTTP_REQUEST_METHOD);
-        assertNotNull("requestMethod should not be null", requestMethod);
-        assertEquals(requestMethod, REQUEST_METHOD);
-        Object header = responseContext.get(MessageContext.HTTP_RESPONSE_HEADERS);
-        assertNotNull("the HTTP_RESPONSE_HEADERS should not be null ", header);
-        assertEquals("the HTTP_RESPONSE_HEADERS should be updated", header, HEADER);
-    }
     
     @Test
     public void testCreateWebServiceContext() {
@@ -108,7 +76,7 @@
         exchange.setInMessage(inMessage);
         exchange.setOutMessage(outMessage);
         
-        MessageContext ctx = ContextPropertiesMapping.createWebServiceContext(exchange);
+        MessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);
         
         Object requestHeader = ctx.get(MessageContext.HTTP_REQUEST_HEADERS);
         assertNotNull("the request header should not be null", requestHeader);
@@ -125,42 +93,6 @@
     }
     
     @Test
-    public void testUpdateWebServiceContext() {
-        Exchange xchng = new ExchangeImpl();
-        Message outMsg = new MessageImpl();
-        List<Header> hdrList = new ArrayList<Header>();
-        xchng.setOutMessage(outMsg);
-        
-        responseContext.put(MessageContext.HTTP_RESPONSE_CODE, RESPONSE_CODE);
-        
-        MessageContext ctx = EasyMock.createMock(MessageContext.class);
-        ctx.containsKey(MessageContext.HTTP_RESPONSE_CODE);
-        EasyMock.expectLastCall().andReturn(true);
-        ctx.get(MessageContext.HTTP_RESPONSE_CODE);
-        EasyMock.expectLastCall().andReturn(RESPONSE_CODE);
-        
-        ctx.containsKey(Header.HEADER_LIST);
-        EasyMock.expectLastCall().andReturn(true);
-        ctx.get(Header.HEADER_LIST);
-        EasyMock.expectLastCall().andReturn(hdrList);
-        ctx.get(Header.HEADER_LIST);
-        EasyMock.expectLastCall().andReturn(hdrList);
-
-        ctx.containsKey(MessageContext.HTTP_RESPONSE_HEADERS);
-        EasyMock.expectLastCall().andReturn(false);
-        
-        ctx.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
-        EasyMock.expectLastCall().andReturn(null);
-
-        EasyMock.replay(ctx);
-        
-        ContextPropertiesMapping.updateWebServiceContext(xchng, ctx);
-        Integer respCode = (Integer)outMsg.get(Message.RESPONSE_CODE);
-        assertNotNull("no response code set on out message", respCode);
-        assertEquals("incorrect response code returned", RESPONSE_CODE, respCode);
-    }
-
-    @Test
     @SuppressWarnings("unchecked")
     public void testCreateWebServiceContextWithInAttachments() {
         Exchange exchange = new ExchangeImpl();
@@ -180,7 +112,7 @@
         exchange.setInMessage(inMessage);
         exchange.setOutMessage(new MessageImpl());
         
-        MessageContext ctx = ContextPropertiesMapping.createWebServiceContext(exchange);
+        MessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);
         
         Object inAttachments = ctx.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
         assertNotNull("inbound attachments object must be initialized", inAttachments);



Mime
View raw message