Hi, There is an option to package Swagger UI stuff into separate servlet and deploy it into Karaf. I could provide an example, if needed.
Alternatively Swagger UI can be hosted on other Web Server, but initialized JSON / YAML URL from Karaf service. Regards, Andrei. > -----Original Message----- > From: nino martinez wael [mailto:[email protected]] > Sent: Sonntag, 9. April 2017 10:04 > To: [email protected] > Subject: Re: DOSGI 2 prefered documentation technique? > > Ok great news. I have the enunciate version Working, with http service.. > > On 7 Apr 2017 18:07, "Christian Schneider" <[email protected]> wrote: > > > It was not yet fully working like this. I got a swagger json but > > without any methods defined. > > > > With the help of sergey I found that I need to set @Api on the > > TaskResource interface. > > Then I get some better json. > > > > I am still not able to use the UI to call the methods but I hope I can > > also work this out. > > > > Christian > > > > On 07.04.2017 11:55, Christian Schneider wrote: > > > >> I think I got it working by changing the swagger feature to: > >> > >> Swagger2Feature swagger2Feature = new Swagger2Feature(); > >> swagger2Feature.setBasePath("/cxf/tasks/"); > >> swagger2Feature.setUsePathBasedConfig(true); > >> return Arrays.asList((Object)swagger2Feature); > >> > >> Basically I used the same config as in the > >> jax_rs_description_swagger2_osgi example. > >> Can you check if this works for you too? > >> > >> Christian > >> > >> On 07.04.2017 07:53, nino martinez wael wrote: > >> > >>> Christian, I have cloned dosgi, and added swagger to the jackson > >>> example > >>> > >>> https://github.com/nmwael/cxf-dosgi > >>> https://github.com/nmwael/cxf-dosgi/tree/master/samples/rest > >>> /impl-jackson > >>> > >>> > >>> On Thu, Apr 6, 2017 at 4:46 PM, Sergey Beryozkin > >>> <[email protected]> > >>> wrote: > >>> > >>> I know disabling a scan did help some of my colleagues to make it > >>> work > >>>> OSGI... > >>>> > >>>> Sergey > >>>> > >>>> On 06/04/17 15:44, Sergey Beryozkin wrote: > >>>> > >>>> Hi, to be honest, I do not know if it is expected to work with > >>>> DOSGi2, > >>>>> have a look please at the 'plain' Swagger2 OSGI demo, and debug > >>>>> what Swagger2featire does in that demo, and I guess then compare > >>>>> to what is happening with DOSGI, I think it needs to be at least > >>>>> CXF 3.1.10 > >>>>> > >>>>> Cheers, Sergey > >>>>> On 06/04/17 15:05, nino martinez wael wrote: > >>>>> > >>>>> I will look into making a test project. > >>>>>> > >>>>>> On Thu, Apr 6, 2017 at 4:05 PM, nino martinez wael < > >>>>>> [email protected]> wrote: > >>>>>> > >>>>>> Nope did not fix it.. setScan(false) did not help.. And wondering > >>>>>> why > >>>>>> > >>>>>>> swagger are not complaining, I have manually referred to the > >>>>>>> package for it to look. > >>>>>>> > >>>>>>> On Thu, Apr 6, 2017 at 3:40 PM, nino martinez wael < > >>>>>>> [email protected]> wrote: > >>>>>>> > >>>>>>> Let me just check.. I think I am using the wrong version of > >>>>>>> swagger..I > >>>>>>> > >>>>>>>> did a manual feature, for karaf... this feature should be used : > >>>>>>>> cxf-rs-description-swagger2 > >>>>>>>> > >>>>>>>> Let me just verify.. > >>>>>>>> > >>>>>>>> On Thu, Apr 6, 2017 at 3:34 PM, Sergey Beryozkin < > >>>>>>>> [email protected] > >>>>>>>> wrote: > >>>>>>>> > >>>>>>>> Yes, sometimes setScan(false) helps > >>>>>>>> > >>>>>>>>> Sergey > >>>>>>>>> > >>>>>>>>> On 06/04/17 14:32, Christian Schneider wrote: > >>>>>>>>> > >>>>>>>>> I am not very familiar with how Swagger works. Are you sure > >>>>>>>>> the scan > >>>>>>>>> > >>>>>>>>>> works like this in OSGi? > >>>>>>>>>> > >>>>>>>>>> Can you maybe put your test project into a github repo ? I am > >>>>>>>>>> willing to invest a bit of time to help make this work as I > >>>>>>>>>> think swagger would be a great feature for remote services. > >>>>>>>>>> > >>>>>>>>>> Christian > >>>>>>>>>> > >>>>>>>>>> On 06.04.2017 15:12, nino martinez wael wrote: > >>>>>>>>>> > >>>>>>>>>> I've fiddled a lot, nothing seems to work in order to make > >>>>>>>>>> swagger > >>>>>>>>>> > >>>>>>>>>>> aware of > >>>>>>>>>>> my endpoint.. However I have swagger ui running (although > >>>>>>>>>>> since swagger cannot see my endpoints, it's somewhat > >>>>>>>>>>> empty)... > >>>>>>>>>>> > >>>>>>>>>>> RSA does pickup the swagger intent, and all are "working" > >>>>>>>>>>> except it does not see my endpoints. I get both swagger json > >>>>>>>>>>> and yaml. > >>>>>>>>>>> > >>>>>>>>>>> @Component // > >>>>>>>>>>> ( > >>>>>>>>>>> property = > >>>>>>>>>>> "org.apache.cxf.dosgi.IntentName=swagger" > >>>>>>>>>>> // > >>>>>>>>>>> ) > >>>>>>>>>>> public class SwaggerIntent implements Callable<List<Object>> > >>>>>>>>>>> { > >>>>>>>>>>> > >>>>>>>>>>> private String version = ""; > >>>>>>>>>>> private String name = ""; > >>>>>>>>>>> > >>>>>>>>>>> @Activate > >>>>>>>>>>> public void activate(BundleContext bundleContext) { > >>>>>>>>>>> Dictionary<String, String> headers = > >>>>>>>>>>> bundleContext.getBundle().getHeaders(); > >>>>>>>>>>> version = headers.get("Bundle-Version"); > >>>>>>>>>>> name = headers.get("Bundle-Name"); > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> } > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> @Override > >>>>>>>>>>> public List<Object> call() throws Exception { > >>>>>>>>>>> Swagger2Feature swagger2Feature = new > >>>>>>>>>>> Swagger2Feature(); > >>>>>>>>>>> swagger2Feature.setBasePath("/cxf/dialer/v1/"); > >>>>>>>>>>> swagger2Feature.setTitle(name); > >>>>>>>>>>> swagger2Feature.setDescription(name); > >>>>>>>>>>> swagger2Feature.setLicense("Commercial"); > >>>>>>>>>>> swagger2Feature.setSupportSwaggerUi(true); > >>>>>>>>>>> swagger2Feature.setContact("development@"); > >>>>>>>>>>> swagger2Feature.setScan(true); > >>>>>>>>>>> swagger2Feature.setScanAllResources(true); > >>>>>>>>>>> swagger2Feature.setUsePathBasedConfig(true); > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> swagger2Feature.setPrettyPrint(true); > >>>>>>>>>>> swagger2Feature.setVersion(version); > >>>>>>>>>>> > >>>>>>>>>>> return Arrays.asList((swagger2Feature)); > >>>>>>>>>>> } > >>>>>>>>>>> > >>>>>>>>>>> } > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> Thanks for the mention about logger interceptors. > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> On Thu, Apr 6, 2017 at 1:50 PM, Christian Schneider > >>>>>>>>>>> <[email protected] > >>>>>>>>>>> > >>>>>>>>>>> wrote: > >>>>>>>>>>> > >>>>>>>>>>>> How do you export the swagger intent? > >>>>>>>>>>>> > >>>>>>>>>>>> Btw. The interceptors property will not work but you can > >>>>>>>>>>>> add the logging Feature to the swagger intent service. > >>>>>>>>>>>> > >>>>>>>>>>>> Christian > >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> On 06.04.2017 12:45, nino martinez wael wrote: > >>>>>>>>>>>> > >>>>>>>>>>>> Im having issue getting swagger to pickup my jaxrs endpoints... > >>>>>>>>>>>> CXF > >>>>>>>>>>>> > >>>>>>>>>>>> picks > >>>>>>>>>>>>> them up.. > >>>>>>>>>>>>> > >>>>>>>>>>>>> here a short sample: > >>>>>>>>>>>>> > >>>>>>>>>>>>> @Path("/") > >>>>>>>>>>>>> @Produces({MediaType.APPLICATION_JSON, > >>>>>>>>>>>>> MediaType.APPLICATION_XML}) @Component(immediate = > true, > >>>>>>>>>>>>> name = "SimpleEndPointsImpl", // > >>>>>>>>>>>>> property > >>>>>>>>>>>>> = // > >>>>>>>>>>>>> { // > >>>>>>>>>>>>> "service.exported.intents=swagger", > >>>>>>>>>>>>> "service.exported.interfaces=*", > >>>>>>>>>>>>> "service.exported.configs=org. > >>>>>>>>>>>>> apache.cxf.rs", > >>>>>>>>>>>>> "org.apache.cxf.rs.address=/di aler/v1/", > >>>>>>>>>>>>> > >>>>>>>>>>>>> "org.apache.cxf.rs.in.interceptors=org.apache.cxf.intercep > >>>>>>>>>>>>> to > >>>>>>>>>>>>> r.LoggingInInterceptor", > >>>>>>>>>>>>> > >>>>>>>>>>>>> "org.apache.cxf.rs.in.interceptors=org.apache.cxf.intercep > >>>>>>>>>>>>> to > >>>>>>>>>>>>> r.LoggingOutInterceptor" > >>>>>>>>>>>>> }) > >>>>>>>>>>>>> public class SimpleEndPointsImpl implements > >>>>>>>>>>>>> SimpleEndPoints { > >>>>>>>>>>>>> > >>>>>>>>>>>>> private BusinessService businessService; > >>>>>>>>>>>>> private static org.slf4j.Logger logger = > >>>>>>>>>>>>> LoggerFactory.getLogger(BackendDaoServiceUtil.class); > >>>>>>>>>>>>> > >>>>>>>>>>>>> /** > >>>>>>>>>>>>> * @return Gives a full list of campaigns in the system > >>>>>>>>>>>>> */ > >>>>>>>>>>>>> @Path("/fullcampaigns") > >>>>>>>>>>>>> @GET > >>>>>>>>>>>>> @Produces({MediaType.APPLICATION_JSON, > >>>>>>>>>>>>> MediaType.APPLICATION_XML}) > >>>>>>>>>>>>> @Override > >>>>>>>>>>>>> public List<FullCampaign> getAllCampaignsStatus() > >>>>>>>>>>>>> throws CiscoAPIException, FailedSecurityException { > >>>>>>>>>>>>> return businessService.getFullCampaigns(); > >>>>>>>>>>>>> } > >>>>>>>>>>>>> > >>>>>>>>>>>>> > >>>>>>>>>>>>> On Thu, Apr 6, 2017 at 9:54 AM, nino martinez wael < > >>>>>>>>>>>>> [email protected]> wrote: > >>>>>>>>>>>>> > >>>>>>>>>>>>> I will test it now.. > >>>>>>>>>>>>> > >>>>>>>>>>>>> > >>>>>>>>>>>>> On Thu, Apr 6, 2017 at 9:09 AM, Christian Schneider < > >>>>>>>>>>>>>> [email protected]> wrote: > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> The Swagger integration provides a feature. So adding > >>>>>>>>>>>>>> this should be > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> quite similar to adding the Jackson provider. > >>>>>>>>>>>>>> > >>>>>>>>>>>>>>> You create an intent service like this: > >>>>>>>>>>>>>>> https://github.com/apache/cxf-dosgi/blob/master/samples/ > >>>>>>>>>>>>>>> rest > >>>>>>>>>>>>>>> /impl-jackson/src/main/java/org/apache/cxf/dosgi/samples > >>>>>>>>>>>>>>> /res t/impl/JacksonIntent.java > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> and add it to the service: > >>>>>>>>>>>>>>> https://github.com/apache/cxf-dosgi/blob/master/samples/ > >>>>>>>>>>>>>>> rest > >>>>>>>>>>>>>>> /impl-jackson/src/main/java/org/apache/cxf/dosgi/samples > >>>>>>>>>>>>>>> /res > >>>>>>>>>>>>>>> t/impl/TaskResourceImpl.java#L36 > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> Can you test this and give Feedback if it works. > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> I also thought about supporting the @Features annotation > >>>>>>>>>>>>>>> on DOSGi service to provide a simple way to add > >>>>>>>>>>>>>>> features that do not need additional config. > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> Christian > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> On 06.04.2017 08:04, nino martinez wael wrote: > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> Hi Guys > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> I've been contemplating on documentation. Currently > >>>>>>>>>>>>>>> we've gone > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> down the > >>>>>>>>>>>>>>>> offline documentation road, using enunciate[1] while it > >>>>>>>>>>>>>>>> feels okay I've seen that CXF supports other directions > >>>>>>>>>>>>>>>> natively[2]. I am wondering if its possible to use > >>>>>>>>>>>>>>>> those with DOSGI? > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> [1]http://enunciate.webcohesion.com/ > >>>>>>>>>>>>>>>> [2]http://cxf.apache.org/docs/swagger2feature.html > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> -- > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> Christian Schneider > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> http://www.liquid-reality.de > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> Open Source Architect > >>>>>>>>>>>>>>> http://www.talend.com > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> -- > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> Best regards / Med venlig hilsen > >>>>>>>>>>>>>> Nino Martinez > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> -- > >>>>>>>>>>>>>> > >>>>>>>>>>>>> Christian Schneider > >>>>>>>>>>>> http://www.liquid-reality.de > >>>>>>>>>>>> > >>>>>>>>>>>> Open Source Architect > >>>>>>>>>>>> http://www.talend.com > >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>> -- > >>>>>>>>> Sergey Beryozkin > >>>>>>>>> > >>>>>>>>> Talend Community Coders > >>>>>>>>> http://coders.talend.com/ > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > >>>>>>>> -- > >>>>>>>> Best regards / Med venlig hilsen Nino Martinez > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> -- > >>>>>>> Best regards / Med venlig hilsen > >>>>>>> Nino Martinez > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>> > >>>>>> > >>>>> -- > >>>> Sergey Beryozkin > >>>> > >>>> Talend Community Coders > >>>> http://coders.talend.com/ > >>>> > >>>> > >>> > >>> > >> > >> > > > > -- > > Christian Schneider > > http://www.liquid-reality.de > > > > Open Source Architect > > http://www.talend.com > > > >
