users@jersey.java.net

Re: [Jersey] Resource Filter Factory injectables

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 12 Apr 2010 11:28:53 +0200

Hi John,

Can you share your ResourceFilterFactory code?

Paul.

On Apr 11, 2010, at 9:32 PM, John Lister wrote:

> Hi, I'm trying to create a resource filter by using a factory that
> determines which filter is required based on a number of factors but
> struggling with one issue.
>
> Because I create the filter objects in the factory class using new,
> I cannot use any injectable content within them, to get around this
> I'm injecting some things into the factory object and passing them
> as parameters to the filter classes. However I'm struggling to find
> a way to inject some types of content and wondered if any one can
> give me any advice. For example I would like to inject a
> @SessionScoped (or RequestScoped) bean and additionally an
> EntityManager but when I do using either Inject or Context I get
> nulls.
>
> To get around this at the minute I have a global resource filter
> that I can inject things into with no problems and I'm setting
> attributes on a HttpServletRequest object and retrieving them within
> the factory generated filters.
>
> Any ideas?
>
> Thanks
>
> John
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>