Thanks Justin --

Adapting the resource itself was the best solution.  

We're resolving resources to concrete types that implement well-known 
interfaces that allow us some polymorphism and abstraction from the properties 
as they exist directly in the repo.

Best,
Dan


On Sep 8, 2011, at 10:12 PM, Justin Edelson wrote:


        Yeah, you're best bet in this case is to treat the request as the 
adaptable.
        
        If this was a real edge case and adapting the request was going to
        mess up your code too much, you could also stick the request in a
        ThreadLocal (I'd put that in a separate filter). But I think this has
        the tendency to make the code a bit hard to read.
        
        Justin
        
        On Thu, Sep 8, 2011 at 9:53 PM, Dan Check <[email protected]> wrote:
        > Hi all,
        >
        > I have a situation where I¹d like to vary the object returned by an
        > resource.adaptTo call based on selectors in the request.  Is it 
possible to
        > get access to the selectors inside of an adaptTo call?  If not, 
should I be
        > treating the request object as adaptable, rather than the resource?
        >
        > The use case here is that I need to return an object containing 
metadata
        > about the page itself; for most pages, that¹s contained with the 
resource
        > object alone, but for some, the metadata varies based on the 
selectors that
        > come in as part of the request.
        >
        > Thanks in advance for your help.
        >
        > Best,
        > Dan
        >
        


Reply via email to