Sure, thanks for the light !

Christian

On Mon, Aug 31, 2009 at 8:01 PM, Dhanji R. Prasanna <[email protected]>wrote:

> It is valid, so long as you call provider.get() inside an HTTP request.
> If you step back a moment and look at this without Guice in the picture,
> just imagine what it means to have access to the session when there is no
> request running--it is rather meaningless (who's session is it?). What Guice
> does is let you make this a lazy reference (using Providers) so that you can
> still inject it but only use it when inside a request.
>
> Does that make it clearer?
>
> Dhanji.
>
>
> On Tue, Sep 1, 2009 at 9:53 AM, Christian Goudreau <
> [email protected]> wrote:
>
>> Does that mean that the solution Chris gave me isn't valid ?
>>
>> Christian
>>
>>   On Mon, Aug 31, 2009 at 7:41 PM, Dhanji R. Prasanna 
>> <[email protected]>wrote:
>>
>>> If your object is created outside a request, the session will not be
>>> available =(
>>> Dhanji.
>>>
>>>
>>> On Tue, Sep 1, 2009 at 9:04 AM, Christian Goudreau <
>>> [email protected]> wrote:
>>>
>>>> No, but I got my answer from Chris Lowe
>>>>
>>>> public class SomeHandler implements ActionHandler<YourAction,
>>>> YourResult> {
>>>>
>>>>  private final Provider<HttpSession> httpSession;
>>>>
>>>>  @Inject
>>>>  public SomeHandler(final Provider<HttpSession> httpSession) {
>>>>   this.httpSession = httpSession;
>>>>  }
>>>>
>>>>
>>>>  @Override
>>>>  public YourResult execute(final YourAction action, final
>>>> ExecutionContext context) throws ActionException {
>>>>   Object value = httpSession.get().getAttribute("valuename");
>>>>  }
>>>>
>>>> }
>>>>
>>>> I think I wasn't looking the right way at all. LOL
>>>>
>>>> Christian
>>>>
>>>>   On Mon, Aug 31, 2009 at 6:58 PM, Max Bowsher <[email protected]> wrote:
>>>>
>>>>> Damob wrote:
>>>>> > I don't know what I'm missing here or if it's because I'm using gwt-
>>>>> > Dispatch but, do I need to write something in the module class to get
>>>>> > it work ? I keep getting :
>>>>> >
>>>>> > 1) Error in custom provider, com.google.inject.OutOfScopeException:
>>>>> > Cannot access scoped object. Either we are not currently inside an
>>>>> > HTTP Servlet request, or you may have forgotten to apply
>>>>> > com.google.inject.servlet.GuiceFilter as a servlet filter for this
>>>>> > request.
>>>>>
>>>>> Well, *have* you forgotten to apply GuiceFilter then?
>>>>>
>>>>> Max,
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to