22.08.2013 Views

ColdFusion Developer's Guide

ColdFusion Developer's Guide

ColdFusion Developer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Beta<br />

PART 3: DEVELOPING CFML APPLICATIONS<br />

Chapter 13: Designing and Optimizing a <strong>ColdFusion</strong> Application .<br />

321<br />

About applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321<br />

Elements of a <strong>ColdFusion</strong> application . . . . . . . . . . . . . . . . . . . . . . . . . .322<br />

Structuring an application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327<br />

Defining the application and its event handlers in Application.cfc . . 331<br />

Migrating from Application.cfm to Application.cfc. . . . . . . . . . . . . . . .345<br />

Using an Application.cfm page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .346<br />

Optimizing <strong>ColdFusion</strong> applications . . . . . . . . . . . . . . . . . . . . . . . . . . . 350<br />

Chapter 14: Handling Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361<br />

About error handling in <strong>ColdFusion</strong>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361<br />

Understanding errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .362<br />

Error messages and the standard error format . . . . . . . . . . . . . . . . . . .369<br />

Determining error-handling strategies . . . . . . . . . . . . . . . . . . . . . . . . . .370<br />

Specifying custom error messages with the cferror tag . . . . . . . . . . . 373<br />

Logging errors with the cflog tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377<br />

Handling runtime exceptions with <strong>ColdFusion</strong> tags. . . . . . . . . . . . . . .379<br />

Chapter 15: Using Persistent Data and Locking . . . . . . . . . . . . 399<br />

About persistent scope variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400<br />

Managing the client state. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403<br />

Configuring and using client variables . . . . . . . . . . . . . . . . . . . . . . . . . 408<br />

Configuring and using session variables . . . . . . . . . . . . . . . . . . . . . . . . 415<br />

Configuring and using application variables . . . . . . . . . . . . . . . . . . . . . 421<br />

Using server variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .423<br />

Locking code with cflock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424<br />

Examples of cflock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .433<br />

Chapter 16: Using <strong>ColdFusion</strong> Threads . . . . . . . . . . . . . . . . . . . 439<br />

About <strong>ColdFusion</strong> threads. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439<br />

Creating and managing CF threads. . . . . . . . . . . . . . . . . . . . . . . . . . . . 440<br />

Using thread data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444<br />

Working with threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .448<br />

Using <strong>ColdFusion</strong> tools to control thread use . . . . . . . . . . . . . . . . . . . 450<br />

Example: getting multiple RSS feeds . . . . . . . . . . . . . . . . . . . . . . . . . . . 451<br />

Chapter 17: Securing Applications . . . . . . . . . . . . . . . . . . . . . . . 453<br />

<strong>ColdFusion</strong> security features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454<br />

6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!