This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org
ESAPI Javadocs
How to create Javadocs for ESAPI using Eclipse v3.4
First off, notice a folder called "javadoc resources" in the root directory of your ESAPI project. This folder contains images referenced from the Javadoc as well as overview-summary.html, which is the title page for the ESAPI Javadoc. The instructions below make reference to these files.
To Generate Javadocs
- Be sure you are in the Java EE perspective. To change your perspective, click the Window button on the main toolbar. Then click Open Perspective and choose Java EE. If Java EE is not in the list, select Other.. and find Java EE. If Java EE is not in the list under Other, you may need to download Eclipse Ganymede (v3.4) for Java EE developers. Javadoc creation functionality may be built into your version of Eclipse, but that has not been tested.
- Then, click the Project button on the main toolbar. Select Generate Javadoc...
- Find the Javadoc executable to use. This is usually javadoc.exe within your java bin directory, as shown in figure 1.
- Select the ESAPI source, but not the test files within your ESAPI project, as shown in figure 1.
- You should create Javadoc for members with visibility: Package, as shown in figure 1.
- Select the Javadoc output directory. This will likely be /doc under your ESAPI project folder.
- Click Next.
Figure 1:
- Designate a title for this Javadoc. Generally, this should be "OWASP Enterprise Security API (ESAPI)".
- Use Default: Under Basic Options, make sure all checkboxes are selected, as shown in Figure 2.
- Use Default: Make sure Javadocs for referenced archives are not generated, as shown in Figure 2.
- Use Default: No custom style sheet should be specified, as shown in Figure 2.
- Click Next.
Figure 2:
- The Overview page must be selected, as shown in Figure 3. It should point to overview-summary.html in the javadoc resources folder.
- Use Default: The JRE source compatibility should be selected as 1.4, as shown in Figure 3.
- Click Finish.
Figure 3:
- If it isn't already there, copy the folder "doc-files" from "javadoc resources" to org/owasp/esapi within your new javadoc directory.
- To view these new javadocs, double click on: <yourdocsfolder>/index.html
Submitting these new javadocs to SVN
- To submit these newly generated javadocs, simply use Team --> Commit in Eclipse. Note: Please check in updates into the existing /doc directory, rather than creating a new directory.
- If you receive version control errors during the submit, follow the following steps:
- Navigate to your ESAPI Project/javadoc/org/owasp/esapi/doc-files directory.
- Delete the folder called .svn from this folder and all subdirectories (wiki).
- In the Navigator view in Eclipse, Right-click the doc-files folder and select "Team" -> "Add to svn:ignore...".
- In the Navigator view in Eclipse, Right-click the doc-files folder again and select "Team" -> "Add to Version Control". You should receive a message saying that you previously asked to ignore this file. Click yes.
Why do my newly generated Javadocs render as plain text in my browser?
Unfortunately, using this method of Javadoc generation does not set MIME types for the HTML files generated. This means that to the browser, your HTML files are just text files, and will display as such. Luckily Subclipse has a function to fix this. We are going to tell Subclipse to automatically set the MIME type of HTML files to text/html and the MIME type of CSS files to text/css every time it commits a change.
- The first thing you need to do is enable auto properties for your SVN client. If you do not enable auto properties, you will have to manually set the properties (MIME type) of every HTML and CSS file.
- In Windows, open a terminal by typing "cmd" (with no quotes) into "Run" on the Start menu. If you are using Vista, you can type "cmd" directly into the "Start Searching" bar.
- Type (again, and from now on, with no quotes) "cd %APPDATA%" and hit enter.
- Type "cd Subversion" and hit enter.
- Type "notepad config". This will open the SVN configuration file in notepad.
- Find the line "enable-auto-props = yes" and remove the # from the front of it. This enables auto properties.
- Then, tell Subversion which MIME types to set for which files:
- Towards the bottom of the file, find a section called [auto-props]. Add the following to this section:
*.html = svn:mime-type=text/html *.css = svn:mime-type=text/css
- Save the file.
Any further commits to the SVN should set the MIME type properly.
Your Javadoc should be ready to commit and view!