cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r911114 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/endpoint/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ s...
Date Wed, 17 Feb 2010 17:48:25 GMT
Author: sergeyb
Date: Wed Feb 17 17:48:25 2010
New Revision: 911114

URL: http://svn.apache.org/viewvc?rev=911114&view=rev
Log:
Ensuring SOAP contracts can actually be hidden too

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
    cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java?rev=911114&r1=911113&r2=911114&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java Wed
Feb 17 17:48:25 2010
@@ -19,6 +19,7 @@
 package org.apache.cxf.endpoint;
 
 import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -32,12 +33,17 @@
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 
 public abstract class AbstractEndpointFactory extends AbstractBasicInterceptorProvider {
+    
+    private static final String PRIVATE_ENDPOINT = "org.apache.cxf.endpoint.private";
+    private static final String PRIVATE_ENDPOINTS = "org.apache.cxf.private.endpoints";
+    
     protected Bus bus;
     protected String address;
     protected String transportId;
@@ -182,4 +188,27 @@
         this.dataBinding = dataBinding;
     }
 
+    /**
+     * Checks if a given endpoint has been marked as private.
+     * If yes then its address will be added to a bus list property
+     * Note that client factories might also check the endpoint, ex, 
+     * if the endpoint if private then it is likely no service contract
+     * will be available if requested from the remote address hence it has to
+     * be availbale locally or generated from the local source
+     * @param ep endpoint
+     */
+    @SuppressWarnings("unchecked")
+    protected boolean checkPrivateEndpoint(Endpoint ep) {
+        if (MessageUtils.isTrue(ep.get(PRIVATE_ENDPOINT))) {
+            List<String> addresses = 
+                (List<String>)getBus().getProperty(PRIVATE_ENDPOINTS);
+            if (addresses == null) {
+                addresses = new LinkedList<String>();
+            }
+            addresses.add(getAddress());
+            bus.setProperty(PRIVATE_ENDPOINTS, addresses);
+            return true;
+        }
+        return false;
+    }
 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java?rev=911114&r1=911113&r2=911114&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
Wed Feb 17 17:48:25 2010
@@ -22,7 +22,6 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -40,7 +39,6 @@
 import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.jaxrs.provider.ProviderFactory;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
-import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.invoker.Invoker;
 
@@ -105,13 +103,12 @@
             }
             
             ProviderFactory factory = setupFactory(ep);
-            checkIfPrivate(factory, ep);
             factory.setRequestPreprocessor(
                 new RequestPreprocessor(languageMappings, extensionMappings));
             if (rc != null) {
                 ep.put("org.apache.cxf.jaxrs.comparator", rc);
             }
-            
+            checkPrivateEndpoint(ep);
             if (start) {
                 server.start();
             }
@@ -129,20 +126,6 @@
         return server;
     }
 
-    @SuppressWarnings("unchecked")
-    protected void checkIfPrivate(ProviderFactory factory, Endpoint ep) {
-        if (MessageUtils.isTrue(ep.get("org.apache.cxf.endpoint.private"))) {
-            List<String> addresses = 
-                (List<String>)getBus().getProperty("org.apache.cxf.private.endpoints");
-            if (addresses == null) {
-                addresses = new LinkedList<String>();
-            }
-            addresses.add(getAddress());
-            
-            bus.setProperty("org.apache.cxf.private.endpoints", addresses);
-        }
-    }
-    
     protected void applyFeatures() {
         if (getFeatures() != null) {
             for (AbstractFeature feature : getFeatures()) {

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=911114&r1=911113&r2=911114&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
Wed Feb 17 17:48:25 2010
@@ -175,6 +175,8 @@
     public Server create() {
         Server server = super.create();
         init();
+        checkPrivateEndpoint(server.getEndpoint());
+        
         return server;
     }
     

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java?rev=911114&r1=911113&r2=911114&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
Wed Feb 17 17:48:25 2010
@@ -485,7 +485,7 @@
             getStringFromInputStream(getHttpInputStream("http://localhost:9092/test/services"));
         assertNotNull(listings);
         assertTrue(listings.contains("http://localhost:9092/test/services/soap/bookservice?wsdl"));
-        assertTrue(listings.contains("http://localhost:9092/test/services/soap/bookservice2?wsdl"));
+        assertFalse(listings.contains("http://localhost:9092/test/services/soap/bookservice2?wsdl"));
         
         assertTrue(listings.contains("http://localhost:9092/test/services/rest?_wadl&type=xml"));
         assertEquals(200, WebClient.create(

Modified: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml?rev=911114&r1=911113&r2=911114&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml (original)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml Wed Feb
17 17:48:25 2010
@@ -68,7 +68,11 @@
       endpointName="s:BookPort"
       id="soapservice2"
       implementor="#bookstore2"
-      address="/soap/bookservice2" />
+      address="/soap/bookservice2">
+      <jaxws:properties>
+          <entry key="org.apache.cxf.endpoint.private" value="true"/>
+      </jaxws:properties>
+  </jaxws:endpoint>    
 
   <jaxrs:server id="restservice2"
 		        address="/rest2">



Mime
View raw message