> On Nov 2, 2023, at 11:42 AM, Veniamin Gvozdikov 
> <[email protected]> wrote:
> 
> I'm trying to use the CXF feature
> https://cxf.apache.org/docs/swagger2feature.html on fortress 3.0.0 to get
> API access over swagger interface. I've already added these lines but I
> don't understand where I need to turn the feature on in java code. Could
> you please give me some advice on this?
> 

A little progress.  Added the dependency to the pom

```
<dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
      <version>3.6.2</version>
</dependency>
```

And enabled the swagger feature in applicationContext.xml

```
<!-- CXF Swagger2Feature -->
<bean id="swagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
    <property name="basePath" value="/app/swaggerSample"/>
</bean>
```

Can build and deploy, but don’t know what to do next. I’m sure it can’t be this 
easy.

Also, the endpoint is secured so the container will enforce http basic auth.  
Not a show stopper just something that will have to be handled somehow.  

Still digging …

—
Shawn

> --- a/src/main/resources/applicationContext.xml
> +++ b/src/main/resources/applicationContext.xml
> @@ -46,6 +46,12 @@ under the License.
>     </bean>
> 
>     <bean id="fortressResponseInterceptor"
> class="org.apache.directory.fortress.rest.FortressResponseInterceptor"/>
> +
> +    <!-- CXF Swagger2Feature -->
> +    <bean id="swagger2Feature"
> class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
> +        <!-- customize some of the properties -->
> +        <property name="basePath" value="/app/swaggerSample"/>
> +    </bean>
> 
>     <jaxrs:server id="restContainer" address="/">
>         <jaxrs:serviceBeans>
> @@ -67,6 +73,11 @@ under the License.
>         <jaxrs:providers>
>            <ref bean="customJsonProvider"/>
>         </jaxrs:providers>
> +
> +        <!-- Swagger -->
> +        <jaxrs:features>
> +            <ref bean="swagger2Feature" />
> +        </jaxrs:features>
>     </jaxrs:server>
> 
> </beans>
> 
> -- 
> Regards,
> Veniamin


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to