how to get the dispatcher url in pages | Community
Skip to main content
Level 3
October 16, 2015
Solved

how to get the dispatcher url in pages

  • October 16, 2015
  • 3 replies
  • 1458 views
Please let me know as how can I get the dispatcher URL in the code and use the same in author and Publish instance.
 
In the Author instance showing the port number in the view source is fine.
 
But in Publish instance it must just display only the dispacther URL should not show the exact URL and port numb er
 

I have a dispatcher url as:-

 
http://www-qa.com/content/campaigns/website/en_US/page.html
 
 
In my code jsp I have added
 
String hostname= "http://"+ slingRequest.getServerName()+":"+slingRequest.getServerPort();
 
so when I add the code for images in the src I am adding SRC as src="<%= hostname %>/etc/designs/dsm/img/bottom-border.gif"  as mentioned below
 
 
<img src="<%= hostname %>/etc/designs/dsm/img/bottom-border.gif" width="640" height="33" />
 
 
 
So this add the actual cq server instead we want just the Dispatcher URL how could I achieve it
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by leeasling

I think you may want to look at using the Externalizer.  Here are some links for you:

http://docs.adobe.com/docs/en/cq/current/developing/externalizer.html

http://docs.adobe.com/docs/en/cq/current/javadoc/com/day/cq/commons/Externalizer.html

3 replies

leeaslingAccepted solution
Level 8
October 16, 2015
Scott_Brodersen
Level 8
October 16, 2015

Perhaps you need to configure a URL transformer, as described here: http://docs.adobe.com/docs/en/dispatcher/disp-domains.html#Rewriting%20Links%20to%20Non-HTML%20Files 

scott

Level 3
October 16, 2015

Thanks this solved the issue