• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 31. Event Gateways > Creating a Simple Gateway Application

Creating a Simple Gateway Application

In Chapter 29, “Extending ColdFusion with Java,” we created several examples for a photo album application. One of the examples we created looped over the contents of a directory and made thumbnails for all the images found in that directory. That's pretty cool, but it requires a user to interact with the application through a Web browser. What if your boss now asks you to allow users to FTP-upload files of photos, and wants the application to detect that a file has been uploaded and create an associated directory of thumbnails! Normally you couldn't do this with ColdFusion because you're not interacting with the server directly through HTTP—but with ColdFusion MX 7 and the DirectoryWatcher event gateway, it's a snap.

For this example, the DirectoryWatcher event gateway (supplied with CFMX7) will create a simple responder application. The DirectoryWatcher gateway sends events to a listener CFC when a file is created, deleted, or modified in a directory you tell the gateway to watch. It runs checks the directory at an interval specified in a configuration file that you edit, and when the interval has passed, checks for changes since last time. If it finds any changes, DirectoryWatcher sends a message to a listener CFC, which can perform the unzipping and creation of thumbnails.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint