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: 39547
    
  27
Remember that HttpServletRequest extends ServletRequest, and thereby inherits quite a few useful methods from it.


Ping & DNS - updated with new look and Ping home screen widget
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: 39547
    
  27
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: 60053
    
  65

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
 
Similar Threads
Invoke struts action using relative path through URL class
request.getQueryString() doesn't work ?
Problem with favicon.ico
Modify struts url
Starting Multiple servers within one domain on WebLogic6.0