Thanks Jason for the response. I agree with you but my query was a little
different. Please allow me to explain this in detail:
*Scenarios:*
1. Consider following content structure
/content/site/en/home [cq:page]
  - breadcrumb [sling:resourceType=site/components/breadcrumb]
2. Consider following structure
/apps/site/components/breadcrumb
  - breadcrumb.jsp
  - mobile.jsp
/etc/site/components/breadcrumb
  - breadcrumb.jsp
  - mobile.jsp

Now if I want to render breadcrumb component using breadcrumb.jsp script, I
will just access url: <dns>/content/site/en/home/breadcrumb.html and to use
mobile.jsp script, url will be
<dns>/content/site/en/home/breadcrumb.mobile.html, since jsp extension has a
script engine defined. And I believe this is what you were also referring
to.

So far with me? To explain further, SlingServletResolver uses a
configuration "executionPath" to construct the folder where-in it has to
search for best match script using some weighted algorithm. So for example
if searchPath is [/apps, /libs, /etc], best script will be searched in
/apps/site/components/breadcrumb and then /libs/site/components/breadcrumb
and then /etc/site/components/breadcrumb. So Sling does a great job and help
me even separate views [I am talking about jsp files here] from component
definition. The only issue with this is that there is one-o-one mapping
between component and folder which can have these jsps. I have been trying
to figure out as to how I could manipulate executionpaths for a tenant vs.
another while both of them uses the same sling component. This will help us
leverage the same component across tenants but using different views/jsps as
per business need. So in short, I am trying following:

*Component Definition*
 /apps/site/components/breadcrumb

*Views/Scripts*
/etc/site/components/breadcrumb
   - breadcrumb.jsp
  -  mobile.jsp

/etc/site1/components/breadcrumb
   - breadcrumb.jsp
  -  mobile.jsp

/etc/site2/components/breadcrumb
   - breadcrumb.jsp
  -  mobile.jsp

Now I want that if <dns>/content/site1/en/home/breadcrumb.mobile.html is
fired, folders /etc/site1/components/breadcrumb &
/etc/site/components/breadcrumb be searched for best script match in this
order which means /etc/site1/components/breadcrumb/mobile.jsp to be used.
But if if <dns>/content/site2/en/home/breadcrumb.mobile.html is fired,
folders /etc/site2/components/breadcrumb & /etc/site/components/breadcrumb
be searched for best script match in this order which means
/etc/site2/components/breadcrumb/mobile.jsp to be used. I tried using
combination of ResourceDecorator and ResourceProvider with some success but
wanted to set experts view around the same.

Please let me know if this makes sense.



--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/One-Resource-to-multiple-views-in-different-locations-tp4061093p4062448.html
Sent from the Sling - Users mailing list archive at Nabble.com.

Reply via email to