Hi,
One way to do this is to extend from an existing ResourceConfig, say
PackagesResourceConfig if you are scanning then set the features/
properties in the constructor, and explicitly register you
ResourceConfig impl in the web.xml.
Paul.
On Aug 3, 2010, at 11:15 AM, Yoryos wrote:
> Hi James,
> I really like the way you can configure your application with guice
> servlet but having a dependency of 2mb just to do this is to much I
> think! Right now I do not use any king of IoC Container for my
> application.
>
>
> On Tue, Aug 3, 2010 at 11:35, James Strachan
> <james.strachan_at_gmail.com> wrote:
> On 2 August 2010 20:26, Yoryos <valotas_at_gmail.com> wrote:
> > Hi all,
> > is there a way to pragmatically config jersey filter? As I've seen
> on the
> > docs overriding the ServletContainer#initiate method should do the
> trick but
> > as I've seen I can not put there any king of properties. I've
> overridden it
> > to something like that:
> > @Override
> > protected void initiate(ResourceConfig rc, WebApplication wa) {
> > rc.getProperties().put(DefaultResourceConfig.FEATURE_REDIRECT,
> "true");
> > String[] filters = new String[]
> > {ResourceDebuggingFilterFactory.class.getName()};
> >
> rc
> .getProperties
> ().put(DefaultResourceConfig.PROPERTY_RESOURCE_FILTER_FACTORIES,
> > filters);
> > System.out.println(rc.getProperties());
> > super.initiate(rc, wa);
> > }
> > From the method above, the filter factories seems to work just
> fine but the
> > redirect future not. If I comment out the redirect feature and put
> it as a
> > filter's init-param it will work just fine. In both cases I see
> all the
> > properties defined just fine (from the System.out.println)
>
>
> As an aside you can configure Jersey inside your IoC container
>
> e.g. here's how I configure Jersey (and the Scalate servlets) using
> guice-servlet...
>
> http://github.com/scalate/scalate/blob/master/scalate-guice/src/main/scala/org/fusesource/scalate/guice/ScalateModule.scala
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>