Search code examples
javaeclipserestjavadocjax-rs

How to publish javadoc instead of index.jsp page for a REST web service


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.


Solution

  • 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.