Hi. We have been using CXF for a long time, and we would like to add Swagger 2 
to our project. However, I have been having a hard time doing it. I have been 
searching on the web for a couple of days, but I still cannot figure it out. I 
need help.
For easy communication, I have build a sample project to illustrate my issue. 
You can unzip it and run "mvn clean tomcat7:run" in the directory, and then you 
can access it with "http://localhost:8080"; to display the two REST services, 
built on two org.apache.cxf.endpoint.Servers.
If I comment out "feature.setUsePathBasedConfig(Boolean.TRUE);" in both 
"OneServerConfig.java" and "TwoServerConfig.java", then both 
"http://localhost:8080/oneServer/api-docs?url=/oneServer/swagger.json"; and 
"http://localhost:8080/twoServer/api-docs?url=/twoServer/swagger.json"; display 
the same thing, which is the API on "twoServer" with the actual API showing. I 
can show/hide the API to show the two methods, "/two" and "/two/feed". Why do 
they display the same thing?
If I enable "feature.setUsePathBasedConfig(Boolean.TRUE);" in both 
"OneServerConfig.java" and "TwoServerConfig.java", then 
"http://localhost:8080/oneServer/api-docs?url=/oneServer/swagger.json"; displays 
a page titled correctly with "oneServer", while 
"http://localhost:8080/twoServer/api-docs?url=/twoServer/swagger.json"; displays 
a page titled correctly with "twoServer". Seems correct, but both pages do not 
have any method, and I don't even see the "Show/Hide" link. Where does those 
methods go?
Of course, we want each link to display its own Swagger information correctly, 
with all available methods. What have I been doing wrong? Please help. Thanks 
in advance.
Dongfeng

<<attachment: CxfSwaggerIssue.zip>>



Reply via email to