|
1 | 1 | component {
|
| 2 | + // copy this to your application root to use as your Application.cfc |
| 3 | + // or incorporate the logic below into your existing Application.cfc |
| 4 | + |
2 | 5 | // you can provide a specific application name if you want:
|
3 |
| - this.name = 'fw1-examples'; |
| 6 | + this.name = 'fw1-examples'; |
| 7 | + |
4 | 8 | // any other application settings:
|
5 | 9 | this.sessionManagement = true;
|
| 10 | + |
| 11 | + // set up per-application mappings as needed: |
6 | 12 | this.mappings[ '/framework' ] = expandPath( '../framework' );
|
| 13 | + // this.mappings[ '/app' ] expandPath( '../path/to/app' ); |
| 14 | + |
| 15 | + function _get_framework_one() { |
| 16 | + if ( !structKeyExists( request, '_framework_one' ) ) { |
7 | 17 |
|
8 |
| - // create your FW/1 application: |
9 |
| - request._framework_one = new framework.one( { |
10 |
| - SESOmitIndex = true, |
11 |
| - diLocations = "model, controllers, beans, services", // to account for the variety of D/I locations in our examples |
12 |
| - // that allows all our subsystems to automatically have their own bean factory with the base factory as parent |
13 |
| - trace = true |
14 |
| - } ); |
| 18 | + // create your FW/1 application: |
| 19 | + request._framework_one = new framework.one( { |
| 20 | + SESOmitIndex = true, |
| 21 | + diLocations = "model, controllers, beans, services", // to account for the variety of D/I locations in our examples |
| 22 | + // that allows all our subsystems to automatically have their own bean factory with the base factory as parent |
| 23 | + trace = true |
| 24 | + } ); |
| 25 | + |
| 26 | + // you can specify FW/1 configuration as an argument: |
| 27 | + // request._framework_one = new framework.one({ |
| 28 | + // base : '/app', |
| 29 | + // trace : true |
| 30 | + // }); |
| 31 | + |
| 32 | + // if you need to override extension points, use |
| 33 | + // MyApplication.cfc for those and then do: |
| 34 | + // request._framework_one = new MyApplication({ |
| 35 | + // base : '/app', |
| 36 | + // trace : true |
| 37 | + // }); |
| 38 | + |
| 39 | + } |
| 40 | + return request._framework_one; |
| 41 | + } |
15 | 42 |
|
16 | 43 | // delegation of lifecycle methods to FW/1:
|
17 | 44 | function onApplicationStart() {
|
18 |
| - return request._framework_one.onApplicationStart(); |
| 45 | + return _get_framework_one().onApplicationStart(); |
19 | 46 | }
|
20 | 47 | function onError( exception, event ) {
|
21 |
| - return request._framework_one.onError( exception, event ); |
| 48 | + return _get_framework_one().onError( exception, event ); |
22 | 49 | }
|
23 | 50 | function onRequest( targetPath ) {
|
24 |
| - return request._framework_one.onRequest( targetPath ); |
| 51 | + return _get_framework_one().onRequest( targetPath ); |
25 | 52 | }
|
26 | 53 | function onRequestEnd() {
|
27 |
| - return request._framework_one.onRequestEnd(); |
| 54 | + return _get_framework_one().onRequestEnd(); |
28 | 55 | }
|
29 | 56 | function onRequestStart( targetPath ) {
|
30 |
| - return request._framework_one.onRequestStart( targetPath ); |
| 57 | + return _get_framework_one().onRequestStart( targetPath ); |
31 | 58 | }
|
32 | 59 | function onSessionStart() {
|
33 |
| - return request._framework_one.onSessionStart(); |
| 60 | + return _get_framework_one().onSessionStart(); |
34 | 61 | }
|
35 | 62 | }
|
0 commit comments