cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject svn commit: r835858 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
Date Fri, 13 Nov 2009 14:28:30 GMT
Author: asoldano
Date: Fri Nov 13 14:28:28 2009
New Revision: 835858

URL: http://svn.apache.org/viewvc?rev=835858&view=rev
Log:
[CXF-2532] Merging changes to branch 2.2.x

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 13 14:28:28 2009
@@ -1 +1 @@
-/cxf/trunk:835613-835617,835621,835633,835843
+/cxf/trunk:835613-835617,835621,835633,835843,835855

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java?rev=835858&r1=835857&r2=835858&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
Fri Nov 13 14:28:28 2009
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.jaxws.context;
 
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -38,6 +40,8 @@
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 
 public class WrappedMessageContext implements MessageContext {
     public static final String SCOPES = WrappedMessageContext.class.getName() + ".SCOPES";
@@ -252,7 +256,43 @@
                 if (authPolicy != null) {
                     ret = authPolicy.getPassword();
                 }
+            } else if (Message.WSDL_OPERATION.equals(key)) {
+                BindingOperationInfo boi = getBindingOperationInfo(exchange);
+                if (boi != null) {
+                    ret = boi.getName();
+                }
+            } else if (Message.WSDL_SERVICE.equals(key)) {
+                BindingOperationInfo boi = getBindingOperationInfo(exchange);
+                if (boi != null) {
+                    ret = boi.getBinding().getService().getName();
+                }
+            } else if (Message.WSDL_INTERFACE.equals(key)) {
+                BindingOperationInfo boi = getBindingOperationInfo(exchange);
+                if (boi != null) {
+                    ret = boi.getBinding().getService().getInterface().getName();
+                }
+            } else if (Message.WSDL_PORT.equals(key)) {
+                EndpointInfo endpointInfo = getEndpointInfo(exchange);
+                if (endpointInfo != null) {
+                    ret = endpointInfo.getName();
+                }
+            } else if (Message.WSDL_DESCRIPTION.equals(key)) {
+                EndpointInfo endpointInfo = getEndpointInfo(exchange);
+                if (endpointInfo != null) {
+                    URI wsdlDescription = endpointInfo.getProperty("URI", URI.class);
+                    if (wsdlDescription == null) {
+                        String address = endpointInfo.getAddress();
+                        try {
+                            wsdlDescription = new URI(address + "?wsdl");
+                        } catch (URISyntaxException e) {
+                            // do nothing
+                        }
+                        endpointInfo.setProperty("URI", wsdlDescription);
+                    }
+                    ret = wsdlDescription;
+                }
             }
+
             
             if (ret == null && reqMessage != null) { 
                 ret = reqMessage.get(mappedkey);
@@ -260,6 +300,23 @@
         }
         return ret;
     }
+    
+    private static BindingOperationInfo getBindingOperationInfo(Exchange exchange) {
+        if (exchange != null && exchange.get(BindingOperationInfo.class) != null)
{
+            return exchange.get(BindingOperationInfo.class);
+        }
+        return null;
+    }
+
+    private static EndpointInfo getEndpointInfo(Exchange exchange) {
+        if (exchange != null) {
+            Endpoint endpoint = exchange.get(Endpoint.class);
+            if (endpoint != null) {
+                return endpoint.getEndpointInfo();
+            }
+        }
+        return null;
+    }
 
     private Message createResponseMessage() {
         if (exchange == null || exchange.isOneWay()) {



Mime
View raw message