WEB4J Developer Tools
These tools do not use a database. Rather, they store data in session scope, and use a number of settings in web.xml. The source code is provided, under a BSD open source license. You may alter the implementation to more closely suit your needs.
Log ViewerView and query log files in your browser.
The Log Viewer is very useful for debugging. It automatically accesses the most recent log file in a directory, so it always has the most recent logging information. Repeatedly vewing the most recent entries is as simple as a browser refresh.
- view and query parsed log records
- view raw logs in plain text
- graph the relative frequency of the all log levels
- extract down-time intervals from logs
The assumed format of logs is that of default JDK loggers. If you have not altered the output format of JDK logging (which is usually the case), then you may use it immediately. If your log files are in a different format, then you will need to provide an implementation of LogParser. (This is not a difficult task, and you may use existing code as a guide.)
Viewing the parsed records is both more pleasing to the eye, and more flexible, since multiple criteria can be entered in a query.
Source Code StatsHigh level stats and metrics for your code.
Simple source code analysis let's you see the big picture.
- total lines of code
- breakdown per file extension: total lines, average lines, number of files
- histogram showing size distribution of your .java files
- sortable listing of all files, with links to each file
- files with low number of comments
- percentage of your classes that are unit tests
- list each jar's specification name and version number
- find files containing tab characters
- remove all tab characters in your source
- list all images and the files that reference them
- find unused images
Code GeneratorSave typing effort with a code generator.
Although WEB4J does a good job of removing repeated code from your application, there are still items which are somewhat repetitive :
- the toString, equals, and hashCode methods in Model Objects
- the various items related to Model Object fields - declarations, getXXX methods, and so on
- declarations of SqlId fields
- declarations of RequestParameter fields
Items are generated and displayed in plain text. In addition, settings in web.xml allow saving the generated items directly to your file system as a side-effect.
Getting Started With WEB4J Developer Tools
Before getting started, please review the README file inside web4j-tools.zip. Note that you must supply two jars :
- junit.jar for unit testing
- tools.jar, for javadoc taglets. This jar comes with the JDK, and is located in your JDK_HOME\bin\ directory.
There are two ways to use the WEB4J Developer Tools :
- just run it as a regular web app, by installing the provided web4jtools.war file
- run it directly from the (compiled) source directory, without using the .war file. The .class files are included in the .zip, so you don't need to immediately compile the source. This second style is used when you wish to examine or extend the implementation.
Here is an example of the first style, running web4jtools.war as a regular web application under Tomcat 5:
- Place the web4jtools.war file in [TOMCAT_HOME]\webapps\.
- Start Tomcat. This will simply cause Tomcat to explode the .war file.
- Edit [TOMCAT_HOME]\webapps\web4jtools\WEB-INF\web.xml to suit your environment.
- Restart the app to pull in your edits to web.xml.
- Navigate to http://localhost:8080/web4jtools/. (If your Tomcat port is not 8080, then amend as needed.) If you encounter a problem, review the server logs under [TOMCAT_HOME]\logs\, and check your edits to web.xml.
- Click on the 'Help' menu item to list hints and advice at the top of each page.
Here is an example of the second style of installation. It installs to C:\projects\web4jtools\, and uses Tomcat 5.
1. Unzip web4j-tools.zip to C:\projects\web4jtools\. The file structure will look like:
C:\projects\web4jtools\ codegenerator\ images\ logview\ metrics\ WEB-INF\ webmaster\ build.xml Error.jsp ...
2. Make an entry in Tomcat's [TOMCAT_HOME]\conf\server.xml file, to map the path '/web4jtools' to the source directory :
<Context path="/web4jtools" docBase="C:\projects\web4jtools" reloadable="true" > </Context>
3. Configure C:\projects\web4jtools\WEB-INF\web.xml to suit your environment.
4. Start Tomcat and navigate to (assuming the Tomcat port is 8080):
5. Click on the 'Help' menu item to list hints and advice at the top of each page.