I have created a common page which will be used by two different site, so I can not attach one desig path to this page (etc\design) for dialog configurations. I wanted to dynamically assign the design path to page before it is loading through server side (in sightly class associated to page).
How can I achieve this? Is there any API or setter method I can use to do the same?
Perhaps a nice source to look at is this:
This way you can imply your own custom logic to return a specific design at runtime.
My question was how to dynamically SET the design path. Reading is no thte problem.
All the above talks about GETing the design path, I want to SET the desing path using code at run time instead giving it as as page property.
It is not about determining at run time. I wanted to udpate the the design path at run time.
My page doesn't have desing path, so when page is loaded I wanted to assign it. There are certain conditions based on which at run time I need to setup design path out of multiple design path availble.
All above are talking about reading dynamically, my question is about setting update deisng path dynamically.
I'm guessing you're not quite getting the point of what I'm trying to say here.
In the link I provided, you can write some custom code to create an injector that you can use to SET the design of the page to anything you wish, at runtime, without modifying the JCR.
You simply need to return a Design instance, based on the criteria your use case has (e.g.: return Design instance A when the requested path is /content/site1 and return Design instance B if the path is /content/site2)
THat sounds good, but how. Can you please share some code snippet and API function which can support the setter method of current page design path and at which instance I should inject it? Like when page is laoded there are default classed under WCMUse.
The link that I provided above is a code snippet on an injector that you need to create yourself. Basically, this injector will react on any kind of resource being requested and allows you to manipulate that resource, before being rendered. Please, first take a good look at that link.
To get a design/style by in Java, you'll have to use a Designer instance (Designer ("The Adobe AEM Quickstart and Web Application.") )