User Guide

Table Of Contents
Approaches to debugging Java CFX tags 267
To determine whether a CFX tag is invoked with the debug attribute, use the Request.debug
method. To write debugging output in a special debugging block after the tag finishes executing,
use the
Response.writeDebug method. For information on using these methods, see Chapter 8,
“ColdFusion Java CFX Reference,” in CFML Reference.
Debugging in a Java IDE
You can use a Java IDE to debug your Java CFX tags. This means you can develop your Java CFX
tag and debug it in a single environment.
To use a Java IDE to debug your CFX tag:
1.
Start your IDE.
2.
In the project properties (or your IDE's project setting), make sure your CFX class is in the
web_root\WEB-INF\classes
directory or in the system classpath.
3.
Make sure the libraries cf_root/wwwroot/WEB-INF/lib/cfx.jar (cf_webapp_root/WEB-INF/lib/
cfx.jar in the J2EE configuration) and
cf_root/runtime/lib/jrun.jar (server configuration only)
are included in your classpath.
4.
In your project settings, set your main class to jrunx.kernel.JRun and application parameters to
-start default.
5.
Debug your application by setting breakpoints, single stepping, displaying variables, or by
performing other debugging actions.
Using the debugging classes
To develop and debug Java CFX tags in isolation from the ColdFusion, you use three special
debugging classes that are included in the
com.allaire.cfx package. These classes lets you
simulate a call to the
processRequest method of your CFX tag within the context of the
interactive debugger of a Java development environment. The three debugging classes are the
following:
DebugRequest An implementation of the Request interface that lets you initialize the
request with custom attributes, settings, and a query.
DebugResponse An implementation of the Response interface that lets you print the results
of a request once it has completed.
DebugQuery An implementation of the Query interface that lets you initialize a query with a
name, columns, and a data set.
To use the debugging classes:
1.
Create a main method for your Java CFX class.
2.
Within the main method, initialize a DebugRequest and DebugResponse, and a DebugQuery.
Use the appropriate attributes and data for your test.
3.
Create an instance of your Java CFX tag and call its processRequest method, passing in the
DebugRequest and DebugResponse objects.
4.
Call the DebugResponse.printResults method to output the results of the request, including
content generated, variables set, queries created, and so on.