• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

method returns server host

 
sridhar ponnusamy
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that HttpServletRequest extends ServletRequest, and thereby inherits quite a few useful methods from it.
 
sridhar ponnusamy
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes thanks...but which method returns that "www.myapp.com"
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you really not notice any method that looks like it might do that?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
sridhar ponnusamy
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic