cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1540607 - in /cxf/trunk/rt/frontend/jaxrs: pom.xml src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java
Date Mon, 11 Nov 2013 04:20:27 GMT
Author: ffang
Date: Mon Nov 11 04:20:27 2013
New Revision: 1540607

URL: http://svn.apache.org/r1540607
Log:
[CXF-5379]mark swagger dependency as optional|use relative context path|remove potential concurrent
thread issue

Modified:
    cxf/trunk/rt/frontend/jaxrs/pom.xml
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java

Modified: cxf/trunk/rt/frontend/jaxrs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/pom.xml?rev=1540607&r1=1540606&r2=1540607&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/pom.xml (original)
+++ cxf/trunk/rt/frontend/jaxrs/pom.xml Mon Nov 11 04:20:27 2013
@@ -158,6 +158,7 @@
         <dependency>
             <groupId>com.wordnik</groupId>
             <artifactId>swagger-jaxrs_2.10</artifactId>
+            <optional>true</optional>
         </dependency>
     </dependencies>
     <build>

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java?rev=1540607&r1=1540606&r2=1540607&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
Mon Nov 11 04:20:27 2013
@@ -110,7 +110,6 @@ public class AbstractJAXRSFactoryBean ex
         super.setBus(bus);
         checkBindingFactory(bus);
         serviceFactory.setBus(bus);
-        bus.setProperty(JAXRSServiceFactoryBean.class.getName(), serviceFactory);
     }
     
     /*
@@ -205,7 +204,6 @@ public class AbstractJAXRSFactoryBean ex
      */
     public void setServiceFactory(JAXRSServiceFactoryBean serviceFactory) {
         this.serviceFactory = serviceFactory;
-        getBus().setProperty(JAXRSServiceFactoryBean.class.getName(), serviceFactory);
     }
 
     protected Endpoint createEndpoint() throws BusException, EndpointException {
@@ -241,6 +239,7 @@ public class AbstractJAXRSFactoryBean ex
             serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINT_SELECTED, ei, ep,
                                      cri.getServiceClass(), null);
         }
+        ep.put(JAXRSServiceFactoryBean.class.getName(), serviceFactory);
         return ep;
     }
     

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java?rev=1540607&r1=1540606&r2=1540607&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java
Mon Nov 11 04:20:27 2013
@@ -43,9 +43,9 @@ public class SwaggerFeature extends Abst
     public void initialize(Server server, Bus bus) {
         List<Object> serviceBeans = new ArrayList<Object>();
         serviceBeans.add(new com.wordnik.swagger.jaxrs.listing.ApiListingResourceJSON());
-        calulateDefaultResourcePackage(bus);
+        calulateDefaultResourcePackage(server);
         calulateDefaultBasePath(server);
-        ((JAXRSServiceFactoryBean)bus.getProperty(JAXRSServiceFactoryBean.class.getName())).
+        ((JAXRSServiceFactoryBean)server.getEndpoint().get(JAXRSServiceFactoryBean.class.getName())).
             setResourceClassesFromBeans(serviceBeans);
         List<Object> providers = new ArrayList<Object>();
         providers.add(new com.wordnik.swagger.jaxrs.listing.ResourceListingProvider());
@@ -63,9 +63,9 @@ public class SwaggerFeature extends Abst
         beanConfig.setScan(isScan());
         initializeProvider(server.getEndpoint(), bus);
     }
-    private void calulateDefaultResourcePackage(Bus bus) {
+    private void calulateDefaultResourcePackage(Server server) {
         JAXRSServiceFactoryBean serviceFactoryBean = 
-            (JAXRSServiceFactoryBean)bus.getProperty(JAXRSServiceFactoryBean.class.getName());
+            (JAXRSServiceFactoryBean)server.getEndpoint().get(JAXRSServiceFactoryBean.class.getName());
         AbstractResourceInfo resourceInfo = serviceFactoryBean.getClassResourceInfo().get(0);
         
         if ((resourceInfo != null) 
@@ -76,13 +76,7 @@ public class SwaggerFeature extends Abst
     
     private void calulateDefaultBasePath(Server server) {
         String address = server.getEndpoint().getEndpointInfo().getAddress();
-        if (getBasePath() == null || getBasePath().length() == 0) {
-            if (address.startsWith("http")) {
-                setBasePath(address + "/api-docs");
-            } else {
-                setBasePath("http://localhost:8181/cxf" + address + "/api-docs");
-            }
-        }
+        setBasePath(address + "/api-docs");
     }
     public String getResourcePackage() {
         return resourcePackage;



Mime
View raw message