Hey Vkum,

We had the exact same problem, two sites, siteA and siteB, where there was a 
livecopy from siteA to siteB, but siteB had some specific header and footer 
components and stuff like that. How we solved this is by creating a filter that 
went over the resources of the request and when we detected that there was a 
specific implementation of a component for siteB, then we force this supertype.

So for example you have /apps/siteA/components/header and 
/apps/siteB/components/header. If we are in siteB and we see that there is a 
resourceType on the exact same location as the siteA/components/header for 
siteB: siteB/components/header, then we replace it:
final RequestDispatcherOptions requestDispatcherOptions = new 
RequestDispatcherOptions();
requestDispatcherOptions.setForceResourceType(siteSpecificResourceType);
Greets
Roy
> On 13 Jul 2016, at 19:02, vkum14 <[email protected]> wrote:
> 
> Ohhh now I see what you are saying. Makes sense for simple use cases but here 
> your breadcrumb is taking the responsibility of figuring out what script to 
> load. Consider for use cases where in you have to identify script based on 
> selector, extn etc, you will end up replicating what sling does very well. I 
> would like to leverage same capability here so if I could tell sling to use 
> scripts from different set of folders, nothing better than that.
> 
> On Jul 13, 2016 9:23 PM, "Jason Bailey [via Apache Sling]" 
> <[email protected] 
> <mailto:[email protected]>> wrote:
>> 
>> I've never needed to have the resource resolver select a different script. 
>> 
>> Referencing your example of breadcrumb.  I've had the main breadcrumb script 
>> import the specific implementation based on a configuration. 
>> 
>> /apps/www/components/breadcrumb/breadcrumb.jsp 
>> /apps/www/components/breadcrumb/breadcrumb-site1.jsp 
>> /apps/www/components/breadcrumb/breadcrumb-site2.jsp 
>> 
>> The main breadcrumb.jsp is always executed and within that script is the 
>> logic that determines which version of the breadcrumb we want to provide. At 
>> that point we pull in the relevant jsp to render the site specific markup. 
>> 
>> This keeps all your breadcrumb logic within a single structure. It also adds 
>> value in the form of being able to offer sites options on how they would 
>> like their breadcrumbs to look that could be controlled by configuration. 
>> 
>> 
>> 
>> -----Original Message----- 
>> From: vkum14 [mailto:[hidden email]] 
>> Sent: Wednesday, July 13, 2016 10:27 AM 
>> To: [hidden email] 
>> Subject: Re: One Resource to multiple views in different locations 
>> 
>> Hi Jason, 
>> 
>> I believe you are talking about css/js here while my use case is to have 
>> even different markups for the same component based on the site, it is being 
>> rendered. IMO, this is a typical use case of telling servletresourceresolver 
>> to pick different scripts based on the site input. Have you done some sorts 
>> of that? 
>> 
>> 
>> 
>> -- 
>> View this message in context: 
>> http://apache-sling.73963.n3.nabble.com/One-Resource-to-multiple-views-in-different-locations-tp4061093p4062511.html
>>  
>> <http://apache-sling.73963.n3.nabble.com/One-Resource-to-multiple-views-in-different-locations-tp4061093p4062511.html>
>> Sent from the Sling - Users mailing list archive at Nabble.com 
>> <http://nabble.com/>. 
>> 
>> 
>> ________________________________
>> If you reply to this email, your message will be added to the discussion 
>> below:
>> http://apache-sling.73963.n3.nabble.com/One-Resource-to-multiple-views-in-different-locations-tp4061093p4062524.html
>>  
>> <http://apache-sling.73963.n3.nabble.com/One-Resource-to-multiple-views-in-different-locations-tp4061093p4062524.html>
>> To unsubscribe from One Resource to multiple views in different locations, 
>> click here.
>> NAML
> 
> 
> 
> --
> View this message in context: 
> http://apache-sling.73963.n3.nabble.com/One-Resource-to-multiple-views-in-different-locations-tp4061093p4062529.html
>  
> <http://apache-sling.73963.n3.nabble.com/One-Resource-to-multiple-views-in-different-locations-tp4061093p4062529.html>
> Sent from the Sling - Users mailing list archive at Nabble.com 
> <http://nabble.com/>.

Reply via email to