See also:

http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/RequestGlobals.html#storeRequestResponse(org.apache.tapestry5.services.Request,%20org.apache.tapestry5.services.Response)


On Thu, Jun 27, 2013 at 4:04 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Thu, 27 Jun 2013 00:39:57 -0300, Jon Williams <
> williams.jonat...@gmail.com> wrote:
>
>  Hi,
>>
>
> Hi!
>
>
>  applicationStateManager.**getIfExists(Visit.class);
>>
>> ...java.lang.**NullPointerException: Unable to delegate method
>> invocation to property 'request' of <Proxy for
>> RequestGlobals(org.apache.**tapestry5.services.**RequestGlobals)>,
>> because the property is null.
>>
>
> This is expected. Unless the thread is a web request, it will fail.
>
>
>  As you can see the assert in my method proves the Request exits .
>>
>
> You're not quite right here. The Request, as a service, it does exist, but
> as a proxy. It (the Request service) is defined as invoking
> RequestGlobals.getRequest(). If the thread is not a web request,
> RequestGlobals won't have its request set, so the exception will occur.
>
>
>  It makes sense to me that with my testing app context for service layer
>> might (maybe should) not include a proper Request.
>>
>
> Request is a service and you can mock it usin EasyMock or some other mock
> framework.
>
>
>  failure i have an assert that checks the Request is not null. my assertion
>> seems to indicate the existence of a proper Request. ?? (or maybe it's
>> just a whacked-out  proxy?)
>>
>
> It's not a real Request and it's not a whacked-out proxy, as explained
> above.
>
> --
> Thiago H. de Paula Figueiredo
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org>
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Reply via email to