Hi,
I have externalizer configuration in AEM for publish as publish http://www.a.com. We have also many subdomains under a.com as b.a.com or c.a.com. We use mappings for both websites and its sub domains.
When i am trying to do externalizer.publishLink(resourceResolver, url) i am getting b.a.com instead of a.com. Everything looks correct with externalizer configuration. If i remove b.a.com mappings from map.local.publish then i am getting a.com as value. I am not sure why this is happening.
My assumption is when i do externalizer.publishLink then it goes to OSGI configuration and get the value present behind "publish". I am not sure from where subdomain host name is showing up.
Any thoughts are welcome.
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
As long you have correct config deployed to your instance, externalizer code work fine. You may want to ensure that configs in felix are deployed properly,
Also try using this externalizer.externalLink(resolver, "mydomain", "/my/page") for any custom domain
Views
Replies
Total Likes
Your understanding is correct, it picks the osgi config in front of publish.
Can you share your externalizer configs?
Views
Replies
Total Likes
Hi,
Below are the configs present in the externalizer OSGI configuration.
local https://localhost:5433
author http://author.a.com
publish http://www.a.com
mobile http://www.a.com
Technically, it should pick up link beside publish, but it is not picking up this.
Below is the code i have written for extracting link
package com.a.com.app;
import com.day.cq.commons.Externalizer;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.models.annotations.DefaultInjectionStrategy;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.injectorspecific.OSGiService;
import org.apache.sling.models.annotations.injectorspecific.Self;
import javax.annotation.PostConstruct;
@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class component {
@Self
SlingHttpServletRequest request;
@OSGiService
Externalizer externalizer;
private String externalizedPath;
private static final String LOCATION = "/location";
@PostConstruct
protected void init() {
setExternalizedPath(externalizer.publishLink(request.getResourceResolver(), LOCATION));
}
public String getExternalizedPath() {
return externalizedPath;
}
public void setExternalizedPath(String externalizedPath) {
this.externalizedPath = externalizedPath;
}
}
The output should be "http://www.a.com/location" but instead i am getting "http://b.a.com/location"
Thanks for any help
Views
Replies
Total Likes
As long you have correct config deployed to your instance, externalizer code work fine. You may want to ensure that configs in felix are deployed properly,
Also try using this externalizer.externalLink(resolver, "mydomain", "/my/page") for any custom domain
Views
Replies
Total Likes
Views
Likes
Replies