Hi,

Replying to my own post as it was a serious case of user error.

In particular, using a slightly inconsistent name for the objects put into 
and then pulled from the message attributes can cause very strange 
behaviour...

Feel free to laugh at my expense. :)

Regards,
Garry


On Sat, 23 Jan 2010, Garry Turkington wrote:

> Hi,
>
> In one route in my app I've got an Authenticator, two chained
> Authorizers and then a ServerResource resource instance.
>
> As part of the authentication and authorization processes -- not to
> mention the actual servicing of the request -- I need pull some
> objects from a backing store, currently a database.  Obviously I don't
> want to be doing this 4 times each call and was trying to add the
> object into the message attributes for reuse, e.g.:
>
> request.getAttributes().put("myobj", obj) ;
>
> The problem is that I can't reliably then pull this object back within
> the next object in the route.  In some cases it's worked, in others it
> hasn't.  For the sake of getting things working I've been taking the
> hit of the 4 database calls but obviously that's not a long-term
> solution.  I'll have an internal object cache which will cut out the
> additional db round trips but that's not finished yet and I want to
> understand what's going on.
>
> So is there some aspect of the lifecycle of attributes added to a
> message that I'm missing here?  Does it make any difference if
> components in the route are added by setNext(instance) as opposed to
> setNext(class literal)?
>
> Thanks,
> Garry
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2441383
>

-- 
Garry Turkington
[email protected]

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

Reply via email to