User Guide

398 Chapter 21 Building Custom CFXAPI Tags
// read the zip file and build a query from its contents
ZipInputStream zin =
new ZipInputStream( new FileInputStream(strArchive) ) ;
ZipEntry entry ;
while ( ( entry = zin.getNextEntry()) != null )
{
// add a row to the results
int iRow = files.addRow() ;
// populate the row with data
files.setData( iRow, iName,
entry.getName() ) ;
files.setData( iRow, iSize,
String.valueOf(entry.getSize()) ) ;
files.setData( iRow, iCompressed,
String.valueOf(entry.getCompressedSize()) ) ;
// finish up with entry
zin.closeEntry() ;
}
// close the archive
zin.close() ;
}
}
Approaches to Debugging Java CFXs
Java CFXs are not standalone applications that run in their own process like typical
Java applications. Rather, they are created and invoked from an existing process
ColdFusion Server. This makes debugging Java CFXs more difficult because you
cannot use an interactive debugger to debug Java classes that have been loaded by
another process.
To overcome this limitation, you can use one of two techniques:
Debug the CFX while it is running within ColdFusion Server by outputting debug
information as needed.
Debug the request in an interactive debugger offline from ColdFusion Server
using the special
com.allaire.cfx debugging classes.
Outputting debug information
Before using interactive debuggers became the norm, programmers typically
debugged their programs by inserting output statements in their programs to
indicate information such as variable values and control paths taken. Often, when a
new platform emerges, this technique comes back into vogue while programmers
wait for more sophisticated debugging technology to develop for the platform.