Search code examples
aemaem-6

how do I prepend domain name for a hyperlink authored in rte?


I have an email template which has several authored hyperlinks using RTE editor. For example:

<a href=\"/consumer/en-us/site-configurations/external-link/accounts.html

my java osgi service sends entire email template/page as an html to backend business layer which triggers the email.

how do I replace in osgi service <a href=\"/consumer/en-us/site-configurations/external-link/accounts.html to <a href=www.domain.com/consumer/en-us/site-configurations/external-link/accounts.html before email is triggered ?


Solution

  • following worked for me:

    Run through a pattern matcher using regex and extract the relative link. Pass it through externalizer. ReplaceAll the relativeLink with new link received from externalizer send the refined html back in business layer. put the entire code in static synchronized method.