ExoContainer container = ExoContainerContext.getCurrentContainer();
RedirectCookieService redirectCookieService = (RedirectCookieService) container
.getComponentInstanceOfType(RedirectCookieService.class);
// Determine the URL for the site so we can use this for the cookie path
PortalURLContext urlContext = new PortalURLContext(context, SiteKey.portal(origin.getName()));
NodeURL url = urlFactory.newURL(NodeURL.TYPE, urlContext);
String path = url.setResource(new NavigationResource(SiteType.PORTAL, origin.getName(), "")).toString();
// We have to check for the '/' at the end of the path since the portal could be accessed under /portal/classic or
// /portal/classic/
// Removing the tailing slash means both urls will see the cookie.