aspose file tools*
The moose likes Servlets and the fly likes method returns server host Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "method returns server host" Watch "method returns server host" New topic
Author

method returns server host

sridhar ponnusamy
Greenhorn

Joined: Sep 07, 2008
Posts: 19
which HttpServletRequest method returns host
for eg: my servletpath is http://www.myapp.com/myservlet/myaction.do

which method returns this "www.myapp.com"

thanks in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42624
    
  65
Remember that HttpServletRequest extends ServletRequest, and thereby inherits quite a few useful methods from it.


Ping & DNS - my free Android networking tools app
sridhar ponnusamy
Greenhorn

Joined: Sep 07, 2008
Posts: 19
yes thanks...but which method returns that "www.myapp.com"
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42624
    
  65
Did you really not notice any method that looks like it might do that?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Step 1) Write a servlet that calls the various methods
Step 2) Write the results to the console or response
Step 3) See which one returns the data you seek
Step 4) Profit!


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sridhar ponnusamy
Greenhorn

Joined: Sep 07, 2008
Posts: 19
yes i noticed, so many methods are there...but am running server locally,hence am getting localhost,8080....etc thats why am asking which method will meet my requirement....
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


yes i noticed, so many methods are there...but am running server locally,hence am getting localhost,8080....etc thats why am asking which method will meet my requirement....

So you have the hostname? I'm not sure what else you want? Are you trying to get the public DNS name for a specific IP address?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: method returns server host