REST Api documentation for Apache CXF application - rest

We use Apache CXF in our application with jax-rs to build REST Api. As of now, there is no documentation about the various endpoints available and is deployed on Tomcat 8.5 server.
I have done some R&D on how to find a solution. I understand that Swagger can be used.
But, I did not find enough documentation to user swagger with Apache CXF.
I understand that these type of questions are prohibited in the site. At the same time, I am not sure which chat room to use for this purpose.
Any information on this would help me a lot.

Depending on the CXF version that you are using, I would suggest to use OpenApiFeature (OpenAPI is newer than Swagger) as described here: http://cxf.apache.org/docs/openapifeature.html
You can also find multiple sample projects with Swagger or OpenAPI here: https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs

Related

Using Hawkular for Rest services built using CXF

I am new to Distributed Tracing / Hawkular. And would like to experiment tracing for my distributed cxf rest services using hawkular.
Will it be possible to trace cxf servcies using hawkular and if any one has doc or reference sample app, that will be great.
Also, is there any other tracing tool which can solve this requirement(tracing java cxf rest services). Zipkin-brave has a feature for this which I am looking at also.
I'd recommend instrumenting your application using the OpenTracing API, and later choose a concrete implementation. Under the Hawkular project, there's the Hawkular APM module which provides a solution for capturing, visualizing and making sense of the data. However, we (Hawkular APM) recently decided to join the Jaeger project, to have a better support for the OpenTracing case. We expect to have similar features from Hawkular APM ported to Jaeger "soon".
For OpenTracing, there are quite a few "framework integrations" under the OpenTracing Contrib organization, including JAX-RS, which might serve as base or reference for a CXF-specific implementation. If nothing suits you, I'm certain we'd welcome a contribution.
If you are just looking to learn OpenTracing, I'd suggest taking a look at the Hawkular APM's example directory, including a vertx-opentracing example.

How does using the javax.ws.rs-api-2.0.jar works at runtime as it is only the API

We were working on creating a RESTful service. We have thought of using frameworks like jersey or cxf. But apparently we found that just using the javax.ws.rs-api-2.0.jar and the related annotations, we can get the service working.
Question is:
How does it work? Is it dependent on the application servers?
What if we application server does not support or have the implementation of the API?
If it is dependent on application servers, can I find out the library which the server is using especially tomcat?
EDIT 1
This question is invalid. javax.ws.rs-api-2.0.jar is just an API. Using this jar does not suffice. It will not give compilation errors.
But at run-time, you need providers which will implement the rs-api. And thus we need the frameworks like jersey or cxf.
In our application, these jars were added to the war during ant-build from external location and that is why it confused us.
I am closing this question.

JAX-RS Frameworks with Client Caching

Do RESTEasy, Jersey or Restlet integrate client sided caching?
I read something about a CacheClient for Jersey
Is that an official implementation? If not, are they working on Client Caching for Jersey 2.0? Can someone confirm this?
For Resteasy I read here something about official client sided cache control.
Im not sure about Restlet. Are there some official good solutions?
Regarding Restlet, we are planning to add a caching service in version 2.2. That will benefit the JAX-RS extension as well.
See our detailled roadmap here.

Manage UDDI registry with CXF

I have an application using Apache CXF with a lots of SOAP services implemented. So, i would like to use the "service registry" concept and then, i´d hear about UDDI, but i dont know how to implemented that.
Is Apache CXF already composed by an API to deploy UDDI engine or should i fix another library to do that?
Take a look at JUDDI:
http://juddi.apache.org/
which is a UDDI service. The latest version is written to JAX-WS and is tested by default with CXF.
To add, jUDDI has a neat way to automate the registration of web services using annotations and a servlet startup listener.
Source: http://svn.apache.org/repos/asf/juddi/trunk/juddi-examples/uddi-annotations/

Define WADL resources base in Jersey

I am using Jersey 1.9 and it is generating my WADL perfectly except I need to redefine the resources base URI.
I'm running Jetty 7 sitting behind Apache using mod_proxy as a reverse proxy to route REST requests back to Jetty / Jersey. So Jersey generates the resources base URI as
http://localhost:8080/testRestAPI/rest/
when I need something like
http://mydomain.com/rest/
I found this from Google but it is not working: http://jersey.576304.n2.nabble.com/Changing-baseURI-when-generating-WADL-td6169703.html
unfortunately, you've found a bug in Jersey implementation. Please file a new issue as stated on mailing list - jira link: http://java.net/jira/browse/JERSEY
What you can do for now is downgrade to Jersey 1.8, which should not be affected by latest changes in this area. Thanks and sorry for inconvenience!
EDIT: issue link: http://java.net/jira/browse/JERSEY-773
it is already fixed, so you should be able to use this feature in Jersey 1.10-b02 and newer.