Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting Domain name  RSS feed

 
Fawad Ali
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I want to construct a link back to my site. So how can I get a domain name from the URL. My url looks like something below.



skild2 is the name of the war file deployed at http://devel.skild.com. I am using the following code but I am always getting it as a localhost and not devel.skild.com. I am using the following pieces of codes.



and



Any ideas on this? Thanks in advance BTW.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rather than going through all the hoops with the URL class, perhaps there is a more direct approach? Hint: look at the other methods on HttpServletRequest.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!