cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1540611 - in /cxf/branches/2.7.x-fixes: ./ rt/frontend/jaxrs/pom.xml rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java
Date Mon, 11 Nov 2013 05:05:26 GMT
Author: ffang
Date: Mon Nov 11 05:05:26 2013
New Revision: 1540611

URL: http://svn.apache.org/r1540611
Log:
Merged revisions 1540607 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1540607 | ffang | 2013-11-11 12:20:27 +0800 (δΈ€, 11 11 2013) | 1 line
  
  [CXF-5379]mark swagger dependency as optional|use relative context path|remove potential
concurrent thread issue
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/pom.xml
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1540607

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/pom.xml?rev=1540611&r1=1540610&r2=1540611&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/pom.xml (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/pom.xml Mon Nov 11 05:05:26 2013
@@ -159,6 +159,7 @@
         <dependency>
             <groupId>com.wordnik</groupId>
             <artifactId>swagger-jaxrs_2.10</artifactId>
+            <optional>true</optional>
         </dependency>
     </dependencies>
 </project>

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java?rev=1540611&r1=1540610&r2=1540611&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
Mon Nov 11 05:05:26 2013
@@ -114,7 +114,6 @@ public class AbstractJAXRSFactoryBean ex
         super.setBus(bus);
         checkBindingFactory(bus);
         serviceFactory.setBus(bus);
-        bus.setProperty(JAXRSServiceFactoryBean.class.getName(), serviceFactory);
     }
     
     /*
@@ -209,7 +208,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 {
@@ -245,6 +243,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/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java?rev=1540611&r1=1540610&r2=1540611&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java
Mon Nov 11 05:05:26 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