• Post Reply Bookmark Topic Watch Topic
  • New Topic

javadoc question  RSS feed

 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

This is probably the wrong forum, but I have no idea where else to post this.

I have an abstract servlet class that implements the service() method and calls doGet() and doPost() depending on request.getMethod(). The rest of my servlets extend this class and only implement doGet() and doPost(). However, when I generate the Javadocs for the classes, while they show the service method as a part of the concrete servlets, and don't even mention any methods being inherited from the abstract servlet. The methods inherited from HttpServlet and Servlet are shown correctly as inherited.

Is this supposed to happen?

Thank you,
Yuriy
 
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you provide some brief code snippets or add more details, I don't quite see what is missing from your javadoc.

I have an abstract servlet class that implements the service() method and calls doGet() and doPost() depending on request.getMethod(). The rest of my servlets extend this class and only implement doGet() and doPost().


Isn't that what the abstract class HttpServlet does? Java Documentation on HttpServlet says "Receives standard HTTP requests from the public service method and dispatches them to the doXXX methods defined in this class."


However, when I generate the Javadocs for the classes, while they show the service method as a part of the concrete servlets, and don't even mention any methods being inherited from the abstract servlet. The methods inherited from HttpServlet and Servlet are shown correctly as inherited.

Is this supposed to happen?


What methods are inherited from the abstract servlet that are not shown?
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for replying!

The abstract servlet is RequiredLoginServlet. Once fully implemented, the service method will make sure the user is logged in and only then call the doPost() or doGet() methods. If the user is not logged in, the response will be redirected to the login servlet. Every concrete servlet in the web app besides the LoginServlet requires for the user to be logged in, and extends RequiredLoginServlet. That way the code to check login status only needs to be in one place.

For example, the UserPreferencesServlet skeleton currently looks like this:



The generated javadocs for this servlet show the service() method under the Method Summary and Method Details sections along with doPost() and doGet(), instead of the "Methods inherited from" section where it belongs.

Interestingly enough, when using the pdfdoclet library to make a pdf version of the javadoc, the result puts "service" as inherited from RequiredLoginServlet.

-Yuriy
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Weird. What command are you using?

Worked ok for me. I removed the package reference from the class you posted and created RequiredLoginServlet like this:



Command I'm using with jdk 1.4.2:

javadoc -d doc3 *.java

the javadoc for UserPreferencesServlet included this:

[ April 06, 2005: Message edited by: Carol Enderlin ]
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I actually used Eclipse's javadoc option, and the ant task derived from the pdf doclet example. The ant task is as follows:



Both the html javadocs resulted in the same problem. Two differences between my RequiredLoginServlet and the one you used is that mine is abstract and has default visibility. Could that have had something to do with it?
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just did it using the commandline javadoc like you, and still got the following:

 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It appears to be the default/package visibility. I noticed that the RequiredLoginServlet also isn't listed as a class (in "all classes" list and as well as in the hierarchy for the UserPreferencesServlet.


add -package to the command and the class is there and that service method is attributed to it. Or the class could be declared public.
[ April 06, 2005: Message edited by: Carol Enderlin ]
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All right, thank you for the help!

-Yuriy
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!