What am I supposed to write in the extends file to support overlays? How to make sure that the /apps script is preferred over the /libs script? Thanks, Konrad
> On 30. Jul 2021, at 10:07, Radu Cotescu <r...@apache.org> wrote: > > Hi Konrad, > > Take a look at this resource type [0] and the capability it generates: > > sling.servlet; > > sling.servlet.resourceTypes:List<String>="/apps/sling/scripting/examplebundle/precompiled/ttest,sling/scripting/examplebundle/precompiled/ttest"; > scriptEngine=htl; > scriptExtension=html, > sling.servlet; > > sling.servlet.resourceTypes:List<String>="/apps/sling/scripting/examplebundle/precompiled/ttest,sling/scripting/examplebundle/precompiled/ttest"; > scriptEngine=htl; > scriptExtension=html; > sling.servlet.selectors:List<String>=template > > And also have a look at [1]. If your scripts are in a folder that starts with > a search path, the plugin will generate two resource types - an absolute and > a relative one. So I think that SLING-10688 is already handled. Let me know > if you see otherwise. > > Regards, > Radu > > > [0] - > https://github.com/apache/sling-org-apache-sling-scripting-bundle-tracker-it/tree/master/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/apps/sling/scripting/examplebundle/precompiled/ttest > > <https://github.com/apache/sling-org-apache-sling-scripting-bundle-tracker-it/tree/master/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/apps/sling/scripting/examplebundle/precompiled/ttest> > [1] - > https://sling.apache.org/components/scriptingbundle-maven-plugin/metadata-mojo.html#searchPaths > > <https://sling.apache.org/components/scriptingbundle-maven-plugin/metadata-mojo.html#searchPaths> > > >> On 29 Jul 2021, at 17:29, Konrad Windszus <konra...@gmx.de> wrote: >> >> At least the https://github.com/apache/sling-scriptingbundle-maven-plugin >> <https://github.com/apache/sling-scriptingbundle-maven-plugin> always >> creates absolute resource types. I created >> https://issues.apache.org/jira/browse/SLING-10688 >> <https://issues.apache.org/jira/browse/SLING-10688> for also optionally >> creating relative resource types... >> Still this would rather be a workaround because I would assume that for >> bundled scripts it often makes sense to provide the capability with an >> absolute path while requiring the capability with a relative path (to allow >> overlays). But that would obviously never match in OSGi.... >> >> Konrad >> >>> On 29. Jul 2021, at 16:55, Konrad Windszus <konra...@gmx.de> wrote: >>> >>> Hi, >>> With bundled scripts the extends attribute of the sling.servlet capability >>> defines the resource type one extends >>> (https://github.com/apache/sling-org-apache-sling-servlets-resolver#how >>> <https://github.com/apache/sling-org-apache-sling-servlets-resolver#how>). >>> It is not specified though if the resource type should be absolute (i.e. >>> start with a "/") or can be relative (and is looked up by prefixing it with >>> any of the resource resolver search paths) but I guess it is the former. >>> I know that resource resolver search paths are not directly related to >>> servlet resolving from bundles but they are extremely handy as they allow >>> to overlay scripts from "/libs" in "/apps". >>> >>> How can the same be achieved with bundled scripts? >>> I don't want to depend on bundle loading order and have a predictable >>> servlet resolution. >>> What is the recommended way to globally overlay a bundled script from >>> another bundle? >>> >>> Thanks, >>> Konrad >>> >> >