I meant whether you would find it useful/necessary to be able to bind
something in request scope and have it injected into your resources. An
artificial example off the top of my head:

// binding code
bind(Scratchpad.class).in(RequestScoped.class);

// Resource code
public class MyResource extends ServerResource {
    @Inject MyResource(Scratchpad scratchPad) { ... }
    ...
}

It's not hard to accomplish if it doesn't have to be related to servlet
request scope, but I wonder if there's any point to it. I have a feeling I'm
forgetting something obvious.

--tim


On Mon, Nov 23, 2009 at 5:50 PM, Leigh L. Klotz, Jr.
<leigh.kl...@xerox.com>wrote:

>  Sorry for joining in the middle and not paying attention. Do you mean a
> scope annotation on the Resource class itself?  I have so far not seen a
> need for any scope other than the implicit request scope. We do make use of
> objects from other scopes from within Resources, but I believe you're not
> asking that question.
>
> Leigh.
>
>  ------------------------------
> *From:* tpeie...@gmail.com [mailto:tpeie...@gmail.com] *On Behalf Of *Tim
> Peierls
> *Sent:* Monday, November 23, 2009 2:35 PM
>
> *To:* discuss@restlet.tigris.org
> *Subject:* Re: Dependency injection in Restlet 2.0 with Guice
>
>   <snip>
>
> Another topic: What about scopes? Servlets need scopes like request,
> session, conversation, etc. Only the first of those makes any sense in
> Restlet, but I'm having trouble imagining a strong need for it in practice,
> given that Resources are fundamentally request-scoped. Does anyone have an
> example of a need for binding in request scope that isn't trivially
> satisfied by Restlet already?
>
> --tim
>
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2423621

Reply via email to