Generate Wadl for apache cxf

江枫思渺然 提交于 2019-12-24 12:14:28

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!