Permalink
Browse files

Add requestStart checks for application scope

  • Loading branch information...
matthewroach committed Dec 29, 2012
1 parent 8dbe99e commit 63dd91d29a69324ef2ed61c57fe3eb530f162c2e
Showing with 18 additions and 1 deletion.
  1. +18 −1 Application.cfc
View
@@ -10,12 +10,29 @@ component {
staticSettings = fileRead( expandPath('/settings.json') );
- application.m = CreateObject( "java" , "com.petebevin.markdown.MarkdownProcessor" );
+ application.m = CreateObject( "java" , "com.petebevin.markdown.MarkdownProcessor" );
application.settings = deserializeJSON( staticSettings );
application.pages = new api.private.pages();
}
+ function onRequestStart() {
+
+ if ( !structKeyExists( application, 'settings' ) ) {
+
+ staticSettings = fileRead( expandPath('/settings.json') );
+ application.settings = deserializeJSON( staticSettings );
+
+ }
+
+ if ( !structKeyExists( application, 'pages') ) {
+
+ application.pages = new api.private.pages();
+
+ }
+
+ }
+
function onError() {
location( '?/404' );

0 comments on commit 63dd91d

Please sign in to comment.