User Guide

Table Of Contents
264 Chapter 12: Building Custom CFXAPI Tags
Response object
The Response object is passed to the
processRequest method of the CustomTag interface. The
following table lists the methods of the Response object for writing output, generating queries,
and setting variables within the calling page:
For detailed reference information on each of these interfaces, see CFML Reference.
Query object
The Query object provides an interface for working with ColdFusion queries. The following table
lists the methods of the Query object for retrieving name, row count, and column names and
methods for getting and setting data elements:
For detailed reference information on each of these interfaces, see CFML Reference.
Life cycle of Java CFX tags
A new instance of the Java CFX object is created for each invocation of the Java CFX tag. This
means that it is safe to store per-request instance data within the members of your
CustomTag
object. To store data and/or objects that are accessible to all instances of your
CustomTag, use
static data members. If you do so, you must ensure that all accesses to the data are thread-safe.
ZipBrowser example
The following example shows the use of the Request, Response, and Query objects. The example
uses the java.util.zip package to implement a Java CFX tag called
cfx_ZipBrowser, which is a zip
file browsing tag.
Method Description
write Outputs text to the calling page.
setVariable Sets a variable in the calling page.
addQuery Adds a query to the calling page.
writeDebug Outputs text to the debug stream.
Method Description
getName Retrieves the name of the query.
getRowCount Retrieves the number of rows in the query.
getColumnIndex Retrieves the index of a query column.
getColumns Retrieves the names of the query columns.
getData Retrieves a data element from the query.
addRow Adds a new row to the query.
setData Sets a data element within the query.