Adobe ColdFusion Anthology (eBook)
XL, 528 Seiten
Apress (Verlag)
978-1-4302-7214-4 (ISBN)
Adobe ColdFusion remains one of today's significant Web services tools and frameworks, and stands to become even more important as a possible primary tool for cloud development as well. As important as ColdFusion is and continues to become, we thought it would be a good idea to tap the leading authority on ColdFusion, the Fusion Authority. We asked this community to compile the most important issues in their developer and user experiences into one single volume-an anthology of the most current technical articles published in the Fusion Authority Quarterly Update.
In it, you'll get the following:
- The best and brightest ColdFusion expertise available today, from inside and outside of Adobe
- The most up-to-date content with the latest releases of ColdFusion
- Case studies and instances where ColdFusion is used in cloud-based development
Rather than take a soup-to-nuts approach that covers every single topic, including those that most people have learned already, this book takes specific items of interest and explains them so that you can hit the ground running, rather than having to wait until you've read the entire book.
Michael Dinowitz is the primary author and has been using ColdFusion since the original beta. He's well known for taking complex topics and explaining them in simple terms without losing their full power. Other authors are also selected from the top tier of the ColdFusion development world.
Adobe ColdFusion remains one of todays significant Web services tools and frameworks, and stands to become even more important as a possible primary tool for cloud development as well. As important as ColdFusion is and continues to become, we thought it would be a good idea to tap the leading authority on ColdFusion, the Fusion Authority. We asked this community to compile the most important issues in their developer and user experiences into one single volumean anthology of the most current technical articles published in the Fusion Authority Quarterly Update. In it, youll get the following: The best and brightest ColdFusion expertise available today, from inside and outside of Adobe The most up-to-date content with the latest releases of ColdFusion Case studies and instances where ColdFusion is used in cloud-based development Rather than take a soup-to-nuts approach that covers every single topic, including those that most people have learned already, this book takes specific items of interest and explains them so that you can hit the ground running, rather than having to wait until youve read the entire book.
Michael Dinowitz is the primary author and has been using ColdFusion since the original beta. He's well known for taking complex topics and explaining them in simple terms without losing their full power. Other authors are also selected from the top tier of the ColdFusion development world.
Title Page 1
Copyright Page 2
Contents at a Glance 3
Table of Contents 6
Foreword 25
About the Authors 26
About the Technical Reviewers 37
Acknowledgments 38
Introduction 39
PART 1 ColdFusion Fundamentals 41
CHAPTER 1 Working with Application.cfc 42
What Is an Application? 42
Adding Application Variables 44
The onApplicationStart Method 44
The onSessionStart Method 45
The onRequestStart Method 46
The onError Method 47
The onApplicationEnd Method 49
The onSessionEnd Method 49
The onRequestEnd Method 50
The onRequest Method 50
A New Application Structure 52
CHAPTER 2 Application.cfc Reference 53
CHAPTER 3 From User-Defined Functions to ColdFusion Components 55
User-Defined Functions 55
Creating UDFs 56
Naming a UDF 56
Assigning UDFs to Other Scopes 57
Placing the UDF Definition 57
The cffunction Tag 58
The cfargument Tag 60
The Arguments Scope 61
Local Variables 63
The cfreturn Tag 64
UDF Variable Protection 64
Executing UDFs and Passing Parameters 65
The cfinvoke Tag 66
Passing by Reference Versus Passing by Value 68
Error Handling 68
A Full UDF Example 69
ColdFusion Components 70
Creating CFCs 71
Instantiation and Constructors 72
The cfobject Tag 73
The cfinvoke Tag 73
The createobject() Function 74
Method Chaining 74
The new Keyword 75
The CFC Container: The cfcomponent Tag 77
Implementing Security 77
Defining Properties: Variables and This 78
Variables Scope 78
This Scope 78
Understanding Encapsulation 79
Caching Components 79
Using Inheritance 81
Overriding and Super 81
Two Different Views 81
Type Checking Parents and Children 83
Parting Words 84
CHAPTER 4 onMissingTemplate()—Error Handler and So Much More 85
404 Missing Template Handling: Step-by-Step Basics 85
Setting Global Handlers 86
What Is the onMissingTemplate() Method, and When Is It Called? 87
Method Invocation within onMissingTemplate() 89
When Errors Occur 90
Reasons for Calling onMissingTemplate() 91
Request Errors and Corrected Requests 91
Content Redirects 92
Dynamic Page Generation 93
Examining Template Requests 94
Attractive URLs for Frameworks 96
Fusebox URL 96
Model-Glue URL 97
Mach-II URL 97
We’re Not Done Yet, but ... 97
CHAPTER 5 “Say What?” Handling Unknown Messages with onMissingMethod() 98
Get the Message? 98
Message Received 100
Defining onMissingMethod() 101
Using onMissingMethod() 102
Automatic get/set Methods 103
Method Injection 105
Aspect-Oriented Programming 107
Summary 109
Further Reading 109
PART 2 Document Creation in ColdFusion 110
CHAPTER 6 PDF Support in ColdFusion 111
PDF Support in ColdFusion MX 7 (and Earlier) 111
PDF Support in ColdFusion 8.0.1 and beyond 112
The isPDFFile and isPDFObject Functions 113
What Exactly Can We Do with the cfpdf Tag? 115
Getting and Setting Information 116
Adding a Watermark 120
Using DDX 122
Where to Go Next 124
CHAPTER 7 Image Processing in ColdFusion 125
The cfimage Tag 125
Getting Image Dimensions with cfimage 125
Resizing an Image with cfimage 126
Multiple Operations with cfimage 127
Creating a CAPTCHA Image with cfimage 127
The New Image Processing Functions 128
Image Drawing Functions 128
Drawing an Image from Scratch 128
Using a Custom Drawing Stroke 129
Drawing Text on an Image 130
Text Drawing Options 131
Additional Image Drawing Functions 131
Image Manipulation Functions 132
ImageScaleToFit 132
Additional Image Manipulation Functions 133
Image Information Functions 133
Displaying the Digital Camera Model and EXIF data 133
Image I/O Functions 135
Summary 135
PART 3 Essentials to Server Productivity 136
CHAPTER 8 Tuning Your Java Virtual Machine:Finding Your Ideal JVM Settings Through Metrics Log Analysis 137
How the JVM Fits into ColdFusion 137
Enabling Metrics Logging 138
Editing the jrun.xml File 139
Splitting Up the JRun Logs 140
Examining the Metrics Logging Output 141
Finding the Proper Start and Maximum Heap Memory Size 142
The New Metrics 143
Summary 144
CHAPTER 9 The Shoemaker and the Asynchronous Process Elves 145
The Experiment 146
Before Employing Those Elves 149
The Moral of the Story 149
Further Reading on Asynchronous Gateways 150
CHAPTER 10 Asynchronous Gateways Step-by-Step 151
CHAPTER 11 You Might Have a Performance Bottleneck If… 154
If You Can't Tell a Manager from an Employee, You Might Have a Performance Bottleneck 154
If Your Foreign Key Values Are Not Defined in the Database . . . 156
If You Relate Data Between Tables, but Neglect to Inform the Database . . . 158
If You Store a Comma-Delimited List of Foreign Keys in a Single Column . . . 159
If You Use SELECT MAX( ID ) to Get the Primary Key of a Newly Inserted Record . . . 162
If Your Only Transactions Are Between You and a Cashier . . . 163
If You Think the Difference Between Char and Varchar Is Typing Three More Letters . . . 165
If You Think UTF-8 Is One of Those TV Channels You Used to Get with Rabbit Ears . . . 167
If You Use More Than One Query to Read Data from Multiple Tables . . . 168
If the Only Index Your Database Knows Is Next to Your Middle Finger . . . 170
If You Run Calculations on Data Using Your Application Code . . . 172
If the Contents of a Table Depend on the Phase of the Moon . . . 175
Build It Correctly from the Beginning 175
PART 4 Communication and Integrating with Other Technologies 176
CHAPTER 12 An Introduction to Consuming and Deploying Web Services in ColdFusion 177
Deploying a Web Service from a CFC 178
Using a Remote Proxy Object 179
Deploying a Web Service from a Standard ColdFusion Page 180
Invoking Web Services in ColdFusion 183
Using the cfinvoke Tag 183
Using the CreateObject() Function 184
Using the cfhttp Tag 185
Invoking a CFM-Based Web Service 186
Error Handling 187
And Finally... 188
CHAPTER 13 Web Services and Complex Types 189
Consuming Web Services 189
Passing Complex Types as Input Parameters 189
Nested Complex Types 191
Arrays 192
Attributes 194
Going to the Source 196
When Structures Are Not Enough 201
WSDL2Java 203
Working with Complex Return Values 204
Publishing Web Services 205
Other Resources 209
CHAPTER 14 Type Validation When Returning an Array of Components 210
Validating a Component 210
Validating an Array of Components 211
CHAPTER 15 Sending E-mail the Right Way 212
The From Conundrum 213
Checking E-mail Origins 215
Sender Policy Framework (SPF) 215
DomainKeys Identified Mail (DKIM) 216
Real-Time Blacklists (RBLs) 216
Checking Sender Behavior 216
Checking the Content 217
Miscellaneous Commandments 218
CHAPTER 16 ColdFusion and Microsoft Exchange 219
ColdFusion and Exchange Integration Requirements 219
ColdFusion Exchange Tags 220
Using cfexchangeconnection 220
Using cfexchangecalendar, cfexchangecontact, and cfexchangetask 221
Creating an Item Structure 221
Creating and Getting Items 222
Getting a UID 222
Updating and Deleting Items 223
Working with Attachments 223
Using cfexchangemail 224
Dealing with Meeting Requests 224
Moving Mail Items 225
Setting Attributes on Mail Items 225
Using cfexchangefilter 225
ColdFusion and Exchange Interaction Best Practices 226
Connections 226
Service Accounts 227
SSL 227
Conclusion 227
CHAPTER 17 BlazeDS 228
Messaging Patterns 228
BlazeDS vs. LCDS 229
What’s in a Name? 229
Enterprise Service Bus (ESB) 229
Installing BlazeDS with ColdFusion 231
Messaging Framework 231
Running BlazeDS with a ColdFusion Event Gateway 233
Concluding Thoughts 238
PART 5 Object-Oriented Programming (OOP) 240
CHAPTER 18 Object-Oriented Programming: Why Bother? 241
OOP Fundamentals 241
Inheritance 242
Polymorphism 242
Encapsulation 242
So What? 243
Where Do I Start? 243
CHAPTER 19 The Object-Oriented Lexicon 245
CHAPTER 20 Design Patterns: Exposing the Service Layer 253
Model-View-Controller (MVC) 253
Handling Sessions 254
Returning Data 256
Accessing the Application 257
Conclusion 257
CHAPTER 21 Beans and DAOs and Gateways, Oh My! 258
A Four-Layer Cake 258
A Review of Recipes 260
What Are Those Ingredients? 263
Eating Well or Poor Diet? 264
Real-World Web Applications 265
CHAPTER 22 SOA for the Rest of Us 266
SOA Components 266
SOA vs. OOP 266
SOA Code Organization 268
Web Services 268
Data Formats 269
Security 270
Error Handling 272
Discoverability 273
Service Interfaces 274
CHAPTER 23 How Base Classes Can Help You Generate Your Applications 275
Base Class Basics 275
It’s All About the API 277
A Simple Example 278
The Variables Define the API 278
Types of Methods 280
Metaprogramming 280
Summary 281
Resources 281
PART 6 ColdFusion Frameworks 282
CHAPTER 24 An Introduction to Frameworks 283
Can Someone Just Tell Me What They ARE Already? 283
Frameworks that Focus on HTML and the User Interface 284
Fusebox 284
Model-Glue 285
Mach-II 286
ColdBox 286
Back-End and Service Frameworks 287
ColdSpring 287
Reactor 287
Transfer 288
Summary 288
CHAPTER 25 Fusebox 5 Fundamentals 289
Fusebox—What and Why 289
Fusebox Concepts 290
Fusebox Benefits 292
What’s New in Fusebox 5 and 5.5 294
Compatibility 294
Coding Styles 294
XML for Circuits and Fuseactions 294
CFCs As Circuits, Methods for Fuseactions 295
Implied Circuits, CFCs for Fuseactions 295
Implied Circuits, CFMs for Fuseactions 296
Implied Circuits, XML for Fuseactions 296
Multiple Applications 296
Application Initialization 297
Custom Lexicons 297
XML Grammar 300
Dynamic Do 302
Application.cfc Support 302
The event Object 302
The myFusebox Object 303
Search-Engine-Safe URLs 303
Runtime Control 303
Why Upgrade? 304
CHAPTER 26 Mach-II Fundamentals 305
Introducing the Mach-II Framework 305
Installing Mach-II 307
The Mach-II Application Skeleton 310
Mach-II’s XML Configuration File 310
Properties 314
Listeners 315
Event Filters 315
Plugins 316
Event Handlers 316
Page Views 316
Hello Mach-II 316
Let’s Get Personal 318
Conclusion 321
CHAPTER 27 Model-Glue Fundamentals 322
A Recipe for Spaghetti 323
Fun with Front Controller 324
Installing Model-Glue 324
Starting a New Model-Glue Application 325
Creating the Application Manually 325
Automating Application Creation 326
Model-Glue XML Files in a Nutshell 327
ColdSpring XML Configuration File 327
The Model-Glue XML Configuration File 328
The controllers Block 330
The event-handlers Block 331
The event-types Block 331
Your First Model-Glue Application 332
Setting Up the Form 332
Adding Functionality 333
Finishing Up 335
Conclusion 336
CHAPTER 28 ColdSpring Fundamentals 338
The Problem of Dependency in System Design 338
ColdSpring and Component Management 339
Some Development Concepts 341
Unit Testing 341
Test-Driven Development 341
Too Many Dependencies Can Spoil the Model 341
Back to ColdSpring 342
Using ColdSpring to Architect Your Application in Logical Tiers 342
CHAPTER 29 Reactor Fundamentals 344
The Origin of Reactor 344
A Look at Reactor 345
Installing Reactor 346
Some Simple Reactor Examples 347
How Does Reactor Work? 348
Slightly More Interesting Reactor Examples 349
Using Iterators 351
Learning More About Reactor 352
CHAPTER 30 Developing Applications with Transfer 353
Transfer—An ORM for ColdFusion 354
Installing and Configuring Transfer 354
The Transfer Data Source Configuration File 354
The Transfer Object Configuration File 355
Mapping Objects to Tables 357
Object Composition 357
Many-to-One Composition 358
One-to-Many Composition 358
Many-to-Many Composition 358
Lazy Loading 358
Decorators 359
Using Transfer 360
Creating the TransferFactory 360
Creating a New Object 361
Saving an Object 361
Retrieving an Object 363
Deleting an Object 364
Using List Queries 365
Other Transfer Functionality 366
Conclusion 367
CHAPTER 31 FW/1: The Invisible Framework 368
What Happened to ColdFusion’s Simplicity? 369
Initialization with Application.cfc 369
Convention over Configuration 369
Getting Started with FW/1 370
A Real Application 372
Beyond the Basics 376
Summary 378
PART 7 Designing the User Interface 379
CHAPTER 32 Separating Layout from Logic 380
Why Does Separation Matter? 380
More Maintainable Business Calculations 380
Less Formatting Duplication 381
Template Simplification 381
Better Support for Specialization 381
Three Helpful Techniques 381
Business Objects 381
Custom Data Types 382
View CFCs 384
Conclusion 387
CHAPTER 33 Creating Dynamic Presentations in ColdFusion 388
Overview 388
cfpresentation - The Shell 389
cfpresenter - The People 390
cfpresentationslide - The Message 390
Putting It All Together 392
The Amazing Potential 392
CHAPTER 34 Working with JSON and cfajaxproxy 394
Working with JSON 394
Special Considerations with JSON Serialization 398
Working with cfajaxproxy 398
A More Complex Example 401
Conclusion 403
CHAPTER 35 Prototyping for Interface Driven Architecture: Easing the Transition from Prototype to Application 404
Introduction 404
The Challenges 404
Suggestions 405
CSS 405
Tables 405
Complete Your Prototype 406
AJAX 406
Conclusion 406
PART 8 Development Tools 407
CHAPTER 36 Turbo Charging Eclipse 408
The Right Eclipse Package 409
Preparing for Turbo Charging 409
Getting a Fresh Instance of Eclipse 410
Setting Eclipse Preferences 410
Installing Core Tools 412
Refresh Eclipse Data 413
Initial Benchmark 414
Diagnosing Plug-in Issues 414
eclipse.ini 415
Switching Eclipse from the Default JVM 417
Conclusion 418
References 418
More Learning 418
SUN JVM Information 419
BEA JRockit Information 419
Products/Downloads 419
Eclipse Runtime Commands and Various JVM Options 419
Eclipse Runtime Commands 420
JVM Options 420
Sun JVM OPTIONS 421
JRockit JVM Options 422
CHAPTER 37 An Introduction to ColdFusion Builder 424
Why Eclipse? 424
Installation 425
Learning Eclipse 425
Projects 425
Rearranging Your Workspace 426
Ask for help 426
ColdFusion Server Integration 426
Configuring Your Server 427
RDS Dataview 428
Services Browser 428
CF Admin and Server Monitor 428
CFC Wizard 429
CF Builder Extensions 429
Building an Extension 430
Debugging Applications 434
Configuring Your Application for Debugging 434
Conclusion 436
CHAPTER 38 The ColdFusion Debugger Explained: Interactive Step Debugging for ColdFusion 8 and 9 437
What Is Interactive Step Debugging? 437
Getting Started with the CF8 Debugger 440
First Stop: Setting a Breakpoint 441
Observing Program State Information (Variables) 442
Stepping Through Lines of Code 443
Understanding the Stack Trace 444
Stepping into Other Files 445
Stopping on an Error 445
Configuration and Security 446
Configuring RDS in both Eclipse and ColdFusion’s Administrator Page 446
Configuring the Multiserver or J2EE Configuration 447
Differences Between the Debugger and FusionDebug 447
Summary 448
CHAPTER 39 Getting Started with Subversion 449
Introducing Subversion 449
Setting Up Subversion on a Windows Server 450
Creating Your First Repository 452
Importing a Web Site Project into a Repository 454
Setting Up the Client Machine 457
Updating, Committing, and Resolving with Subversion 458
Always More to Learn 460
CHAPTER 40 Subversion in the Workflow 461
The Advantages of Subversion 461
Terminology 462
Using Subversion 462
Creating Your First Repository 463
Setting Up Your Project 463
Starting with a Blank Project 463
Importing Existing Code 463
Creating Your First Revision 464
Committing Your Code and Updating from the Repository: Some Tips 464
Branching and Tags 464
Creating Branches and Tags 464
Synchronizing Changes Between Branches and the Trunk 465
Resolving Conflicts 465
Creating Patches 465
Taking Advantage of Advanced SVN Features in Your Workflow 466
Reverting to a Previous Version 466
Working with Locks 466
Exporting from SVN 466
Conclusion 466
CHAPTER 41 Advanced Subversion 467
Branching 467
Creating a Branch 468
Successful Branching 469
Tagging 470
Switching 471
Merging 471
Blame Game 474
Properties 474
Where to Go From Here 476
CHAPTER 42 Automating Your Development with Ant 477
Ant Installation 478
Eclipse Integration 479
The Ant Buildfile 480
Buildfile Components 480
Projects 480
Targets 480
Tasks 481
A Hello World Buildfile 482
Ant Properties 484
Dynamic Data in Ant 485
Copying and Zipping Files 486
Interacting with Subversion 489
Sending E-mail 490
Some Ant Guidelines 491
Conclusion 491
Index 493
Erscheint lt. Verlag | 28.12.2010 |
---|---|
Zusatzinfo | XL, 528 p. |
Verlagsort | Berkeley |
Sprache | englisch |
Themenwelt | Mathematik / Informatik ► Informatik ► Theorie / Studium |
Mathematik / Informatik ► Informatik ► Web / Internet | |
Schlagworte | ColdFusion • Debugging • Eclipse • Flash • Framework • Java • JSON • .NET • Web Services |
ISBN-10 | 1-4302-7214-7 / 1430272147 |
ISBN-13 | 978-1-4302-7214-4 / 9781430272144 |
Haben Sie eine Frage zum Produkt? |
![PDF](/img/icon_pdf_big.jpg)
Größe: 5,4 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich