Using the Externalizer service

This section shows a few examples of how the Externalizer service can be used:

  1. To get the Externalizer service in a JSP:

    Externalizer externalizer = resourceResolver.adaptTo(Externalizer.class);
    
  2. To externalize a path with the ‘publish’ domain:

    String myExternalizedUrl = externalizer.publishLink(resolver, "/my/page") + ".html";
    

    Assuming the domain mapping:

    • publish https://www.website.com

    myExternalizedUrl ends up with the value:

    • https://www.website.com/contextpath/my/page.html
  3. To externalize a path with the ‘author’ domain:

    String myExternalizedUrl = externalizer.authorLink(resolver, "/my/page") + ".html";
    

    Assuming the domain mapping:

    • author https://author.website.com

    myExternalizedUrl ends up with the value:

    • https://author.website.com/contextpath/my/page.html
  4. To externalize a path with the ‘local’ domain:

    String myExternalizedUrl = externalizer.externalLink(resolver, Externalizer.LOCAL, "/my/page") + ".html";
    

    Assuming the domain mapping:

    • local https://publish-3.internal

    myExternalizedUrl ends up with the value:

    • https://publish-3.internal/contextpath/my/page.html
  5. You can find more examples in the Javadocs.

Experience Manager


Put the Customer at the Center and Build Relationships That Last a Lifetime

Online | Strategy Keynote | General Audience

First impressions last a lifetime. Great first impressions feel personal, connected, and relevant right from the start. From the first...

Wed, Mar 19, 2:30 PM PDT (9:30 PM UTC)

Register

Adobe Experience Manager Sites: Top Innovations

Online | Session | General Audience

Digital interactions are the most critical touchpoints in a customer journey. Brands need to maximize the impact of content to drive...

Tue, Mar 18, 2:00 PM PDT (9:00 PM UTC)

Register

Connect with Experience League at Summit!

Get front-row access to top sessions, hands-on activities, and networking—wherever you are!

Learn more