cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Akitoshi Yoshida (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-6740) Collision by Swagger2Feature in two OSGI bundles
Date Wed, 27 Jan 2016 11:02:39 GMT

    [ https://issues.apache.org/jira/browse/CXF-6740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15119041#comment-15119041
] 

Akitoshi Yoshida commented on CXF-6740:
---------------------------------------

Hi Andriy, Sergey,

My temporary change to swagger-core is in my git branch [1]
It is branched from the origin's 01-18 version with this minor change [2]. That means, it
does not include the change included with swagger-1482.

And I am attachning the change and some samples for cxf as a patch file against cxf's current
master [3]

Once you build both swagger-core and cxf projects including the two samples at its sample
folders. You can install them on karaf by running the karaf comands

feature:repo-add cxf 3.2.0-SNAPSHOT
feature:install cxf-rs-description-swagger2
install -s mvn:org.apache.cxf.samples/jax_rs_description_swagger2_osgi
install -s mvn:org.apache.cxf.samples/jax_rs_description_swagger2_osgi2

and from the console, run

curl http://localhost:8181/cxf/swaggerSample/swagger.yaml
and
curl http://localhost:8181/cxf/swaggerSample2/swagger.yaml

to get two different swagger documents.

However, as I mentioned, if the first call is held between its set and get lines and the second
call's set is invoked, both calls will get the second document. And this was my question mentioned
earlier, whether we should add another context attribute "swagger.local" with true or false
to use the uri-path to do the lookup in the context when this is set to true. 

[1] https://github.com/elakito/swagger-core/tree/alt-1482
[2] https://github.com/elakito/swagger-core/commit/957e06ecce5a1286e882c6fda2c0a776eec9f2c0
[3] 0001-temporary-work-for-cxf-6740.patch attached in this ticket

> Collision by Swagger2Feature in two OSGI bundles 
> -------------------------------------------------
>
>                 Key: CXF-6740
>                 URL: https://issues.apache.org/jira/browse/CXF-6740
>             Project: CXF
>          Issue Type: Bug
>          Components: OSGi
>    Affects Versions: 3.1.4
>         Environment: Apache Karaf 4.0.2
>            Reporter: Andre Schlegel
>            Assignee: Andriy Redko
>
> I have two separate bundles in my karaf, which are using cxf with the swagger2feature.
The endpoints (/cxf/bpc-core and /cxf/bpc-monitor/ ) in both bundles working fine. But I got
on both swagger-URL the same swagger-File (both for the monitor endpoints).
> I'm using the blueprint for swagger2feature configuration and annotation for the endpoints.
> core bundle
> {code}
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:cxf="http://cxf.apache.org/blueprint/core"
>        xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
>        xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>                            http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
>                            http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd">
>     <!-- JAXRS providers -->
>     <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"
/>
>     <!-- Application resources -->
>     <bean id="authenticationResource" class="de.virtimo.bpc.core.resource.AuthenticationResource"
/>
>     <bean id="configurationResource" class="de.virtimo.bpc.core.resource.Configuration"
/>
>     <bean id="statusResource" class="de.virtimo.bpc.core.resource.Status" />
>     <!-- CXF Swagger2Feature -->  
>     <bean id="swagger2Feature_core" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
>         <property name="basePath" value="/bpc-core"/>
>         <property name="title" value="BPC Core"/>
>     </bean>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging />
>         </cxf:features>
>     </cxf:bus>
>     <jaxrs:server id="bpcServer" address="/bpc-core">
>         <jaxrs:serviceBeans>
>             <ref component-id="authenticationResource" />
>             <ref component-id="configurationResource" />
>             <ref component-id="statusResource" />
>         </jaxrs:serviceBeans>
>         <jaxrs:providers>
>             <ref component-id="jsonProvider" />
>         </jaxrs:providers>
>         <jaxrs:features>
>             <ref component-id="swagger2Feature_core" />
>         </jaxrs:features>
>     </jaxrs:server>
> </blueprint>
> {code}
> Monitor Bundle
> {code}
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:cxf="http://cxf.apache.org/blueprint/core"
>        xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
>        xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>                            http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
>                            http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd">
>     <!-- JAXRS providers -->
>     <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"
/>
>     <!-- Application resources -->
>     <bean id="monitorResource" class="de.virtimo.bpc.module.monitor.resource.Monitor"
/>
>     <!-- CXF Swagger2Feature -->  
>     <bean id="swagger2Feature_monitor" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
>         <property name="basePath" value="/bpc-monitor"/>Center"/>
>         <property name="title" value="BPC Monitor"/>
>     </bean>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging />
>         </cxf:features>
>     </cxf:bus>
>     <jaxrs:server id="bpcMonitor" address="/bpc-monitor">
>         <jaxrs:serviceBeans>
>             <ref component-id="monitorResource" />
>         </jaxrs:serviceBeans>
>         <jaxrs:providers>
>             <ref component-id="jsonProvider" />
>         </jaxrs:providers>
>         <jaxrs:features>
>             <ref component-id="swagger2Feature_monitor" />
>         </jaxrs:features>
>     </jaxrs:server>
> </blueprint>
> {code}
> I got the swagger-file for the monitor bundle on /cxf/bpc-core/swagger.json and /cxf/bpc-monitor/swagger.json
> Anyone suggestion how to handle this scenario?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message