geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r516639 - in /geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client: PortMethodFilter.java PortMethodInterceptor.java
Date Sat, 10 Mar 2007 02:11:13 GMT
Author: gawor
Date: Fri Mar  9 18:11:12 2007
New Revision: 516639

URL: http://svn.apache.org/viewvc?view=rev&rev=516639
Log:
set properties on generated methods

Modified:
    geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodFilter.java
    geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodInterceptor.java

Modified: geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodFilter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodFilter.java?view=diff&rev=516639&r1=516638&r2=516639
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodFilter.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodFilter.java
Fri Mar  9 18:11:12 2007
@@ -18,16 +18,26 @@
 
 import java.lang.reflect.Method;
 
+import javax.xml.ws.WebEndpoint;
+
 import net.sf.cglib.proxy.CallbackFilter;
 
 public class PortMethodFilter implements CallbackFilter {
 
     public int accept(Method method) {
-        if (method.getName().equals("getPort")) {
+        if (isGenericPortMethod(method) || isGeneratedPortMethod(method)) {
             return 1; // use second method interceptor
         } else {
             return 0; // use first method interceptor
         }
+    }
+    
+    private boolean isGenericPortMethod(Method method) {
+        return (method.getName().equals("getPort"));
+    }
+    
+    private boolean isGeneratedPortMethod(Method method) {
+        return (method.getName().startsWith("get") && method.isAnnotationPresent(WebEndpoint.class));
     }
 
 }

Modified: geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodInterceptor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodInterceptor.java?view=diff&rev=516639&r1=516638&r2=516639
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodInterceptor.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodInterceptor.java
Fri Mar  9 18:11:12 2007
@@ -27,6 +27,7 @@
 import javax.security.auth.Subject;
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebEndpoint;
 import javax.xml.ws.soap.SOAPBinding;
 
 import java.lang.reflect.Method;
@@ -48,7 +49,8 @@
     public Object intercept(Object target, Method method, Object[] arguments, MethodProxy
methodProxy) throws Throwable {
         Object proxy = methodProxy.invokeSuper(target, arguments);       
         
-        if (method.getName().equals("getPort")) {            
+        if (method.getName().equals("getPort")) {     
+            // it's a generic getPort() method
             if (arguments.length == 1) {
                 // getPort(Class) called - use SEI annotation
                 setProperties((BindingProvider)proxy, JAXWSUtils.getPortType((Class)arguments[0]));
@@ -62,6 +64,10 @@
                     setProperties((BindingProvider)proxy, ((QName)arguments[0]).getLocalPart());
                 }
             }
+        } else if (method.getName().startsWith("get")) {
+            // it's a generated get<PortName>() method
+            WebEndpoint endpoint = method.getAnnotation(WebEndpoint.class);
+            setProperties((BindingProvider)proxy, endpoint.name());
         }
                 
         return proxy;



Mime
View raw message