ColdFusion Architecture

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

The ColdFusion Markup Language (CFML) is the language that you use to create ColdFusion applications. CFML is a tag-based language, just like HTML. You use it in conjunction with HTML and other client-side languages, such as JavaScript and VBScript, to create the templates that make up a ColdFusion application. CFML is used to determine what to display, while HTML specifies how to display it, an important distinction. This book covers all the CFML tags and functions supported by ColdFusion.

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.

Objects

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.

Extensions

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.

Now that you understand the components that comprise the ColdFusion environment, let’s look at how ColdFusion processes requests:

  1. A web browser makes a request to a web server for a template with a .cfm extension.

  2. The web server receives the request and forwards it to the ColdFusion Application Server.

  3. 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.

  4. The ColdFusion Application Server combines its dynamic output with the static HTML (and JavaScript or VB Script, if any) in the template and passes the whole page back to the web server.

  5. 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.

How ColdFusion requests are processed

Figure 1-1. How ColdFusion requests are processed

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.