Page tree
Skip to end of metadata
Go to start of metadata

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.

Code Example : loop.jsp

loop.jsp
<%@ include file="/header.jsp" %>
<h1>Loop</h1>
 
<%
    String[] months = {"January","February","March","April","May","June","July","August","September","October","November","December"};
 
   for( int i=0;i<months.length;i++)
    {
        out.println("The month is: " + months[i] + "<br>");
    }
%>
 
<%@ include file="/footer.jsp" %>

 

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.

  1. Deploy the war file inside your application.
  2. Add your jsp script in your source code directory.

  3. 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.

  1. Access FusionReactor > Debug > Breakpoints > New.

  2. Select a Breakpoint option to be triggered.
  3. 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 FieldValueMeaning
Breakpoint TriggerSource File/Line NumberWe are selecting to set a breakpoint within a specific source file and a specific line number
Source Code Filenameloop.jspName / location of the file where the code is stored
Source Line Number9This 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.
Conditionrequest.getRemoteAddr().toString().equals("IP Address")This is the example condition which will cause the breakpoint to fire and execution of the page to halt
Fire CountAlways

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 HandlerPause ThreadWill tell FusionReactor to pause the currently executing thread when the condition has been met
Pause Time60The thread will be paused for 60 seconds.   During this time, the breakpoint can be intercepted by clicking on the Production Debugger icon - or from within the Paused Threads menu item
Pause ExecutionOn every thread that fires the breakpointWill 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 icon on 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.

 

 

 

 

 

 

 

 

 

 

  • No labels