Application.cfc and ColdFusion MX 7 Raymond Camden August 30, 2006
Contact Information <ul><li>Raymond Camden </li></ul><ul><li>VP of Technology, roundpeg, Inc. </li></ul><ul><li>[email_add...
Overview <ul><li>The Old Days </li></ul><ul><li>Introduction to Application.cfc </li></ul><ul><li>onApplicationStart/End <...
The Old Days
Application.cfm <ul><li>Loaded before any ColdFusion page </li></ul><ul><li>CF looks in current, and parent folders </li><...
OnRequestEnd.cfm <ul><li>Loaded at the end of a CFM page </li></ul><ul><li>CF looks in the current, and higher, folder </l...
Application.cfc – the Future is Now!
Application.cfc <ul><li>How is the file found? </li></ul><ul><li>Defining settings </li></ul><ul><li>Application.CFC Metho...
Application.cfc - Settings <ul><li>Name </li></ul><ul><li>ApplicationTimeout </li></ul><ul><li>ClientManagement/ClientStor...
Application.cfc - Methods <ul><li>onApplicationStart/End </li></ul><ul><li>onSessionStart/End </li></ul><ul><li>onRequestS...
onApplicationStart/End <ul><li>Runs when application starts and ends (duh). </li></ul><ul><li>There is no output when the ...
onApplicationStart/End - Uses <ul><li>Initializing Application Variables </li></ul><ul><ul><li>No need for locking! </li><...
onSessionStart/End <ul><li>Runs when session starts and ends (duh). </li></ul><ul><li>There is no output when the session ...
onSessionStart/End - Uses <ul><li>Initializing session variables </li></ul><ul><li>Logging </li></ul><ul><ul><li>Track num...
onRequestStart/End <ul><li>Runs when request starts and ends (duh). </li></ul><ul><li>Just like Application.cfm and onRequ...
onRequestStart/End - Uses <ul><li>Security </li></ul><ul><li>Setting request variables </li></ul>
onError <ul><li>Runs when an error occurs (duh). </li></ul><ul><li>Doesn’t reset the output </li></ul><ul><li>Bug: onError...
onRequest <ul><li>Allows specific control over the request. </li></ul><ul><li>You must cfinclude the file! </li></ul><ul><...
onRequest - Uses <ul><li>Print Format </li></ul><ul><li>Remove Whitespace </li></ul><ul><li>Used Rarely </li></ul>
Things to Consider… <ul><li>Loading UDFs </li></ul><ul><li>Extending Application.cfc </li></ul><ul><ul><li>Tech Note: http...
Resources <ul><li>My Blog </li></ul><ul><ul><li>http://ray.camdenfamily.com </li></ul></ul><ul><li>Email Me </li></ul><ul>...
Upcoming SlideShare
Loading in …5
×

Sa204 W Cfmx7 Application Framework Camden

517 views

Published on

private test

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
517
On SlideShare
0
From Embeds
0
Number of Embeds
46
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Sa204 W Cfmx7 Application Framework Camden

    1. 1. Application.cfc and ColdFusion MX 7 Raymond Camden August 30, 2006
    2. 2. Contact Information <ul><li>Raymond Camden </li></ul><ul><li>VP of Technology, roundpeg, Inc. </li></ul><ul><li>[email_address] </li></ul><ul><li>[email_address] </li></ul><ul><li>Blog: http://ray.camdenfamily.com </li></ul>
    3. 3. Overview <ul><li>The Old Days </li></ul><ul><li>Introduction to Application.cfc </li></ul><ul><li>onApplicationStart/End </li></ul><ul><li>onSessionStart/End </li></ul><ul><li>onRequestStart/End </li></ul><ul><li>onError </li></ul><ul><li>onRequest </li></ul><ul><li>Things to Look Out For… </li></ul>
    4. 4. The Old Days
    5. 5. Application.cfm <ul><li>Loaded before any ColdFusion page </li></ul><ul><li>CF looks in current, and parent folders </li></ul><ul><li>It’s really just an “automatic include”! </li></ul><ul><li>Uses <cfapplication> to define application </li></ul>
    6. 6. OnRequestEnd.cfm <ul><li>Loaded at the end of a CFM page </li></ul><ul><li>CF looks in the current, and higher, folder </li></ul><ul><ul><li>But if it finds an Application.cfm file, it will stop looking </li></ul></ul><ul><li>It’s really just an “automatic include”! </li></ul>
    7. 7. Application.cfc – the Future is Now!
    8. 8. Application.cfc <ul><li>How is the file found? </li></ul><ul><li>Defining settings </li></ul><ul><li>Application.CFC Methods (think events) </li></ul>
    9. 9. Application.cfc - Settings <ul><li>Name </li></ul><ul><li>ApplicationTimeout </li></ul><ul><li>ClientManagement/ClientStorage/SetClientCookies </li></ul><ul><li>LoginStorage </li></ul><ul><li>ScriptProtect (new in CFMX7) </li></ul><ul><li>SessionManagement/SessionTimeout </li></ul><ul><li>setDomainCookies </li></ul>
    10. 10. Application.cfc - Methods <ul><li>onApplicationStart/End </li></ul><ul><li>onSessionStart/End </li></ul><ul><li>onRequestStart/End </li></ul><ul><li>onError </li></ul><ul><li>onRequest </li></ul>
    11. 11. onApplicationStart/End <ul><li>Runs when application starts and ends (duh). </li></ul><ul><li>There is no output when the application ends. </li></ul><ul><li>Skip to the example… </li></ul>
    12. 12. onApplicationStart/End - Uses <ul><li>Initializing Application Variables </li></ul><ul><ul><li>No need for locking! </li></ul></ul><ul><li>Logging </li></ul><ul><ul><li>How many users were using my application? </li></ul></ul><ul><ul><li>How long was my application alive? </li></ul></ul>
    13. 13. onSessionStart/End <ul><li>Runs when session starts and ends (duh). </li></ul><ul><li>There is no output when the session ends. </li></ul><ul><li>Pointers for Session/Application scope. </li></ul><ul><li>NOT run when application ends/server shuts down! </li></ul><ul><li>Skip to the example… </li></ul>
    14. 14. onSessionStart/End - Uses <ul><li>Initializing session variables </li></ul><ul><li>Logging </li></ul><ul><ul><li>Track number of users </li></ul></ul><ul><ul><li>How long did my session last? </li></ul></ul><ul><ul><li>What is the average lifespan of a session? </li></ul></ul><ul><ul><li>What was the last page of the session? </li></ul></ul><ul><ul><li>What was the first page of the session? </li></ul></ul>
    15. 15. onRequestStart/End <ul><li>Runs when request starts and ends (duh). </li></ul><ul><li>Just like Application.cfm and onRequestEnd.cfm. </li></ul><ul><li>Variables set in the method do not exist in your page. (An exception will be coming along shortly…) </li></ul><ul><li>Skip to the example… </li></ul>
    16. 16. onRequestStart/End - Uses <ul><li>Security </li></ul><ul><li>Setting request variables </li></ul>
    17. 17. onError <ul><li>Runs when an error occurs (duh). </li></ul><ul><li>Doesn’t reset the output </li></ul><ul><li>Bug: onError called with cfabort </li></ul><ul><li>Fixed with 7.0.2! (Not exactly) </li></ul><ul><li>http://corfield.org/blog/index.cfm/do/blog.entry/entry/onError_onRequest_and_cfabort </li></ul>
    18. 18. onRequest <ul><li>Allows specific control over the request. </li></ul><ul><li>You must cfinclude the file! </li></ul><ul><li>Copies methods, variables to Variables. </li></ul><ul><li>Breaks FR and Web Services. </li></ul><ul><ul><li>Workaround (From Sean Corfield) </li></ul></ul>
    19. 19. onRequest - Uses <ul><li>Print Format </li></ul><ul><li>Remove Whitespace </li></ul><ul><li>Used Rarely </li></ul>
    20. 20. Things to Consider… <ul><li>Loading UDFs </li></ul><ul><li>Extending Application.cfc </li></ul><ul><ul><li>Tech Note: http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=9ce734f4 </li></ul></ul><ul><ul><li>Sean Corfield’s Example: http://www.corfield.org/blog/index.cfm?do=blog.entry&entry=C8AF0DA4-0E78-FC9E-6975A16624A1E3C1 </li></ul></ul><ul><li>Converting from Application.cfm to Application.cfc </li></ul><ul><li>onRequest and WS/FR </li></ul>
    21. 21. Resources <ul><li>My Blog </li></ul><ul><ul><li>http://ray.camdenfamily.com </li></ul></ul><ul><li>Email Me </li></ul><ul><ul><li>ray@camdenfamily.com (home) </li></ul></ul><ul><ul><li>jedimaster@roundpeg.com (work) </li></ul></ul><ul><ul><li>Application.cfc Reference: </li></ul></ul><ul><ul><li>http://ray.camdenfamily.com/downloads/app.pdf </li></ul></ul>

    ×