wood burning stoves 2.0*
The moose likes Servlets and the fly likes Getting Domain name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Getting Domain name" Watch "Getting Domain name" New topic
Author

Getting Domain name

Fawad Ali
Ranch Hand

Joined: Dec 28, 2009
Posts: 112
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.


Regards, Fawad Ali.
Software Engineer, Stafona Inc. - My Blog
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60045
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting Domain name
 
Similar Threads
Encript the password in jboss
Please Help!
Contacting a site fro URL Connection...
JMX error: NameNotFoundException
Retrieve partial domain name