<form class="lift:authors.add?form=post">--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
To be precise, I want Authors to be a managed CDI bean so that I can inject stuff like @PersistenceContext.
For that to work, instead of constructing Actors via Reflection, I'd like to intercept this step to plug in my own way of creating instances selectively. IOW, some classes might not be managed, in which case I'd delegate to the standard Lift mechanism, but for those classes referenced from snippets that I know have some annotations, I'd like to create them via the CDI bean manager.
To be precise, I want Authors to be a managed CDI bean so that I can inject stuff like @PersistenceContext.
For that to work, instead of constructing Actors via Reflection, I'd like to intercept this step to plug in my own way of creating instances selectively. IOW, some classes might not be managed, in which case I'd delegate to the standard Lift mechanism, but for those classes referenced from snippets that I know have some annotations, I'd like to create them via the CDI bean manager.
På onsdag 09. januar 2013 kl. 09:45:27, skrev Galder Zamarreño <gal...@zamarreno.com>:To be precise, I want Authors to be a managed CDI bean so that I can inject stuff like @PersistenceContext.
For that to work, instead of constructing Actors via Reflection, I'd like to intercept this step to plug in my own way of creating instances selectively. IOW, some classes might not be managed, in which case I'd delegate to the standard Lift mechanism, but for those classes referenced from snippets that I know have some annotations, I'd like to create them via the CDI bean manager.I use AspectJ and AOP for injecting stuff into instances of classes I don't control the creation of. Even tho AOP is not the most popular mechanism on this list "it works for me". An example of this can be found here: https://github.com/andreak/on-example-rpm
/Jeppe
/Jeppe
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
<tr class="lift:authors.list">
<td class="name">Name</td>
<td><a class="books"></a></td>
<td><a class="edit">Edit</a></td>
</tr>
LiftRules.snippetDispatch.append {
case "*" =>
// take whatever is '*', figure out what the class name looked for is
// go to to bean manager and see if there's a bean for that class
// if no bean, present, act as Lift would normally do
// if bean present, call the method desired on the bean (i.e. list() in the above example)
...
David, thanks for the extra info. I'm still trying to get my head around this.Let's take a concrete example and let me explain if the following could work. Imagine someone writes a snippet like this:<tr class="lift:authors.list">
<td class="name">Name</td>
<td><a class="books"></a></td>
<td><a class="edit">Edit</a></td>
</tr>Can I write a rule for LiftRules.snippetDispatch that captures not only "authors.list" but any other name that might be given, i.e. in pseudo code:LiftRules.snippetDispatch.append {
case "*" =>
// take whatever is '*', figure out what the class name looked for is
// go to to bean manager and see if there's a bean for that class
// if no bean, present, act as Lift would normally do
// if bean present, call the method desired on the bean (i.e. list() in the above example)
...
Is something like this possible?