This content has been marked as final.
Show 1 reply
-
1. Re: Injection not workin in filter class
kragoth Mar 2, 2011 6:06 PM (in response to lucasmonsterrocha)Well, your FiltroCertificado isn't a Seam bean so no Bijection is going to take place.
You need to add the @Name annotation to the bean as well.
Take a look at the source code for any one of Seams built in filters.
They all start pretty much like this:
@Scope(APPLICATION) @Name("org.jboss.seam.web.ajax4jsfFilter") @Install(precedence = BUILT_IN, dependencies="org.jboss.seam.web.ajax4jsfFilterInstantiator") @BypassInterceptors @Filter public class Ajax4jsfFilter extends AbstractFilter { .... }
Now, obviously with the @BypassInterceptors annotation on the class the @In is still not going to work. So you have a couple of options.
- Remove the @BypassInterceptors annotation and let Seam do it's magic. (NOT RECOMMENDED: This will put a lot of very unnecessary overhead on your Filter and I'm not even sure it works...never tried :P).
- Instead of using the @In to get a reference to a Seam bean use the Component.getInstance() method.
I'm concerned though that you might be going the wrong way about the problem. (Using a filter that is) But, without knowing what those other Seam beans are for it is a bit hard. Filters are generally APPLICATION scoped so you want to make sure you understand that any state you have in the Filter is for EVERYONE.