Dongfeng Lu created CXF-7722:
--------------------------------

             Summary: CXF Swagger2Feature does not show methods if context root 
is not empty.
                 Key: CXF-7722
                 URL: https://issues.apache.org/jira/browse/CXF-7722
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
         Environment: Eclipse Oxygen, Tomcat 8.0.32, CXF 3.1.11, Spring 
4.3.9-RELEASE
            Reporter: Dongfeng Lu
         Attachments: CxfSwaggerIssue_XML_Config.zip, Figure 1.png, Figure 2.png

We are using CXF 3.1.11, the project is developed and deployed to Tomcat in 
Eclipse.

We have been using CXF for a long time, and all of our REST services are 
configured via XML's <jaxrs:server>. We are trying to add Swagger2Feature to 
the project, and here is an example of a configuration file.

 
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xmlns:jaxrs="http://cxf.apache.org/jaxrs"; 
xmlns:p="http://www.springframework.org/schema/p";
 xmlns:c="http://www.springframework.org/schema/c"; 
xmlns:context="http://www.springframework.org/schema/context";
 xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
 http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
 http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-3.2.xsd";>
<!-- Service beans -->
 <bean id="restServiceOneServer" 
class="com.example.api.serverOne.impl.OneServerImpl" />
<!-- Authentication wrappers -->
 <bean id="restServiceOneServerAuth"
 class="org.apache.cxf.interceptor.security.SecureAnnotationsInterceptor"
 p:securedObject-ref="restServiceOneServer" />
<!-- CXF Swagger2Feature -->
 <bean id="swagger2Feature_oneServer" 
class="org.apache.cxf.jaxrs.swagger.Swagger2Feature" >
 <property name="title" value="One Server" />
 <property name="usePathBasedConfig" value="true"/>
 </bean>
<!-- REST server -->
 <jaxrs:server
 address="/oneServer" id="oneServerServiceREST">
 <jaxrs:serviceBeans>
 <ref bean="restServiceOneServer" />
 </jaxrs:serviceBeans>
 <jaxrs:features>
 <ref bean="swagger2Feature_oneServer" />
 </jaxrs:features>
 <jaxrs:providers>
 <ref bean="jsonProvider" />
 <ref bean="wadlProvider" />
 <bean class="org.apache.cxf.jaxrs.security.SimpleAuthorizingFilter"
 p:interceptor-ref="restServiceOneServerAuth" />
 </jaxrs:providers>
 </jaxrs:server>
</beans>
{code}
 

We deployed it to Tomcat in Eclipse under the context root "/example". Figure 1 
shows the screenshot, which does not display any method.

If we deploy it with an empty context root "", we see methods as shown in 
"Figure 2". This is a good, however, we do need use a non-empty context root, 
as we are building a WAR file, and that WAR file is supposed to work under any 
context root. How should we do that?

The attached project has the code to reproduce the above finding. It is an ANT 
+ Ivy project.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to