ZipBrowser example
257
Automatic class reloading
You can determine how the server treats changed Java CFX class files by specifying the reload
attribute when you use a CFX tag in your ColdFusion page. The following table describes the
allowable values for the reload attribute:
The default value is
reload="Auto"
. This is appropriate for most applications. Use
reload="Always"
during the development process, when you must ensure that you always have
the latest class files, even when only a dependent class changed. Use
reload="Never"
to increase
performance, by omitting the check for changed classes.
Note:
The reload attribute applies only to class files located in the classes directory. The ColdFusion
server loads classes located on the Java classpath once per server lifetime. You must stop and restart
the ColdFusion server to reload these classes.
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.
Note:
The Java source file that implements cfx_ZipBrowser, ZipBrowser.java, is included in the
cf_root
\cfx\java\distrib\examples directory. Compile ZipBrowser.java to implement the tag.
The tag’s
archive
attribute specifies the fully qualified path of the zip archive to browse. The tag’s
name
attribute must specify the query to return to the calling page. The returned query contains
three columns: Name, Size, and Compressed.
For example, to query an archive at the path C:\logfiles.zip for its contents and output the results,
you use the following CFML code:
<cfx_ZipBrowser
archive="C:\logfiles.zip"
name="LogFiles" >
<cfoutput query="LogFiles">
#Name#, #Size#, #Compressed# <BR>
</cfoutput>
Value
Description
Auto
Automatically reload Java CFX and dependent classes within the classes directory
whenever the CFX class file changes. Does not reload if a dependent class file changes
but the CFX class file does not change.
Always
Always reload Java CFX and dependent classes within the classes directory. Ensures a
class reload even if a dependent class changes, but the CFX class file does not change.
Never
Never reload Java CFX classes. Load them once per server lifetime.
Summary of Contents for COLDFUSION MX 61-DEVELOPING COLDFUSION MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......