Barack Obama - Change We Can Believe In

Viewing By Entry / Main
April 7, 2005
Now that people are starting to use Application.cfc they are starting to trip over a gotcha with onRequest(). Read the LiveDocs reference for the onRequest() method!

Or, if you're too lazy to read the documentation (as if!), I'll quote the relevant paragraph here for you:

  • Implement this method only if the following are true:
    • The directory, and any subdirectories affected by this Application.cfc contain CFM files and do not contain any CFC files that are intended to be accessed as web services, using Flash Remoting, or using an event gateway.
    • You want to intercept the request and process it in a special way.

Think about how onRequest() works - it <cfinclude>s the target page in order to complete the request. How could it do that for a CFC request that comes in as a Web Service, Flash Remoting or Event Gateway request? How would it know about arguments etc? Answer: it can't.

So, if you use Application.cfc and need onRequest() for manipulating a CFM page request and you want to offer CFCs as Web Services, Flash Remoting or Event Gateways then you need to put them in a separate directory and have another Application.cfc in that directory that does not have an onRequest() method.

Comments

There are no comments for this entry.

Post Your Comments
Name:
Email Address:
Comments
*** Please note that all comments require moderation so it may be some time before your comment posts to this blog! ***
Remember My Information:
 



Hosting provided by