Hi,
My problem has gone away.
A short FYI on how I got past this problem...

First I tried adding a new request Builder method in QaModule using the
shadowbuilder service that would build my TestRequest. But that didn't work
because of a Request service implementation collision with predeclared (in
TapModule) service Request.class interface implementation. Only 1 Request
interface implementation is allowed, and TapModule beats me to the punch. I
don't want to mess with TapModule at all, so I abandoned this approach.

I ended up doing a minor kludge to sidestep this issue.

My new service layer method works NPE-free now.

    private Visit getVisit() {
        Request request = this.request;
        assert(request!=null);
        assert(requestGlobals!=null);
        Request currentRequest = requestGlobals.getRequest();
        if (currentRequest==null) {
            //only during unit testing will currentRequest be null
            //for testing we use a Mock request.
            requestGlobals.storeRequestResponse(new TestRequest(), null);
        }
        currentRequest = requestGlobals.getRequest();
        assert(currentRequest!=null);
        boolean visitExists = applicationStateManager.exists(Visit.class);
        assert(visitExists);
        Visit visit = applicationStateManager.get(Visit.class);
        assert(visit!=null);
        return visit;
    }

Thanks for your help guys.
Jon


On Thu, Jun 27, 2013 at 6:31 AM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Thu, 27 Jun 2013 09:07:24 -0300, Dmitry Gusev <dmitry.gu...@gmail.com>
> wrote:
>
>  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)<http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/RequestGlobals.html#storeRequestResponse(org.apache.tapestry5.services.Request,%20org.apache.tapestry5.services.Response)>
>>
>
> Good one, Dmitry! And also check http://tapestry.apache.org/**
> shadowbuilder-service.html<http://tapestry.apache.org/shadowbuilder-service.html>,
> which explains what a shadow service is (Request is one such service) and
> the example is . . . Request. :D
>
>
> --
> 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
>
>

Reply via email to