users@jersey.java.net

Re: [Jersey] is there a way to get hold of the resource bean from inside a MessageBodyWriter? (and Lift templates are kinda working...)

From: James Strachan <james.strachan_at_gmail.com>
Date: Fri, 15 May 2009 11:56:27 +0100

2009/5/15 Paul Sandoz <Paul.Sandoz_at_sun.com>:
> Hi James,
>
> I just re-read your email and the requirements are a little different that i
> originally thought, namely you want the last matching instance of the
> resource class for a number of different scenarios.
>
> You can inject UriInfo and call:
>
>  UriInfo.getMatchedResources()
>
> the first item in the returned list will be the last matching resource class
> instance i.e. the one that returned a response. But be carefuly in some
> cases there will be no matching resources, for example if an exception
> mapper gets invoked e.g. because a filter throws an exception and the mapper
> creates a response with a Node instance.

Awesome thanks - works a treat!

-- 
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/