cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1035798 - in /cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ systests/jaxrs/src/test/java/org/apa...
Date Tue, 16 Nov 2010 20:43:10 GMT
Author: dkulp
Date: Tue Nov 16 20:43:10 2010
New Revision: 1035798

URL: http://svn.apache.org/viewvc?rev=1035798&view=rev
Log:
[CXF-3128] Properly enforce where exclude=true is allowed rather than
just ignore it.

Added:
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeImpl.java
  (with props)
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeOnInterface.java
  (with props)
Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?rev=1035798&r1=1035797&r2=1035798&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
Tue Nov 16 20:43:10 2010
@@ -183,8 +183,26 @@ public class JaxWsServiceConfiguration e
         if (Object.class.equals(method.getDeclaringClass())) {
             return false;
         }
+        
+        if (method.getDeclaringClass() == implInfo.getSEIClass()) {
+            WebMethod wm = method.getAnnotation(WebMethod.class);
+            if (wm != null && wm.exclude()) {
+                Message message = new Message("WEBMETHOD_EXCLUDE_NOT_ALLOWED", LOG,
+                                              method.getName());
+                throw new JaxWsConfigurationException(message);
+            }
+        }
+
+        
         Class implClz = implInfo.getImplementorClass();
-        if (isWebMethod(getDeclaredMethod(implClz, method))) {
+        Method m = getDeclaredMethod(implClz, method);
+        if (m != null) {
+            WebMethod wm = m.getAnnotation(WebMethod.class);
+            if (wm != null && wm.exclude()) {
+                return Boolean.FALSE;
+            }
+        }
+        if (isWebMethod(m)) {
             return true;
         }
         return isWebMethod(getDeclaredMethod(method));

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties?rev=1035798&r1=1035797&r2=1035798&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
Tue Nov 16 20:43:10 2010
@@ -31,3 +31,4 @@ INVALID_REQUEST_WRAPPER = @RequestWrappe
 INVALID_RESPONSE_WRAPPER = @ResponseWrapper class {0} is the same as the actual return class
{1}.  This is likely not to work. 
 SERVICECLASS_MUST_BE_SET = serviceClass must be set to a valid service interface or class
 XMLSEEALSO_NULL_CLASS = A class listed in the XmlSeeAlso annotation of the service class
%s cannot be found on the classpath. Index: %d of XmlSeeAlso class list.
+WEBMETHOD_EXCLUDE_NOT_ALLOWED = The @javax.jws.WebMethod(exclude=true) cannot be used on
a service endpoint interface. Method: {0}

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java?rev=1035798&r1=1035797&r2=1035798&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstWSDLTest.java
Tue Nov 16 20:43:10 2010
@@ -27,6 +27,7 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.jaxws.service.Hello2;
 import org.apache.cxf.jaxws.service.Hello3;
+import org.apache.cxf.jaxws.service.HelloExcludeImpl;
 import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.apache.cxf.service.Service;
@@ -114,5 +115,20 @@ public class CodeFirstWSDLTest extends A
         assertNotNull(portType);
         assertEquals(4, portType.getOperations().size());
     }
-
+    @Test
+    public void testExcludeOnInterface() throws Exception {
+        try {
+            JaxWsImplementorInfo info = new JaxWsImplementorInfo(HelloExcludeImpl.class);
+            ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean(info);
+
+            Bus bus = getBus();
+            bean.setBus(bus);
+            
+            bean.create();
+            
+            fail("WebMethod(exclude=true) is not allowed");
+        } catch (JaxWsConfigurationException e) {
+            assertTrue(e.getMessage().contains("WebMethod"));
+        }
+    }
 }

Added: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeImpl.java?rev=1035798&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeImpl.java
(added)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeImpl.java
Tue Nov 16 20:43:10 2010
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jaxws.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface = "org.apache.cxf.jaxws.service.HelloExcludeOnInterface")
+public class HelloExcludeImpl implements HelloExcludeOnInterface {
+
+    public String sayHi(String text) {
+        return text;
+    }
+    
+    public List<String> getGreetings() {
+        List<String> strings = new ArrayList<String>();
+        strings.add("Hello");
+        strings.add("Bonjour");
+        return strings;
+    }
+
+    public void sayGoodbye() {
+    }
+
+    public String[] getStringArray(String[] strs) {
+        return null;
+    }
+
+    public List<String> getStringList(List<String> list) {
+        return null;
+    }
+
+    public int echoExcluded(int i) {
+        return 0;
+    }
+
+}

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeOnInterface.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeOnInterface.java?rev=1035798&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeOnInterface.java
(added)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeOnInterface.java
Tue Nov 16 20:43:10 2010
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jaxws.service;
+
+import java.util.List;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService
+public interface HelloExcludeOnInterface {
+    @WebMethod
+    String sayHi(String text);
+    @WebMethod
+    List<String> getGreetings();
+
+    String[] getStringArray(String[] strs);
+    
+    List<String> getStringList(List<String> list);
+    
+    
+    @WebMethod(exclude = true)
+    int echoExcluded(int i);
+}

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeOnInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloExcludeOnInterface.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java?rev=1035798&r1=1035797&r2=1035798&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java
Tue Nov 16 20:43:10 2010
@@ -47,23 +47,19 @@ public interface BookStoreJaxrsJaxws {
     Book addBook(@WebParam(name = "book") Book book);
     
     @Path("/books/{id}")
-    @WebMethod(exclude = true)
     BookSubresource getBookSubresource(@PathParam("id") String id);
     
     @Path("/thestore/{id}")
-    @WebMethod(exclude = true)
     BookStoreJaxrsJaxws getBookStore(@PathParam("id") String id);
     
     @POST
     @Path("/fastinfoset")
     @Consumes({"text/xml" })
     @Produces({"application/fastinfoset", "text/xml", "application/xml" })
-    @WebMethod(exclude = true)
     Book addFastinfoBook(Book book);
     
     @GET
     @Path("/fastinfoset2")
     @Produces({"application/fastinfoset", "text/xml", "application/xml" })
-    @WebMethod(exclude = true)
     Book getFastinfoBook();
 }



Mime
View raw message