NetBeans IDE provides a built-in HTTP Monitor to help isolate problems with data flow
from JSP and servlet execution on a Web server. There is no need to add logic to your Web
application to trace HTTP requests and associated state information. The NetBeans IDE built-in
HTTP Monitor can do this for you.
When the IDE is configured with a Web container or a Web application is deployed with a
NetBeans HTTP Monitor servlet filter and filter mapping, the HTTP Monitor will automatically
record all HTTP requests made to the Web container. For each HTTP request that is processed
by the Web container, the HTTP Monitor not only records the request, it also records state
information maintained in the Web container.
By using the HTTP Monitor, you can analyze HTTP requests, and store HTTP GET and
HTTP POST requests for future analysis sessions. You can also edit these stored requests and
replay them. This is a powerful feature to help isolate data flow and state information passed
within an HTTP request to a Web container. HTTP requests are stored until you exit the IDE
unless you explicitly save them.
Right-click the project's Libraries node in the Projects window. Choose Add JAR/Folder and add the following JARs:
Build the project. When you build a standard project, the JARs get moved to the build/web/WEB-INF/lib folder. This is very important to know because, when you build the project to JBoss's deployment directory, at the end of these instructions, you must include these JAR files. Knowing the exact location to which the IDE moves the JAR files allows you to create the appropriate Ant build script to copy them to JBoss.
In the IDE, go to the web.xml file and double-click it. The cool (new in NetBeans IDE 4.1) web.xml Visual Editor opens in the Source Editor. Go to the Filters tab at the top of the editor, click Add Filter Element, and add the following values:
Click OK, click on Add in the "Initialization Parameters" subsection, and add the following values:
To find out the port of the internal HTTP Server, go to the Runtime window, right-click the HTTP Server node, choose Properties, et voila, there it is. For me, it is set to 8086 (probably the default, at least for Windows).
Click OK, click on the Filter Mappings header below, click Add, and add the following values:
Click OK. You should now have the following in the web.xml Visual Editor:
And when you click XML at the top of the editor, the following will be included in the web.xml file:
Go to the Runtime window, right-click the HTTP Server, and click Start Server.
Now build and deploy your application to JBoss. Remember that you need the JAR files that you picked up in step 1 to be included with the resources that you've copied to JBoss's deployment directory! When you run the application, the HTTP Monitor will start up in the IDE:
Now you can do any and all of the following:
Two very important notes:
A good application to test all of this out on is the "Midnight Cookie" application, which is what you end up with at the end of the NetBeans IDE 4.1 Tutorial for Web Applications. In fact, the second part of that tutorial provides extensive information, including many screenshots, on the various things you can do with the HTTP Monitor.