简体   繁体   English

为Apache CXF生成Wadl

[英]Generate Wadl for apache cxf

Is there any way to automatically generate wadl file for cxf? 有什么方法可以自动为cxf生成wadl文件吗?
Iam having a class that takes all requests like @Path("/") and then redirect to its implementation class. 我有一个类,它接受所有请求,例如@Path(“ /”),然后重定向到其实现类。 I want to generate wadl for it. 我想为此生成wadl。 Is this possible? 这可能吗?
I have done this http://{localhost}:8080/api/?_wadl but Iam getting 我已经完成了http:// {localhost}:8080 / api /?_ wadl,但是Iam正在

<resources base="http://{localhost}:8080/api">
    <resource path="/">
        <!--  Dynamic subresource  -->
        <resource path="/"/>
    </resource>
</resources>

Try the following url and it should work, cxf has this ability to generate wadl itself. 试试下面的URL,它应该可以工作,cxf具有生成wadl本身的能力。 http://{IP}:{PORT}/{PROJECT-CONTEXT}/{CXF SERVLET CONTEXT}/?_wadl http:// {IP}:{PORT} / {PROJECT-CONTEXT} / {CXF SERVLET CONTEXT} /?_ wadl

for eg in my case it is http://localhost:8080/demo-web/api/?_wadl 例如在我的情况下是http://localhost:8080/demo-web/api/?_wadl

I don't think that is possible. 我认为那是不可能的。 What you did is dynamic, cxf doesn't know where the request will be directed to. 您所做的是动态的,cxf不知道将请求定向到何处。 Make sure all services have their own paths, so that you could provide wadl for those services. 确保所有服务都有自己的路径,以便您可以为这些服务提供服务。

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 :) 只需在设置服务bean之前确保启用静态子资源解析即可:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM