This example is going to guide you through the creation of a Breakpoint with a Specific IP Address by the use of a jsp script.
The loop.jsp script creates a new Array of Strings that contains all the months of the year. The script is going to print out all the months of the year from the Array.
First Steps before the Breakpoint Configuration.
- Deploy the war file inside your application.
Add your jsp script in your source code directory.
If you know the source code directory, it is advisable to insert that directory as a source inside the FusionReactor. This can be done by accessing FusionReactor > Debug > Sources >Add. After selecting the Add button you should be able to see the Add Source configuration window, in the Directory field you should add the source code directory. If you do not have access to the source you will still be able to the breakpoint.
Create a New Breakpoint.
- Access FusionReactor > Debug > Breakpoints > New.
- Select a Breakpoint option to be triggered.
- In the Condition field you need to add the following: request.getRemoteAddr().toString().equals("IP Address"). In the IP Address you can add your local IP Address or your can add an External IP Address.
After the configuration of the New Breakpoint form, it should look like this.
|Production Debugger Field||Value||Meaning|
|Breakpoint Trigger||Source File/Line Number||We are selecting to set a breakpoint within a specific source file and a specific line number|
|Source Code Filename||Name / location of the file where the code is stored|
|Source Line Number||This is important. If we are checking the value of a variable, then this variable must have been set before this line number has been reached in order for the breakpoint to fire.|
|Condition||This is the example condition which will cause the breakpoint to fire and execution of the page to halt|
This indicates that the breakpoint will always fire. If we set the Fire Count to a numeric value, e.g. 3 - then the breakpoint would fire 3 times.
|Trigger Handler||Pause Thread||Will tell FusionReactor to pause the currently executing thread when the condition has been met|
|Pause Time||60||The thread will be paused for 60 seconds. During this time, the breakpoint can be interceptedby clicking on the Production Debugger icon - or from within the Paused Threads menu item|
|Pause Execution||On every thread that fires the breakpoint||Will cause the engine to halt for every single thread in which the breakpoint condition fires.|
When the breakpoint has been set up, you should be able to see the following.
Fire a Breakpoint
In order for the Breakpoint to be fired, you need to execute the loop.jsp script. The Condition will be fired and the page will halt the execution.
If the Breakpoint was fired, you should be able to see the Production Debugger iconon the Top menu of the FusionReactor.
You can either click on the Debugger icon or click the Paused Threads link in the Debug Menu: you will then see the Paused Thread - together with the Timeout Countdown. See screenshot below.
To start the Production Debugger session, you need to click on the Debug Icon :
Change the IP Address to an External IP Address.
In order to make the Production Debugger work under a Specific IP Address, you only need to change the Condition field inside the New Breakpoint configuration.
For example, if you want to debug a jsp script that is not located in your local machine but is located in a different IP Address, for example 192.168.0.1, the New Breakpoint menu is going to change like the following screenshot.
When you try to run the loop.jsp with the new configuration, you can see that the Breakpoint was fired and you can debug the loop.jsp script. See Screenshots below.