The Http Analyzer acts very similar to a network packet sniffer, allowing you to capture and inspect HTTP request and response pairs sent between a web client and web server.
One example where you would use the Http Analyzer is when developing ADF Faces applications in JDeveloper, where the Http Analyzer is sniffing the information flowing between your browser and the active FacesServlet in the Embedded OC4J. You can also use it between any web client request on your machine and any web server anywhere assuming you can normally connect to the service via your browser/local-machine.
There are other Http Analyzers out there, but given with JDeveloper its free and you don't have to download and install yet another tool.
Starting the Http Analyzer
I'll describe a typical scenario in developing an ADF Faces application and using the Http Analyzer to help describe how it's used.
I have an ADF Faces web application that is currently running in JDeveloper and displayed in my local browser at the following URL:
http://127.0.0.1:8988 is the port number the Embedded OC4J is currently listening on from my localhost. Accessing this sub-URL directly in my browser displays the Welcome page for the running Embedded OC4J server. The Embedded OC4J port number can be changed via the Tools -> Embedded OC4J Server Preferences menu option, selecting the Global -> Startup dialog options, then the HTTP field.
Next we open the Http Analyzer window via the View -> Http Analyzer menu option:
In order for the Http Analyzer to work we need to start a listener process, by selecting the Start Http Analyzer button (the green arrow button) in the Http Analyzer window. By default this will start the listener on your localhost's hostname on port 8098. These default settings can be changed via selecting the New Listener button in the Http Analyzer window:
In this example you can see the Http Analyzer listener process will be listening at the following URL: http://acute:8098 .... where acute is my localhost name. In turn the listener options configure any request to this URL will be redirected to the Target URL: http://127.0.0.1:8988
As this is the URL of my running Embedded OC4J server from previous, any access to the Http Analyzer listener at http://acute:8098 will be redirected to the Embedded OC4J URL at http://127.0.0.1:8988
Note when you run the Analyzer you may see a warning message. I'm still not sure why this message displays as the Analyzer appears to work regardless.
Now with the Http Analyzer listener running, if I change my original URL in my browser to use the Http Analyzer instead and load the page:
....I see two effects. First the ADF Faces web-page is correctly displayed in the browser from this alternative URL, and secondly the Http Analyzer window is now showing my first Http request-response as requested by my browser, and served via the FacesServlet running in my Embedded OC4J.
Using the Http Analyzer
This layout in the Http Analyzer is by default the history view. As you interact with your application through the browser, a number of request/responses in chronological order will display in the Http Analyzer history view.
The history view reveals a number of interesting elements:
- Call Time - the total time of the request/response in milliseconds
- Method - the type of Http request/response method
- Url - the specific URL that was requested
- Query - dunno
- Cookie - any cookies passed between the client to the server
- Status - the Http error code
- Set-Cookie - any cookies set by the server and passed to the client
- Type - type of request, for example Html, Images etc
- Size - the size of the response in bytes
From here you may select a specific request/response and switch the Http Analyzer into the data view. You do this by double clicking on one of the entries in the history view, or selecting the Data tab at the bottom of the Http Analyzer window.
The data view is divided vertically into 2 areas, on the left hand-side the request sent from the client to the server, and on the right hand-side the response from server to the client.
If for both areas the Show Headers checkbox is also checked, the window is further divided horizontally showing on top the Http header information passed between the client and server on each request/response, and on the bottom the actual data body of the Http request or response between the client and server respectively.
Further to this the data represented on the client or server side can be represented differently visually by selecting the View dropdown on each side. Its options include:
- Content - displays a visual representation of the data packet passed in the request/response -- for a Html page it will show a visual representation of the Html components, or for images the actual image itself.
- Raw - displays the pure data flowing backwards and forwards as text
- Hex - shows the data as hex values
Personally I find the Content and Hex views less useful than the Raw option when viewing a Html request/response. However the Raw option doesn't wrap in the Http Analyzer window making it poorly readable, and I typically copy & paste the Raw text data into my favourite text editor with wrapping turned on to read the response.
Interesting things to do with Http Analyzer
So why is the Http Analyzer useful? Some uses include:
- Recording a history of request/responses to detect and replicate bugs
- Analyzing the time taken for a request/response on a particular page
- Analyzing the size of a page and its effect on client's with slow internet connections
- Inspecting and detecting issues with the Http request/response headers
- Estimating the bandwidth required for a popular page requested by your application
- Detecting unusual error conditions returned by the server beyond 404 Page not found
- Analyzing issues where the client POST request is terminated 1/2 way
.... also, and not discussed here, the Http Analyzer can be used for debugging Web Service calls, and actually modifying the Soap packet.
I'd be curious to know what uses others have found for the Http Analyzer. I've seen some particularly tricky debugging made simple by this tool.
The Http Analyzer documentation is not well indexed in Oracle's JDeveloper online documentation. Rather than searching for entries under the online Index help option, instead under the help Search option, search for "Analyzer" to find more documentation, including the "About the Http Analyzer" help page.