There are several components that make up the ColdFusion environment, from which you can develop ColdFusion applications. As I mentioned earlier, a ColdFusion application is simply a collection of templates (web pages) that work together to allow a user to perform a task. These templates don’t exist in a vacuum, however. To get a better idea of how a ColdFusion application is constructed, you need to understand the components that make up the ColdFusion environment:
- ColdFusion Application Server
The ColdFusion Application Server processes all the CFML code in the templates passed to it by the web server. It then returns the dynamically generated results to the web server, so that the output can be sent to the user’s browser. The ColdFusion Application Server integrates with a number of popular web servers via native APIs and is also capable of running in CGI mode. Once the ColdFusion Application Server is set up, it works silently in the background, so we won’t be talking much about it in this book.
- ColdFusion Studio (or other text-editing software)
ColdFusion Studio is the Integrated Development Environment (IDE) for the ColdFusion Application Server. Studio provides developers with a visual environment for developing, testing, debugging, and deploying ColdFusion applications. Although ColdFusion applications can be written using any text editor capable of saving ASCII output, ColdFusion Studio offers many advantages that make it worth considering. This book doesn’t concern itself with how you create your ColdFusion applications, so ColdFusion Studio isn’t covered.
- ColdFusion Markup Language (CFML) templates
- Web server
The web server funnels browser requests for CFML templates through the ColdFusion Application Server. The web server is also responsible for passing the output returned by the ColdFusion Application Server back to the browser. As I already mentioned, ColdFusion works the same way on all supported web servers, so your choice of web server isn’t important and won’t affect your programming.
- ColdFusion Administrator
The ColdFusion Administrator is actually a ColdFusion application for configuring and administering the ColdFusion Application Server. The ColdFusion Administrator handles everything from registering and setting up data sources to logging and security. This is a book for programmers, so it doesn’t cover configuration and administration. For more information on configuring and administering the ColdFusion Application Server, you need to consult the documentation that comes with your edition of ColdFusion.
- Data sources
ColdFusion is capable of interacting with a number of external data sources, including databases (via ODBC, OLE-DB, and native drivers), Verity collections, LDAP directories, POP3 and SMTP mail servers, FTP servers, and other HTTP servers. This allows you to create ColdFusion applications that send and receive email, transfer files with FTP, query directory servers, and request content from other web servers. Because most web applications interact with databases, this book demonstrates using ColdFusion with databases. It also includes chapters that show how to use ColdFusion to interact with the other kinds of data sources I just mentioned.
ColdFusion can interact with various external objects, including COM/DCOM objects, CORBA objects, and Java objects (including Enterprise JavaBeans components). This allows your ColdFusion applications to interact with third-party components as well as back-end systems written in other languages, which makes ColdFusion an excellent choice for acting as the “glue” that ties together all sorts of disparate systems into a cohesive application. Using ColdFusion to interact with external objects is covered in Chapter 23.
CFML is extensible via custom extensions written in a variety of languages, such as C++, Java, and Delphi, and even CFML. By writing an extension, you can include functionality not natively available in the core ColdFusion language. For example, ColdFusion can’t natively connect to a NNTP news server, but if you are skilled in C++, Java, or Delphi, you can easily build a CFX extension to support such a connection. Creating custom tags using CFML is covered in Chapter 19. Custom extensions are beyond the scope of this book, however, so for more information on developing your own custom extensions using C++, Delphi, or Java, you need to consult the documentation that came with your edition of ColdFusion.
A web browser makes a request to a web server for a template with a .cfm extension.
The ColdFusion Application Server parses the CFML template and processes the tags and functions accordingly, interacting with other services, such as data sources or mail servers, as necessary.
The web server passes the dynamically generated content back to the client machine’s web browser.
This entire process is illustrated in Figure 1-1.