Adobe COLDFUSION 9 Manual page 1277

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
EmptyGateway
The EmptyGateway.java file contains an event gateway template that you can use as a skeleton for creating your own
event gateway. For more information on this class, and on creating new event gateways, see
Gateways" on page 1320
SocketGateway
The SocketGateway event gateway listens on a TCP/IP port. Therefore, you can use this gateway for applications that
send and respond to messages using TCP/IP-based protocols such as Telnet, or for applications that send messages
between sockets. For example, a simple gateway application that responds to messages from a Telnet terminal client
without supporting the full Telnet protocol.
Note: The ColdFusion Administrator uses Socket as the gateway type name for the SocketGateway class.
The SocketGateway.java file defines two classes: SocketGateway, the event gateway, and SocketHelper, a
GatewayHelper class. The Source file is located in the gateway\src\examples\socket directory.
Listens on a TCP/IP port. This event gateway is multi-threaded and can handle multiple clients
SocketGateway
simultaneously. It can send outgoing messages to existing clients, but cannot establish a link itself.
By default, the SocketGateway class listens on port 4445, but you can specify the port number in a configuration file.
The file should contain a single line in the following format:
port=portNumber
A GatewayHelper class with the following methods:
SocketHelper
returns an array containing the socket IDs of all Java sockets that are open. The event gateway opens
getSocketIDs()
a socket for each remote client.
socketid
killSocket(String
DirectoryWatcherGateway
The DirectoryWatcherGateway event gateway sends events to the listener CFC when a file is created, deleted, or
modified in a directory. The watcher runs in a thread that sleeps for an interval specified in the configuration file, and
when the interval has passed, checks for changes since the last time it was awake. If it finds added, deleted, or changed
files, it sends a message to a listener CFC. You can configure separate CFCs for add, delete, and change events, or use
a single CFC for all events. The source for this event gateway is located in the gateway/src/examples/watcher directory.
Note: The ColdFusion Administrator uses DirectoryWatcher as the gateway type name for the
DirectoryWatcherGateway class.
Configuration file
This event gateway requires a configuration file, consisting of lines in the following format:
directory=C:/temp
Note: If you use backward slash characters (\) as directory separators in Windows the file paths, escape them by using
double slashes, as in C:\\temp. You can use forward slashes (/) as the directory separator on all operating systems,
including Windows.
Note: When you specify filename extensions in the Directory Watcher configuration file, do not include the period,
instead use a comma, for example,
The configuration file can have comment lines, preceded by a number sign (#). If you omit a property or comment it
out, ColdFusion uses the default value. If you specify a property with no value, ColdFusion sets an empty property.
The configuration file can define the following values:
removes the specified socket. Returns a Boolean success indicator.
)
.
doc,txt
Last updated 8/5/2010
1272
"Creating Custom Event

Advertisement

Table of Contents
loading

Table of Contents