[CUBBY-233] Guice でアクションを登録する方法の変更 Created: 2009-06-19 Updated: 2009-08-24 Resolved: 2009-06-25 |
|
Status: | Closed |
Project: | Cubby |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | 2.0.0-rc1 |
Type: | Improvement | Priority: | Major |
Reporter: | baba | Assignee: | baba |
Resolution: | Fixed | Votes: | 0 |
Labels: | None |
Description |
Guice のモジュールからアクションを登録する方法を変更します。 bind() メソッドで登録されたクラスがアクションだった場合に、自動的に PathResolver に登録します。 beta3 まで @Override protected void configure() { install(new ServletModule()); install(new AbstractCubbyModule() { @Override protected PathResolver getPathResolver() { final PathTemplateParser pathTemplateParser = new PathTemplateParserImpl(); final PathResolver pathResolver = new PathResolverImpl( pathTemplateParser); pathResolver.add(IndexAction.class); pathResolver.add(HelloAction.class); return pathResolver; } }); } beta4から @Override protected void configure() { install(new ServletModule()); install(new CubbyModule()); install(new FileUploadModule()); bind(IndexAction.class); bind(HelloAction.class); } |
Comments |
Comment by baba [ 2009-06-25 ] |
こんなふうに Module でパスを設定することも検討してみました。 path("/foo/bar").onSubmit("execute").priority(1).bind(FooAction.class, "bar").to(FooActionImpl.class); bind はクラスについて処理するのに対し、Cubby のパスはメソッドに対して紐付けられます。 |