是否有类似Javadoc的工具从JAX-RS注释生成RESTful Web服务apidoc? [英] Are there javadoc-like tools to generate RESTful web service apidoc from JAX-RS annotations?

查看:145
本文介绍了是否有类似Javadoc的工具从JAX-RS注释生成RESTful Web服务apidoc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用资源上的JAX-RS注释开发与CXF的Web服务。这些注释指定参数名称,默认值和有效的输入和输出MIME类型。



可以在我的代码上运行一个javadoc-esque工具,以生成一个简洁的这个界面的文档,但我似乎找不到任何东西。



由javadoc本身生成的文档将需要太多的修剪,我真的想要一些理解JAX-RS注释的语义的东西,并生成对想要使用我的服务的开发人员。

解决方案

如果您正在构建Restful网络服务,则该文档称为 WADL 。 WADL基本上是Rest的WSDL版本。我使用泽西构建我的Restful Web服务。泽西根据资源包中的注释自动创建WADL。以下是泽西网站样本WADL的样子:
https://java.net/projects/jersey/sources/svn/show/trunk/jersey/samples/generate-wadl



最好的一部分是你绝对没有做任何事情。 :)当您更改资源类中的URI或参数注释时,它们将自动反映在本文档中。



TADAA! :)


I'm developing a web service with CXF by using JAX-RS annotations on resources. These annotations specify arguments names, default values, and the valid input and output mime types.

It'd be nice to be able to run a javadoc-esque tool on my code to generate a concise set of documentation of this interface, but I cannot seem to find anything.

The docs produced by javadoc itself would require too much trimming down, I really want something that understands the semantics of the JAX-RS annotations and generates something friendly to the devs who want to use my service.

解决方案

If you are building Restful webservices, the documentation is known as WADL. WADL is basically Rest's version of WSDL. I use Jersey to build my Restful web services. Jersey automatically creates the WADL based on the annotations you have in your resources package. Here's how the sample WADL looks like from Jersey's website: https://java.net/projects/jersey/sources/svn/show/trunk/jersey/samples/generate-wadl

The best part of this is you do absolutely nothing. :) When you change the URI or parameters annotation in your Resource classes, they will be automatically reflected in this documentation.

TADAA! :)

这篇关于是否有类似Javadoc的工具从JAX-RS注释生成RESTful Web服务apidoc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆