File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Domain name

 
Fawad Ali
Ranch Hand
Posts: 116
  • 0
  • 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: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic