Swagger-Core with Tomcat and JAX-RS / CXF

160 views
Skip to first unread message

Lucas Crawford

unread,
Jul 29, 2015, 5:54:41 PM7/29/15
to Swagger
So I am trying to setup my company's API with Swagger using a bottom-up approach (automate documentation of our already existing API), and I am a little lost on how to setup Swagger with JAX-RS / CXF. Following this sample: https://github.com/swagger-api/swagger-samples/tree/master/java/java-jaxrs-cxf I implemented everything that was requested but I am not getting this to work.
 
I have the following questions:

1) Is Swagger supposed to just generate the index.html / js / css itself when deployed on say, tomcat?

2) How do I set the swagger.api.basepath to a location other than localhost? My tomcat server is running on one of my companies VM's (i.e. https://10.222.23.123). I tried setting the basepath to both this and localhost, but still no signs of it working when accessing either https://<ip-address>/api/swagger.json or http:localhost:8080/api/swagger.json

Aki Yoshida

unread,
Jul 31, 2015, 10:40:37 AM7/31/15
to swagger-sw...@googlegroups.com
1. I think a short answer would be to say that swagger generates the
swagger API document that can be displayed nicely using its UI (.i.e,
its index page).

2. In swagger 2.0 (the version used in the sample that you referred
to), the baspath property represents only the path and not the whole
url. The host property represents the host and port part.
https://github.com/swagger-api/swagger-samples/blob/master/java/java-jaxrs-cxf/src/main/resources/applicationContext.xml#L44-L45

By the way, CXF version 3.0.6 that will be released shortly, you can
use swagger 2.0 out of the box by activating its swagger2 feature.
(previously only swagger 1.2 was supported in this way).
> --
> You received this message because you are subscribed to the Google Groups
> "Swagger" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to swagger-swaggers...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Ron Ratovsky

unread,
Jul 31, 2015, 10:53:12 AM7/31/15
to Swagger
Aki,

Thanks for taking the time to reply.
We should have probably updated here that we resolved the issue online on IRC.

Thanks,
Ron
--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------
Reply all
Reply to author
Forward
0 new messages