Chapter 18: Building Custom CFAPI Tags
279
•
HelloWorldGraphic
- Generates a "Hello World!" graphic in JPEG format.
Demonstrates how to dynamically create and return graphics from a Java CFX.
Setting Up Your Development Environment to Develop CFXs
in Java
You can use a wide range of Java development environments to build Java CFXs,
including the Java Development Kit which you can download from Sun at
http://www.javasoft.com/products/jdk/1.2/index.html
Although you can use just the basic JDK, it is highly recommended that you use one of
the commercial Java IDEs that provide an integrated environment for development,
debugging, project management, and access to documentation. If you don’t already
have a Java development environment, we recommend that you try Symantec Visual
Café, for which a 30 day free trial is available at
http://www.symantec.com/domain/cafe/vcafe30.html
Configuring the Class Path
To configure your development environment to build Java CFXs, you need to make
sure that the supporting classes are visible to your Java compiler. These classes are
located in the
classes\cfx.jar
archive. The full path is
<coldfusioninstalldir>/
Java/classes
Consult your Java development tool's documentation to determine how
to configure the compiler class path for your particular environment.
The
classes
directory created by the ColdFusion setup program serves two purposes:
1.
It contains the supporting classes required for developing and deploying Java
CFXs. This is the
com.allaire.cfx
package located in the
cfx.jar
archive.
2.
It supports a feature that allows Java CFXs located within it to be reloaded every
time they are changed. Although this is not the default behavior for other Java
classes, it is very useful during an iterative development and testing cycle.
Allaire strongly recommends that when you create new Java CFXs, you develop and
deploy them within the
classes
directory. Following this guideline will dramatically
simplify your development, debugging, and testing processes.
Once you are finished with development and testing, you can then deploy your Java
CFX anywhere on the class path visible to the ColdFusion embedded JVM. See
“Java
Customization and Configuration” on page 289
for more details on customizing the
class path.
Writing a Java CFX
To create a Java CFX, you simply create a class which implements the
CustomTag
interface. This interface contains one method,
processRequest
, which is passed
Request
and
Response
objects that are then used to do the work of the tag.
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...