cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nino martinez wael <nino.martinez.w...@gmail.com>
Subject Re: DOSGI 2 prefered documentation technique?
Date Thu, 06 Apr 2017 13:12:17 GMT
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 <chris@die-schneider.net
> 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=/dialer/v1/",
>>
>> "org.apache.cxf.rs.in.interceptors=org.apache.cxf.intercepto
>> r.LoggingInInterceptor",
>>
>> "org.apache.cxf.rs.in.interceptors=org.apache.cxf.intercepto
>> 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 <
>> nino.martinez.wael@gmail.com> wrote:
>>
>> I will test it now..
>>>
>>>
>>> On Thu, Apr 6, 2017 at 9:09 AM, Christian Schneider <
>>> chris@die-schneider.net> 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
>
>


-- 
Best regards / Med venlig hilsen
Nino Martinez

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message