Automatic Class Reloading; Life Cycle Of Java Cfx Tags; Zipbrowser Example - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

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:
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 reload Java CFX classes. Load them once per server lifetime.
Never
The default value is
reload="Always"
the latest class files, even when only a dependent class changed. Use
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
object. To store data and/or objects that are accessible to all instances of your
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
uses the java.util.zip package to implement a Java CFX tag called
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 must specify the query to return to the calling page. The returned query contains
name
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>
. This is appropriate for most applications. Use
reload="Auto"
during the development process, when you must ensure that you always have
attribute specifies the fully qualified path of the zip archive to browse. The tag's
,
, and
Request
Response
cfx_ZipBrowser
to increase
reload="Never"
CustomTag
, use
CustomTag
objects. The example
Query
, which is a zip

ZipBrowser example

257

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents