问题
Is there any way to automatically generate wadl file for cxf?
Iam having a class that takes all requests like @Path("/") and then redirect to its implementation class. I want to generate wadl for it. Is this possible?
I have done this http://{localhost}:8080/api/?_wadl but Iam getting
<resources base="http://{localhost}:8080/api">
<resource path="/">
<!-- Dynamic subresource -->
<resource path="/"/>
</resource>
</resources>
回答1:
I don't think that is possible. What you did is dynamic, cxf doesn't know where the request will be directed to. Make sure all services have their own paths, so that you could provide wadl for those services.
回答2:
Try the following url and it should work, cxf has this ability to generate wadl itself. http://{IP}:{PORT}/{PROJECT-CONTEXT}/{CXF SERVLET CONTEXT}/?_wadl
for eg in my case it is http://localhost:8080/demo-web/api/?_wadl
回答3:
I know this is kind of old, but it was driving me crazy. If you are not returning an object as your subresource, this should do the trick:
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.setStaticSubresourceResolution(true);
Just make sure to enable static subresource resolution before you set your service beans :)
来源:https://stackoverflow.com/questions/19006119/generate-wadl-for-apache-cxf