Externalizer is an OSGI service using which we can update a resource path (e.g. /content/mycompany/my/page ) into an external and absolute URL (for example, https://www.mycompany.com/content/mycompant/my/page ) by prefixing the path with a pre-configured DNS.
As the instance in which the application is running can’t know its externally visible URL if it is running behind a web layer, and because sometimes a link has to be created outside of the request scope, this service provides a central place to configure those external URLs.
Configuration:
Navigate to /system/console/configMgr and configure the URL you want to use as part of the externalizer by mapping it in the Domains option.
<unique-name> [scheme://]server[:port], where:
- scheme is usually http or https.
- server is the hostname.
- port (optional) is the port number.
@Reference
Externalizer externalizer;
Externalizer externalizer = resourceResolver.adaptTo(Externalizer.class);
externalizer.publishLink(resolver, "/my/page") + ".html";
externalizer.authorLink(resolver, "/my/page") + ".html";
Externalizer externalizer;
Externalizer externalizer = resourceResolver.adaptTo(Externalizer.class);
externalizer.publishLink(resolver, "/my/page") + ".html";
externalizer.authorLink(resolver, "/my/page") + ".html";
No comments:
Post a Comment
If you have any doubts or questions, please let us know.