バージョン2.5.2での新機能
バージョン2.5.2はバグフィックスがメインですが、2.5.0で盛り込めなかった機能も盛り込んでいます。リリースに関する詳細をご覧になりたい場合はリリースノート?をご覧下さい。
新しいインターセプトポイント: afterPluginCreation, afterHandlerCreation
今回導入した2つのインターセプトポイントはDI(dependency injection)やAOP、キャッシュと言ったような分野で役立ちます。この2つのインターセプトポイントを使うことで、ColdBoxアプリケーションのプラグインやイベントハンドラが作成された直後にインターセプトすることができます。
新しいインターセプター: Autowire
Thanks to the feature mentioned above, you can now use the autowire interceptor to wire up dependencies from an object factory like ColdSpring or LightWire into the following: 上で紹介した新しいインターセプトポイントを導入したことで、Autowireインターセプターを使用することができようになりました。Autowireインターセプターを使って、ColdSpringやLightWireなどのオブジェクトファクトリーを以下のような物に繋ぐことができます。
- プラグイン
- イベントハンドラ
- インターセプター
インターセプトにはメタデータを使っているため、非常に簡単にインターセプトすることができます。
- ColdBox設定ファイルにインターセプターの宣言を追加します
- プラグインやイベントハンドラ、インターセプターのCFCのcfcomponentタグにautowire=trueというメタデータを追加します
- 適切なgetter、setterメソッドを作成します
これだけの手順であらゆるColdBoxオブジェクトにインターセプトできます。
Persist Variables メソッドを公開しました
The persistVariables() method for relocating on set next event and rout has been exposed as an API method on the controller and supertype to permit flash memory of the request collection on demand. So now you can explicitly use this method to flash save variables into the flash memory of the framework and then relocate with confidence.
<cfset persistVariables('myObject,myArray,myString')> <!--- Relocate with Confidence ---> <cfset setNextRoute('main/home')>
新しいユーティリティー関数: isSSL()
isSSL()を使うことで、現在のリクエストにSSLが使用されているかどうかを知ることができます。
Lightwireの新しい関数: Containsbean()
付属のlightwire cfcにContainsbean関数を追加しました。この関数を使うことで、Lightwireにあるbeanが定義されているかどうかを調べることができます。
