users@jersey.java.net

Re: [Jersey] Controlling Resource Class Creation

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Thu, 28 Oct 2010 12:47:42 +0200

Hi,

To support what you require we will either need to modify/extend the
Guice support a "greedy" configuration or you extend the code.

Have a look at the source here:

https://fisheye4.atlassian.com/browse/jersey/trunk/jersey/contribs/jersey-guice/src/main/java/com/sun/jersey/guice/spi/container/GuiceComponentProviderFactory.java?r=HEAD

https://fisheye4.atlassian.com/browse/jersey/trunk/jersey/contribs/jersey-guice/src/main/java/com/sun/jersey/guice/JerseyServletModule.java?r=HEAD

For example you can override the
GuiceComponentProviderFactory.getComponentProvider method.

In this case i think the simplest solution is to have a configuration
option that if set and there is no binding for the class then an error
is produced.

Could you please log an issue? this should be an easy fix.

Paul.

On Oct 23, 2010, at 1:34 PM, deepakjacob wrote:

>
> Hi,
>
> Is there a way to control Resource Class Creation (RootResource,
> SubResource
> and Providers ) - Currently I am using Guice as the IOCContainer,
> but the
> problem is, if the resource class is not having Inject, the
> resource will
> be created with Jersey's own mechanism
> ResourceComponentConstructor._construct(HttpContext) etc.
>
> I want to make sure that every resource class (RootResource,
> SubResource
> and Providers ) is created by Guice. Let it be an error if any other
> provider factory is used.
>
> Thanks in advance for letting me know about a place which is acting a
> centralized place for resource creation.
>
> NB. I am using Jersey 1.4
>
> Regards,
> DJ
>
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Controlling-Resource-Class-Creation-tp5665197p5665197.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>