如何为 REST Web 服务发布 javadoc 而不是 index.jsp 页面
我想知道客户端是否可以访问我的 Web 服务,而不是显示正常的 index.jsp 页面(并列出此处可用的内容等),我可以让它显示通过 Web 服务可用的方法的 javadoc。一般来说,我对 REST / webservices 相当陌生,但我正在使用 myeclipse,并且我确实知道当前它正在通过 web.xml
文件访问 index.jsp 页面,如下所示
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
:这是为了不必花费大量时间创建一个欢迎页面来显示通过我的网络服务可用的每种方法,而是尝试使其自动化/使其更具可读性。
任何帮助将不胜感激,如果需要更多清晰度/信息,我将很乐意添加它。谢谢。
编辑:
我最终只是导出为 javadoc 并仅选择我需要的文件/仅选择公共方法。然后将创建的 doc 文件夹放入 webroot 中,并编辑 web.xml 并将
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
,以便它知道相对于 doc 文件夹而不是 webroot 进行搜索。
I was wondering if it is possible for a client to hit my webservice and instead of it showing the normal index.jsp page (and list off what is available etc here) I can instead have it show the javadocs from methods available through the webservice. I am quite new to REST / webservices in general, but I am using myeclipse and I do know that currently it is accessing the index.jsp page through the web.xml
file like so:
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
The main goal of this is to not have to spend lots of time creating a welcome page that shows each of the methods available through my webservice, but instead try to automate it / make it more readable.
Any help would be appreciated, and if more clarity / information is required I will be glad to add it. Thanks.
edit:
I ended up just exporting as javadoc and selecting only the files I needed / only the public methods. Then placed the created doc folder inside of the webroot and edited the web.xml to
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
and placed <FRAME src="doc/
in front of the normal path in the index.html as well as Link to<A HREF="doc/
so that it knew to search relative to the doc folder instead of the webroot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您为所有页面生成 javadoc (有一些优秀的工具可以做到这一点,甚至可以集成到 Maven 构建系统中)您可以轻松地将这些页面直接映射到您的 Web 应用程序中。因此,您不是显示您的index.jsp,而是显示生成的javadoc 中的index.html。
If you generate a javadoc for all your pages (there are excellent tools out there to do that, even integrated into the maven build system) you can easily map those pages into your web app directly. So instead of displaying your index.jsp, you display the index.html from the generated javadocs.
不确定 Javadocs,但您是否考虑过使用 WADL 文件来描述您的服务?
如果您使用的是 Jersey,本文可能会有所帮助:
http://wikis.sun.com/display /泽西岛/如何配置扩展WADL
Not sure about the Javadocs, but have you considered a WADL file to describe your services?
If you're using Jersey, this article may help:
http://wikis.sun.com/display/Jersey/HowToConfigureExtendedWADL