Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Domain name

 
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
Pie
Posts: 64708
86
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