Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

com.adobe.cq.wcm.core.components.internal.services.embed.UrlProcessorResultImpl -- Cannot be resolved

Avatar

Level 2

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

Screen Shot 2021-07-01 at 10.29.11 AM.png

2 Replies

Avatar

Community Advisor

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;
    }
}