如何使用 Jersey 1.7 生成 WADL 文件

2022-01-21 00:00:00 rest java jersey

我创建了一个 hello world REST 服务,现在我想生成 WADL 文件.

I created a hello world REST service and now I d like to generate the WADL file.

我环顾四周,发现我可以通过调用来做到这一点:

I looked around and saw that I can do so by calling :

http://localhost:8090/application.wadl

但是我没有得到任何东西.我正在使用带有 Eclipse Indigo 的 Jersey 1.7 并在 Apache 7 上运行

However I dont get anything in my case. I am using Jersey 1.7 with Eclipse Indigo and running on Apache 7

我也试过打电话:

http://localhost:8090/<myapplication_name>.wadl 但仍然没有结果.

Jersey 1.7 是否支持此功能?如果是,我做错了什么?

Is this feature supported by Jersey 1.7? If yes what do i do wrong?

web.xml 文件如下所示:

The web.xml file looks like this:

谢谢

推荐答案

你的应用在 Apache 中的名称是什么,即context"?假设名称是restApp".试试这个:

What is the name of your app in Apache, i.e., "context"? Assume the name is "restApp". Try this:

http://localhost:8090/restApp/application.wadl

或者,如果你的 servlet 映射是:

Or, if you servlet mapping is:

<servlet-mapping>
  <servlet-name>RESTService</servlet-name>
  <url-pattern>/company/rest/*</url-pattern>
</servlet-mapping>

..它会是:

http://localhost:8090/restApp/company/rest/application.wadl

相关文章