I am trying to customize the Embed component by introducing a new URL processor just like the example below
https://github.com/adobe/aem-core-wcm-components/tree/master/content/src/content/jcr_root/apps/core/...
On eclipse, all the imports are looking good and code is getting deployed to the local AEM instance. But the bundle is failing with the below issue
com.adobe.cq.wcm.core.components.internal.services.embed.UrlProcessorResultImpl -- Cannot be resolved
I am clueless on how to resolve this issue
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @bpeddapudi,
It is because you are using a class that is internal (implementation class) to Core Components (The one that is not exposed to use by other projects/bundle)
UrlProcessorResultImpl implements UrlProcessor.Result so while creating custom Url processor we need to provide similar implementation and override getOptions() and getProcessor() methods.
UrlProcessorResultImpl of Core : https://github.com/adobe/aem-core-wcm-components/blob/9dd529595b65a8441bd320b602584c2d568b6361/bundl...
Sample snippet for custom Url processor:
@Component(service = UrlProcessor.class)
public class CustomEmbedUrlProcessor implements UrlProcessor {
protected static final String NAME = "processor name";
protected static final String PIN_ID = "test";
protected static final String SCHEME = "some url pattern";
private Pattern pattern = Pattern.compile(SCHEME);
@Override
public Result process(String url) {
if (StringUtils.isNotEmpty(url)) {
Matcher matcher = pattern.matcher(url);
if (matcher.matches()) {
return new UrlProcessor.Result() {
@Override
public String getProcessor() {
return NAME;
}
@Override
public Map<String, Object> getOptions() {
return new HashMap<String, Object>() {{
put(PIN_ID, matcher.group(1));
}};
}
};
}
}
return null;
}
}
Hi @bpeddapudi,
It is because you are using a class that is internal (implementation class) to Core Components (The one that is not exposed to use by other projects/bundle)
UrlProcessorResultImpl implements UrlProcessor.Result so while creating custom Url processor we need to provide similar implementation and override getOptions() and getProcessor() methods.
UrlProcessorResultImpl of Core : https://github.com/adobe/aem-core-wcm-components/blob/9dd529595b65a8441bd320b602584c2d568b6361/bundl...
Sample snippet for custom Url processor:
@Component(service = UrlProcessor.class)
public class CustomEmbedUrlProcessor implements UrlProcessor {
protected static final String NAME = "processor name";
protected static final String PIN_ID = "test";
protected static final String SCHEME = "some url pattern";
private Pattern pattern = Pattern.compile(SCHEME);
@Override
public Result process(String url) {
if (StringUtils.isNotEmpty(url)) {
Matcher matcher = pattern.matcher(url);
if (matcher.matches()) {
return new UrlProcessor.Result() {
@Override
public String getProcessor() {
return NAME;
}
@Override
public Map<String, Object> getOptions() {
return new HashMap<String, Object>() {{
put(PIN_ID, matcher.group(1));
}};
}
};
}
}
return null;
}
}
Views
Replies
Total Likes
Views
Likes
Replies