Developing Web Applications with ColdFusion
|
|
Chapter 18 : Building Custom CFAPI Tags
|
Registering CFXs
To use a CFX tag in your ColdFusion applications, first register it in the Extensions, CFX Tags page in the ColdFusion Administrator.
 |
To register the tag in the CF Administrator:
|
- In the CF Administrator, open the Extensions > CFX Tags page.
- Enter
CFX_MyNewTag
in the Tag name and, optionally, a description.
- Select the type of tag (either C++ or Java).
- Click Add to open the New CFX Tag page.
 |
To register a C++ CFX:
|
- In the CF Administrator, open the Extensions > CFX Tags page.
- Enter
CFX_MyNewTag
in the Tag name and, optionally, a description.
- Select the type of tag (either C++ or Java).
- Click Add to open the New CFX Tag page.
- If the Server library (DLL) field is empty, enter the file path.
- Accept the default Procedure entry.
- Un-check the Keep library loaded box while developing the tag. When the tag is ready for production use, you can check this option to keep the DLL in memory for improved performance.
- Click Add.
You can now call the tag from a ColdFusion template.
 |
To register a Java CFX:
|
- In the CF Administrator, open the Extensions > CFX Tags page.
- Enter
CFX_MyNewTag
in the Tag name and, optionally, a description.
- Select the type of tag (either C++ or Java).
- Click Add to open the New CFX Tag page.
- Enter the Class name.
- Click Add.
You can now call the tag from a ColdFusion template.
 |
To change a CFX tag:
|
- Click the tag you want to change in the Registered CFX Tags list.
- Make changes as needed on the Edit CFX Tag page.
- Click Apply to save the changes.
 |
To delete a CFX tag:
|
- Click the tag you want to delete in the Registered CFX Tags list.
- Click Delete on the Edit CFX Tag page. The tag is removed from the list but is not deleted from the system.
On Windows NT only, the Visual C++ Custom Tag Wizard automatically registers custom tags so that they can be tested and debugged.
Distribution
If you are distributing a custom tag, you may want to automatically register the custom tag during the setup process by writing the registration entries directly into the Registry. The location, key, and value names to write are as follows:
Registration Entries for C++ CFXs
|
Entry
|
Value
|
Hive
|
HKEY_LOCAL_MACHINE
|
Key
|
SOFTWARE\Allaire\ColdFusion\CurrentVersion\CustomTags\ TagName
|
LibraryPath
|
The full path to the DLL (Windows NT) or shared object (Solaris) that implements the custom tag.
|
ProcedureName
|
The name of the procedure to call for processing tag requests.
|
Description
|
A description of the tag's functionality for browsing by end users.
|
CacheLibrary
|
Indicates whether to keep the DLL or shared object loaded in RAM (1 or 0).
|
Registration Entries for Java CFXs
|
Entry
|
Value
|
Hive
|
HKEY_LOCAL_MACHINE
|
Key
|
SOFTWARE\Allaire\ColdFusion\CurrentVersion\CustomTags\ TagName
|
ClassName
|
The name of the Class to call.
|
Description
|
A description of the tag's functionality for browsing by end users.
|
You can create a file containing this information by using the Regedit utility to export the registry entry from a machine on which the custom tag is already installed.
On Windows NT, use Regedit to import custom tags to the registry. The ColdFusion regedit utility (in the bin) performs the same function on UNIX.
 |
To import a C++ custom tag:
|
- Export the custom tag's registry entry by using the Regedit utility. This creates a file similar to the following:
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\
CustomTags\CFX_TEST]
"LibraryPath"="C:\\cfusion\\cfx\\CFX_TEST\\test.dll"
"ProcedureName"="ProcessTagRequest"
"Description"="Sample CFX tag."
"CacheLibrary"="1"
- In the install script, import the registry entry by including the following command in the install script:
regedit
importfilename
 |
To import a Java custom tag:
|
- Export the custom tag's registry entry by using the Regedit utility. This creates a file similar to the following:
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\
CustomTags\CFX_TEST]
"ClassName"="ProcessTagRequest"
"Description"="Sample CFX tag."
- In the install script, import the registry entry by including the following command in the install script:
regedit
importfilename
Copyright © 1999, Allaire Corporation. All rights reserved.
|
|