cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: svn commit: r1539911 - in /cxf/trunk: parent/ rt/frontend/jaxrs/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/
Date Fri, 08 Nov 2013 06:51:44 GMT
Freeman,

I have some problems with this commit….  inline….



On Nov 8, 2013, at 4:30 AM, ffang@apache.org wrote:

> 
> 
> Modified: cxf/trunk/rt/frontend/jaxrs/pom.xml
> URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/pom.xml?rev=1539911&r1=1539910&r2=1539911&view=diff
> ==============================================================================
> --- cxf/trunk/rt/frontend/jaxrs/pom.xml (original)
> +++ cxf/trunk/rt/frontend/jaxrs/pom.xml Fri Nov  8 03:30:41 2013
> @@ -36,6 +36,7 @@
>             javax.servlet*;version="${cxf.osgi.javax.servlet.version}",
>             org.apache.aries*;version="${cxf.aries.version.range}",
>             org.springframework*;resolution:="optional";version="${cxf.osgi.spring.version}",
> +            com.wordnik.swagger.jaxrs*;resolution:="optional";version="[1.3.0, 1.4.0)",
>             javax.ws.rs.client;version="[2.0,3)",
>             javax.ws.rs*;version="[1.0,3)",
>         </cxf.osgi.import>
> @@ -158,6 +159,10 @@
>                 </exclusion>
>             </exclusions>
>         </dependency> 
> +        <dependency>
> +            <groupId>com.wordnik</groupId>
> +            <artifactId>swagger-jaxrs_2.10</artifactId>
> +        </dependency>
>     </dependencies>
> 

The dependency should likely be marked optional as well.   




> 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=1539911&r1=1539910&r2=1539911&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
Fri Nov  8 03:30:41 2013
> @@ -110,6 +110,7 @@ public class AbstractJAXRSFactoryBean ex
>         super.setBus(bus);
>         checkBindingFactory(bus);
>         serviceFactory.setBus(bus);
> +        bus.setProperty(JAXRSServiceFactoryBean.class.getName(), serviceFactory);
>     }

I’m -1 to this….    We can have multiple ServiceFactories being initialized at once on
the bus.  This is not thread safe at all.  In particular, if using the API’s to create many
clients at once from various threads, this would cause all kinds of potential problems.


>     /*
> @@ -204,6 +205,7 @@ public class AbstractJAXRSFactoryBean ex
>      */
>     public void setServiceFactory(JAXRSServiceFactoryBean serviceFactory) {
>         this.serviceFactory = serviceFactory;
> +        getBus().setProperty(JAXRSServiceFactoryBean.class.getName(), serviceFactory);
>     }

Likewise.

If something is needed in the Feature, make sure it’s saved on the Server object or, preferably,
on the Endpoint.


>     protected Endpoint createEndpoint() throws BusException, EndpointException {

Likely in this call someplace or the createEndpointInfo method.   


> 
> Added: 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=1539911&view=auto
> ==============================================================================
> --- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java
(added)
> +++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerFeature.java
Fri Nov  8 03:30:41 2013
> @@ -0,0 +1,142 @@


snip…...

> +    
> +    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");
> +            }
> +        }
> +    }

Where did the "http://localhost:8181/cxf” value come from?


-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Mime
View raw message