cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r538706 - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/staxutils/ 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...
Date Wed, 16 May 2007 20:13:26 GMT
Author: dkulp
Date: Wed May 16 13:13:21 2007
New Revision: 538706

URL: http://svn.apache.org/viewvc?view=rev&rev=538706
Log:
Bunch of jaxws updates
* Implement context property scoping
* Implement SOAP context header support
* Add HandlerChain thing to service as well as SEI's


Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.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/handler/AbstractProtocolHandlerInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageContextImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java?view=diff&rev=538706&r1=538705&r2=538706
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java
Wed May 16 13:13:21 2007
@@ -63,6 +63,9 @@
     }
 
     private String getPrefix(Element e, String uri) {
+        if (e == null) {
+            return null;
+        }
         NamedNodeMap attributes = e.getAttributes();
         if (attributes != null) {
             for (int i = 0; i < attributes.getLength(); i++) {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java?view=diff&rev=538706&r1=538705&r2=538706
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
Wed May 16 13:13:21 2007
@@ -20,13 +20,17 @@
 package org.apache.cxf.jaxws;
 
 import java.lang.reflect.Method;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
 
 import org.apache.cxf.common.util.factory.Factory;
 import org.apache.cxf.helpers.CastUtils;
 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.Exchange;
 import org.apache.cxf.service.invoker.ApplicationScopePolicy;
@@ -58,9 +62,29 @@
         // set up the webservice request context 
         MessageContext ctx = 
             ContextPropertiesMapping.createWebServiceContext(exchange);
+        
+        Map<String, Scope> scopes = CastUtils.cast((Map<?, ?>)ctx.get(WrappedMessageContext.SCOPES));
+        Map<String, Object> handlerScopedStuff = new HashMap<String, Object>();
+        if (scopes != null) {
+            for (Map.Entry<String, Scope> scope : scopes.entrySet()) {
+                if (scope.getValue() == Scope.HANDLER) {
+                    handlerScopedStuff.put(scope.getKey(), ctx.get(scope.getKey()));
+                }
+            }
+            for (String key : handlerScopedStuff.keySet()) {
+                ctx.remove(key);
+            }
+        }
+
+        
         WebServiceContextImpl.setMessageContext(ctx);
         
         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);
+        }
         
         //update the webservice response context
         ContextPropertiesMapping.updateWebServiceContext(exchange, ctx);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?view=diff&rev=538706&r1=538705&r2=538706
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
Wed May 16 13:13:21 2007
@@ -22,10 +22,9 @@
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.net.HttpURLConnection;
-import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.FutureTask;
 import java.util.logging.Logger;
 
@@ -38,7 +37,7 @@
 //import javax.xml.ws.EndpointReference;
 import javax.xml.ws.Response;
 import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.MessageContext;
+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;
@@ -52,6 +51,8 @@
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Endpoint;
 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.service.model.BindingOperationInfo;
 
@@ -60,8 +61,7 @@
 
     private static final Logger LOG = LogUtils.getL7dLogger(JaxWsClientProxy.class);
 
-    protected Map<String, Object> requestContext =
-            Collections.synchronizedMap(new HashMap<String, Object>());
+    protected Map<String, Object> requestContext = new ConcurrentHashMap<String,
Object>();
 
     protected ThreadLocal <Map<String, Object>> responseContext =
             new ThreadLocal<Map<String, Object>>();
@@ -176,6 +176,14 @@
         
         // 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()) {
+                if (scope.getValue() == Scope.HANDLER) {
+                    respContext.remove(scope.getKey());
+                }
+            }
+        }
         return result;
 
     }
@@ -202,9 +210,13 @@
 
 
     private Map<String, Object> getRequestContextCopy() {
-        synchronized (this.requestContext) {
-            return new HashMap<String, Object>(this.requestContext);
+        Map<String, Object> realMap = new HashMap<String, Object>();
+        WrappedMessageContext ctx = new WrappedMessageContext(realMap,
+                                                              Scope.APPLICATION);
+        for (Map.Entry<String, Object> ent : requestContext.entrySet()) {
+            ctx.put(ent.getKey(), ent.getValue());
         }
+        return realMap;
     }
     
     public Map<String, Object> getRequestContext() {
@@ -222,18 +234,6 @@
         return binding;
     }
 
-    protected void populateResponseContext(MessageContext ctx) {
-        Iterator<String> iter = ctx.keySet().iterator();
-        Map<String, Object> respCtx = getResponseContext();
-        while (iter.hasNext()) {
-            String obj = iter.next();
-            if (MessageContext.Scope.APPLICATION.compareTo(ctx.getScope(obj)) == 0) {
-                respCtx.put(obj, ctx.get(obj));
-            }
-        }
-    }
-
-    
     /*
     //  TODO JAX-WS 2.1
     public EndpointReference getEndpointReference() {

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=538706&r1=538705&r2=538706
==============================================================================
--- 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
Wed May 16 13:13:21 2007
@@ -26,15 +26,65 @@
 
 import javax.xml.ws.handler.MessageContext;
 
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Message;
 
 public class WrappedMessageContext implements MessageContext {
-
+    public static final String SCOPES = WrappedMessageContext.class.getName() + ".SCOPES";
+    
+    private Map<String, Object> contextMap;
     private Message message;
-    private Map<String, Scope> scopes = new HashMap<String, Scope>();
+    private Map<String, Scope> scopes;
+    private Scope defaultScope;
 
     public WrappedMessageContext(Message m) {
+        this(m, 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)
{
         message = m;
+        contextMap = map;
+        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);
+            }
+        }
+        if (scopes == null) {
+            scopes = new HashMap<String, Scope>();
+            contextMap.put(SCOPES, scopes);
+        }
+    }
+    
+    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));
+            }
+        }
+    }
+    protected final boolean isRequestor() {
+        return Boolean.TRUE.equals(contextMap.containsKey(Message.REQUESTOR_ROLE));
+    }
+    protected final boolean isOutbound() {
+        return message != null 
+            && (message == message.getExchange().getOutMessage()
+                || message == message.getExchange().getOutFaultMessage());
     }
     
     public Message getWrappedMessage() {
@@ -42,71 +92,79 @@
     }
     
     public void clear() {
-        message.clear();      
+        contextMap.clear();      
     }
 
     public boolean containsKey(Object key) {
-        return message.containsKey(key);
+        return contextMap.containsKey(key);
     }
 
     public boolean containsValue(Object value) {
-        return message.containsValue(value);
+        return contextMap.containsValue(value);
     }
 
     public Set<Entry<String, Object>> entrySet() {
-        return message.entrySet();
+        return contextMap.entrySet();
     }
 
     public Object get(Object key) {
-        return message.get(key);
+        return contextMap.get(key);
     }
 
     public boolean isEmpty() {
-        return message.isEmpty();
+        return contextMap.isEmpty();
     }
 
     public Set<String> keySet() {
-        return message.keySet();
+        return contextMap.keySet();
     }
 
     public Object put(String key, Object value) {
-        return message.put(key, value);
+        if (!MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(key)) {
+            scopes.put(key, defaultScope);
+        }
+        return contextMap.put(key, value);
     }
 
     public void putAll(Map<? extends String, ? extends Object> t) {
-        message.putAll(t);
+        for (Map.Entry<? extends String, ? extends Object> s : t.entrySet()) {
+            put(s.getKey(), s.getValue());
+        }
     }
 
     public Object remove(Object key) {
-        return message.remove(key);
+        scopes.remove(key);
+        return contextMap.remove(key);
     }
 
     public int size() {
-        return message.size();
+        return contextMap.size();
     }
 
     public Collection<Object> values() {
-        return message.values();
+        return contextMap.values();
     }
 
-    public void setScope(String arg0, Scope arg1) {
-        if (!this.containsKey(arg0)) {
-            throw new IllegalArgumentException("non-existant property-" + arg0 + "is specified");
   
+    public void setScope(String key, Scope arg1) {
+        if (!this.containsKey(key)) {
+            throw new IllegalArgumentException("non-existant property-" + key + "is specified");
   
         }
-        scopes.put(arg0, arg1);        
+        scopes.put(key, arg1);        
     }
 
-    public Scope getScope(String arg0) {
-        
-        if (containsKey(arg0)) {
-            if (scopes.containsKey(arg0)) {
-                return scopes.get(arg0);
+    public Scope getScope(String key) {
+        if (containsKey(key)) {
+            if (scopes.containsKey(key)) {
+                return scopes.get(key);
             } else {
-                return Scope.HANDLER;
+                return defaultScope;
             }
         }
-        throw new IllegalArgumentException("non-existant property-" + arg0 + "is specified");
+        throw new IllegalArgumentException("non-existant property-" + key + "is specified");
     }
     
+    public Map<String, Scope> getScopes() {
+        return scopes;
+    }
     
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AbstractProtocolHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AbstractProtocolHandlerInterceptor.java?view=diff&rev=538706&r1=538705&r2=538706
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AbstractProtocolHandlerInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AbstractProtocolHandlerInterceptor.java
Wed May 16 13:13:21 2007
@@ -21,6 +21,7 @@
 
 import javax.xml.ws.Binding;
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
 
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.message.Message;
@@ -45,7 +46,7 @@
     }
     
     protected MessageContext createProtocolMessageContext(Message message) {
-        return new WrappedMessageContext(message);
+        return new WrappedMessageContext(message, Scope.HANDLER);
     }
 
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageContextImpl.java?view=diff&rev=538706&r1=538705&r2=538706
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageContextImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageContextImpl.java
Wed May 16 13:13:21 2007
@@ -29,7 +29,7 @@
 public class LogicalMessageContextImpl extends WrappedMessageContext implements LogicalMessageContext
{
 
     public LogicalMessageContextImpl(Message wrapped) {
-        super(wrapped);
+        super(wrapped, Scope.HANDLER);
     }
       
     public LogicalMessage getMessage() {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java?view=diff&rev=538706&r1=538705&r2=538706
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
Wed May 16 13:13:21 2007
@@ -20,19 +20,27 @@
 package org.apache.cxf.jaxws.handler.soap;
 
 
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
 import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
 import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
 import javax.xml.ws.handler.soap.SOAPMessageContext;
 
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
-import org.apache.cxf.headers.Header;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.XMLMessage;
@@ -40,8 +48,11 @@
 public class SOAPMessageContextImpl extends WrappedMessageContext implements SOAPMessageContext
{
     private static final SAAJInInterceptor SAAJ_IN = new SAAJInInterceptor();
     
+    private Set<String> roles = new HashSet<String>();
+    
     public SOAPMessageContextImpl(Message m) {
-        super(m);
+        super(m, Scope.HANDLER);
+        roles.add(getWrappedSoapMessage().getVersion().getNextRole());
     }
 
     public void setMessage(SOAPMessage message) {
@@ -78,33 +89,35 @@
 
     // TODO: handle the boolean parameter
     public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) {
-//        Element headerElements = getWrappedSoapMessage().getHeaders(Element.class);
-        List<Header> headerElements = getWrappedSoapMessage().getHeaders();
-        if (headerElements == null) {
-            return null;
-        }
-        
-        
-//        Collection<Object> objects = new ArrayList<Object>();
-//        for (int i = 0; i < headerElements.getChildNodes().getLength(); i++) {
-//            if (headerElements.getChildNodes().item(i) instanceof Element) {
-//                Element e = (Element)headerElements.getChildNodes().item(i);
-//                if (name.equals(e.getNamespaceURI())) {
-//                    try {
-//                        objects.add(context.createUnmarshaller().unmarshal(e));
-//                    } catch (JAXBException ex) {
-//                        // do something
-//                    }
-//                }
-//            }
-//        }
-//        Object[] headerObjects = new Object[objects.size()];
-//        return objects.toArray(headerObjects);
-        return headerElements.toArray();
+        SOAPMessage msg = getMessage();
+        SOAPHeader header;
+        try {
+            header = msg.getSOAPPart().getEnvelope().getHeader();
+            if (header == null || !header.hasChildNodes()) {
+                return new Object[0];
+            }
+            List<Object> ret = new ArrayList<Object>();
+            Iterator<SOAPHeaderElement> it = CastUtils.cast(header.examineAllHeaderElements());
+            while (it.hasNext()) {
+                SOAPHeaderElement she = it.next();
+                if ((allRoles
+                    || roles.contains(she.getActor())) 
+                    && name.equals(she.getElementQName())) {
+                    
+                    ret.add(context.createUnmarshaller().unmarshal(she));
+                    
+                }
+            }
+            return ret.toArray(new SOAPHeaderElement[ret.size()]);
+        } catch (SOAPException e) {
+            throw new WebServiceException(e);
+        } catch (JAXBException e) {
+            throw new WebServiceException(e);
+        } 
     }
 
     public Set<String> getRoles() {
-        return null;
+        return roles;
     }
 
     private SoapMessage getWrappedSoapMessage() {

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=538706&r1=538705&r2=538706
==============================================================================
--- 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
Wed May 16 13:13:21 2007
@@ -30,6 +30,7 @@
 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.binding.soap.SoapMessage;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
@@ -153,7 +154,7 @@
     
     
     public static MessageContext createWebServiceContext(Exchange exchange) {
-        MessageContext ctx = new WrappedMessageContext(exchange.getInMessage());
+        MessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);
         mapCxf2Jaxws(ctx);        
         addMessageAttachments(ctx, 
                               exchange.getInMessage(), 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java?view=diff&rev=538706&r1=538705&r2=538706
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainInvokerTest.java
Wed May 16 13:13:21 2007
@@ -43,6 +43,7 @@
 import javax.xml.ws.handler.soap.SOAPMessageContext;
 
 import junit.framework.TestCase;
+import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.jaxws.handler.logical.LogicalMessageContextImpl;
 import org.apache.cxf.jaxws.handler.soap.SOAPMessageContextImpl;
@@ -250,7 +251,7 @@
         
         //create an empty SOAP body for testing
         try {
-            pmc = new SOAPMessageContextImpl(message);
+            pmc = new SOAPMessageContextImpl(new SoapMessage(message));
             MessageFactory factory = MessageFactory.newInstance();
             SOAPMessage soapMessage = factory.createMessage();      
             ((SOAPMessageContext)pmc).setMessage(soapMessage);            

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java?view=diff&rev=538706&r1=538705&r2=538706
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
Wed May 16 13:13:21 2007
@@ -74,6 +74,20 @@
         }
         
         for (JavaServiceClass js : serviceClasses.values()) {
+            if (js.getHandlerChains() != null) {
+                HandlerConfigGenerator handlerGen = new HandlerConfigGenerator();
+                handlerGen.setJavaInterface(js);
+                handlerGen.generate(getEnvironment());
+
+                String annot = handlerGen.getHandlerAnnotation().toString();
+                if (handlerGen.getHandlerAnnotation() != null
+                    && !js.getAnnotations().contains(annot)) {
+                    js.addAnnotation(annot);
+                    js.addImport("javax.jws.HandlerChain");
+                }
+            }
+
+            
             String url = (String)env.get(ToolConstants.CFG_WSDLURL);
             String location = (String)env.get(ToolConstants.CFG_WSDLLOCATION);
             if (location == null 

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java?view=diff&rev=538706&r1=538705&r2=538706
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
Wed May 16 13:13:21 2007
@@ -30,6 +30,8 @@
 import javax.wsdl.extensions.mime.MIMEMultipartRelated;
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Element;
+
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -176,6 +178,9 @@
         if (model.getServiceClasses().containsKey(name)) {
             sclz = model.getServiceClasses().get(name);
         }
+        
+        Element handler = (Element)context.get(ToolConstants.HANDLER_CHAIN);
+        sclz.setHandlerChains(handler);
         
         
         Collection<EndpointInfo> ports = service.getEndpoints();

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm?view=diff&rev=538706&r1=538705&r2=538706
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
Wed May 16 13:13:21 2007
@@ -26,6 +26,10 @@
 #foreach ($port in ${service.Ports})    
 import ${port.PackageName}.${port.InterfaceClass};
 #end
+#foreach ($import in ${service.Imports}) 
+import ${import};
+#end
+
 /**
  * This class was generated by the CXF $version
  * $currentdate
@@ -34,6 +38,9 @@
  */
 
 @WebServiceClient(name = "${service.ServiceName}", targetNamespace = "$service.Namespace",
wsdlLocation = "$wsdlLocation")
+#foreach ($annotation in $service.Annotations)
+$annotation
+#end
 public class ${service.Name} extends Service {
 
     private final static URL WSDL_LOCATION;

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?view=diff&rev=538706&r1=538705&r2=538706
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Wed May 16 13:13:21 2007
@@ -24,6 +24,7 @@
 import java.lang.reflect.Modifier;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.util.Arrays;
 
 import javax.jws.HandlerChain;
 import javax.jws.Oneway;
@@ -539,7 +540,7 @@
         assertTrue(address.exists());
 
         File[] files = address.listFiles();
-        assertEquals(5, files.length);
+        assertEquals(Arrays.asList(address.listFiles()).toString(), 6, files.length);
         File handlerConfig = new File(address, "Greeter_handler.xml");
         assertTrue(handlerConfig.exists());
 



Mime
View raw message