cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r541955 - in /incubator/cxf/trunk/rt: core/src/main/java/org/apache/cxf/attachment/ frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/ frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/
Date Sun, 27 May 2007 00:49:23 GMT
Author: dkulp
Date: Sat May 26 17:49:22 2007
New Revision: 541955

URL: http://svn.apache.org/viewvc?view=rev&rev=541955
Log:
More context scoping fixes

Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java?view=diff&rev=541955&r1=541954&r2=541955
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
Sat May 26 17:49:22 2007
@@ -201,7 +201,6 @@
         loaded.add(input);
         CachedOutputStream out = new CachedOutputStream();
         IOUtils.copy(input, out);
-        out.close();
         input.setInputStream(out.getInputStream());
     }
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java?view=diff&rev=541955&r1=541954&r2=541955
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
Sat May 26 17:49:22 2007
@@ -120,8 +120,15 @@
     }
 
     public Object put(String key, Object value) {
-        if (!MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(key)) {
+        if (!MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(key)
+            && !scopes.containsKey(key)) {
             scopes.put(key, defaultScope);
+        }
+        return contextMap.put(key, value);
+    }
+    public Object put(String key, Object value, Scope scope) {
+        if (!MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(key)) {
+            scopes.put(key, scope);
         }
         return contextMap.put(key, value);
     }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java?view=diff&rev=541955&r1=541954&r2=541955
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
Sat May 26 17:49:22 2007
@@ -129,7 +129,7 @@
         if (null != responseHeaders) {
             context.put(MessageContext.HTTP_RESPONSE_HEADERS, responseHeaders);
         }  
-        mapCxf2Jaxws(context);
+        mapContext(context, cxf2jaxwsMap);
     }
     
     private static void mapJaxws2Cxf(Map<String, Object> context) {
@@ -142,16 +142,25 @@
         }
     }
         
-    private static void mapCxf2Jaxws(Map<String, Object> context) {
-        mapContext(context, cxf2jaxwsMap);
+    private static void mapCxf2Jaxws(WrappedMessageContext context) {
+        Set<String> keyset = context.keySet();
+        String[] keys = new String[0];
+        keys = keyset.toArray(keys);
+        for (int i = 0; i < keys.length; i++) {
+            String key = keys[i];
+            String mappingString = cxf2jaxwsMap.get(key);
+            if (null != mappingString) {
+                Object obj = context.get(key);
+                context.put(mappingString, obj, Scope.APPLICATION);
+            }
+        }
         
         if (context.containsKey(AuthorizationPolicy.class.getName())) {
             AuthorizationPolicy authPolicy =
                 (AuthorizationPolicy)context.get(AuthorizationPolicy.class.getName());
-            context.put(BindingProvider.USERNAME_PROPERTY, authPolicy.getUserName());
-            context.put(BindingProvider.PASSWORD_PROPERTY, authPolicy.getPassword());
+            context.put(BindingProvider.USERNAME_PROPERTY, authPolicy.getUserName(), Scope.APPLICATION);
+            context.put(BindingProvider.PASSWORD_PROPERTY, authPolicy.getPassword(), Scope.APPLICATION);
         }
-        
     }
     
     
@@ -162,7 +171,7 @@
     }
 
     public static void mapCxf2Jaxws(Exchange exchange, WrappedMessageContext ctx, boolean
requestor) {
-        mapCxf2Jaxws(ctx.getWrappedMessage());        
+        mapCxf2Jaxws(ctx);        
         Message inMessage = exchange.getInMessage();
         Message outMessage = exchange.getOutMessage();
         
@@ -181,11 +190,13 @@
                 inMessage.get(Message.PROTOCOL_HEADERS);
             if (null != inHeaders) {
                 if (requestor) {
-                    ctx.getWrappedMessage().put(MessageContext.HTTP_RESPONSE_HEADERS,
-                                                inHeaders);
+                    ctx.put(MessageContext.HTTP_RESPONSE_HEADERS,
+                            inHeaders,
+                            Scope.APPLICATION);
                 } else {
-                    ctx.getWrappedMessage().put(MessageContext.HTTP_REQUEST_HEADERS,
-                                                inHeaders);                    
+                    ctx.put(MessageContext.HTTP_REQUEST_HEADERS,
+                            inHeaders,
+                            Scope.APPLICATION);                    
                 }
             
                 outMessage = exchange.getOutMessage();
@@ -206,14 +217,16 @@
                 outMessage.get(Message.PROTOCOL_HEADERS);
             
             if (outHeaders != null && !requestor) {
-                ctx.getWrappedMessage().put(MessageContext.HTTP_REQUEST_HEADERS, outHeaders);
+                ctx.put(MessageContext.HTTP_REQUEST_HEADERS,
+                        outHeaders,
+                        Scope.APPLICATION);
             }
         }
 
        
     }
     
-    private static void addMessageAttachments(MessageContext ctx,
+    private static void addMessageAttachments(WrappedMessageContext ctx,
                                               Message message,
                                               String propertyName) {
         Map<String, DataHandler> dataHandlers = null;
@@ -230,7 +243,8 @@
 
         ctx.put(propertyName, 
                 dataHandlers == null ? Collections.EMPTY_MAP
-                                     : Collections.unmodifiableMap(dataHandlers));
+                                     : Collections.unmodifiableMap(dataHandlers),
+                Scope.APPLICATION);
     }
     
     public static void updateWebServiceContext(Exchange exchange, MessageContext ctx) {



Mime
View raw message