我可以使用 RESTeasy 获取 application.wadl 文件吗?
我需要获取 RESTful 服务的 WADL 文件。我知道如果使用球衣,它可以作为 http://localhost:8080/application.wadl
提供。但我使用 RESTeasy。
我可以在我的框架案例中做同样的事情吗?
I need to get WADL file for RESTful service. I know that in case using jersey it's available as http://localhost:8080/application.wadl
. But I use RESTeasy.
Can I do the same in my framework case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
最新版本:
引用 第 49 章 RESTEasy WADL 支持:
旧版本的解决方法
有一个解决方法:jersey 人员名为
maven-wadl-plugin
的 Maven 插件,它也可以为使用 RESTEasy 编码的服务生成 WADL。以下是如何使用它。
1. 将其添加到您的
pom.xml
中:注意
baseUri
和packagesResourceConfig
元素。您必须更改它们以反映您的项目的配置。您可能还想更改插件的版本(我使用的是 1.17)。2. 创建一个/doc文件夹并添加一些文件。
创建 src/main/doc/ 文件夹并创建以下两个文件。
文件:application-doc.xml
内容:
文件:application-grammars.xml
内容:
3. 运行maven 命令。
转到项目文件夹并运行以下命令:
文件
\target\classes\application.wadl
(WADL 本身)和\target\classes\xsd0.xsd
(应该生成资源的架构 - 它由 application.wadl 使用。根据需要编辑和使用它们。
PS.:请记住,这是 maven-wadl-plugin 的一个非常简单的使用。它可以做更多的事情。要更好地了解它,请参阅 http://search.maven.org/remotecontent?filepath=com/sun/jersey/samples/generate-wadl/1.12/generate-wadl-1.12-project.zip< /a>
Latest versions:
Quoting Chapter 49. RESTEasy WADL Support:
Workaround for Older versions
There is a workaround: a maven plugin called
maven-wadl-plugin
by the jersey folks that also works to generate WADL for services coded using RESTEasy.Here's how to use it.
1. Add this to your
pom.xml
:Pay attention to the
baseUri
andpackagesResourceConfig
elements. You have to change them to reflect your project's configuration. You may also want to change the plugin's version (I used 1.17).2. Create a /doc folder and add some files.
Create the
src/main/doc/
folder and create the two files below.File: application-doc.xml
Content:
File: application-grammars.xml
Content:
3. Run the maven command.
Go to the project folder and run the following command:
The files
\target\classes\application.wadl
(the WADL itself) and\target\classes\xsd0.xsd
(the schema of the resources - it's used by the application.wadl) should be generated.Edit and use them as you wish.
PS.: Bear in mind that this is a very simple use of the maven-wadl-plugin. It can do a lot more. To know it better, please refer to the zip file in http://search.maven.org/remotecontent?filepath=com/sun/jersey/samples/generate-wadl/1.12/generate-wadl-1.12-project.zip
RESTeasy 中的 WADL 生成功能尚未实现。如果你想要的话,就去投票吧。
https://issues.jboss.org/browse/RESTEASY-166
WADL generation in RESTeasy is a feature not yet implemented. If you want it go vote for it.
https://issues.jboss.org/browse/RESTEASY-166
请参阅 RESTEasy WADL 支持 (3.1 .0)。下面的片段是从那里复制的。
它使用
ResteasyWadlServlet
并使 WADL 可在/application.xml
中访问。注意:
Rex 和 Jaskirat 之前已经提到 RESTEASY-166 用于管理这个功能。看来这已经在 3.0.14 完成了。
See RESTEasy WADL Support (3.1.0). The snipped below is copied from there
This uses the
ResteasyWadlServlet
and will make the WADL accessible at/application.xml
.Note:
Rex and Jaskirat have already mentioned previously that RESTEASY-166 was used to manage the implementation for this feature. It seems this was completed in 3.0.14.
我们可以在 maven 项目的帮助下使用 POM.XML
https://issues.jboss 生成一个 wadl。 org/browse/RESTEASY-166 检查这里的评论..!!
we can generate a wadl with the help of maven project with POM.XML
https://issues.jboss.org/browse/RESTEASY-166 check the comments here..!!