Thanks for providing some more details on your use case. I'd suggest filing an
issue about this so the idea doesn't get lost.
Off the top of my head, if I was to implement this, it would probably be with
some kind of expression language so you could do something like:
@Property(name="filter", value="resource.path.startsWith('/content/siteA')")
Justin
On May 20, 2011, at 2:01 PM, "Levine, David" <[email protected]> wrote:
> Thanks, Justin. That could probably work. The idea here is that separate
> development teams will be working on what are effectively separate websites,
> but all deployed together in one server under separate context paths. So I'd
> like each individual site/team not to have to worry when binding items that
> they are using the same keys. And, of course, it would be good for requests
> only to execute the bindings they actually need, to save on overhead. So
> having the BindingsValuesProvider for each context path check the current
> resource for that path (e.g. "/foo/*" for FooBindingsValuesProvider, and
> "/bar/*" for BarBindingsValuesProvider) before binding anything should work.
>
> --David
>
>
> -----Original Message-----
> From: Justin Edelson [mailto:[email protected]] On Behalf Of Justin
> Edelson
> Sent: Friday, May 20, 2011 4:40 PM
> To: [email protected]
> Subject: Re: BindingsValuesProvider
>
> David-
> I think you could do this, albeit in a slightly roundabout fashion. In your
> BindingsValuesProvider you can inspect the current resource and inject the
> appropriate values depending on the resource path.
>
> Justin
>
> On May 20, 2011, at 1:30 PM, "Levine, David" <[email protected]> wrote:
>
>> Just to answer my own question for everyone, it looks to me like the answer
>> is "no". It seems like the code I'm interested in is
>> SlingScriptAdapterFactory, and it doesn't currently look for any sort of
>> property along those lines. Since I've never worked directly on Sling code
>> before (I'm just a user of the code), I'm not sure how involved a patch
>> would be to handle the kind of situation I'm thinking about. It would
>> probably also involve changes to DefaultSlingScript and possibly other
>> classes. I'll forget about this for now.
>>
>> --David
>>
>>
>> -----Original Message-----
>> From: Levine, David [mailto:[email protected]]
>> Sent: Friday, May 20, 2011 12:18 PM
>> To: [email protected]
>> Subject: BindingsValuesProvider
>>
>> I have a BindingsValuesProvider class to add my own objects. I'm using the
>> @scr.property name="javax.script.name" annotation to restrict it to being
>> called only for a specific scripting language. It works great. I've also
>> found no problem in having two BindingsValuesProviders for the same language
>> (both get executed). But is there a way to also restrict the bindings to a
>> specific URL prefix? I'd like to have one provider bind certain objects to
>> scripts run in one subtree in my site, and the other provider bind other
>> objects to scripts run in another subtree.
>>
>> Thanks,
>> --David
>>
>>
>>
>> **
>> This e-mail message is intended only for the designated recipient(s) named
>> above. The information contained in this e-mail and any attachments may be
>> confidential or legally privileged. If you are not the intended recipient,
>> you may not review, retain, copy, redistribute or use this e-mail or any
>> attachment for any purpose, or disclose all or any part of its contents. If
>> you have received this e-mail in error, please immediately notify the sender
>> by reply e-mail and permanently delete this e-mail and any attachments from
>> your computer system.
>
> ***
> Scanned
>
> **
> This e-mail message is intended only for the designated recipient(s) named
> above. The information contained in this e-mail and any attachments may be
> confidential or legally privileged. If you are not the intended recipient,
> you may not review, retain, copy, redistribute or use this e-mail or any
> attachment for any purpose, or disclose all or any part of its contents. If
> you have received this e-mail in error, please immediately notify the sender
> by reply e-mail and permanently delete this e-mail and any attachments from
> your computer system.