• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpServletRequest questions  RSS feed

 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guy's
I have a web app (go figure servlet - web app) standard url form https://foo.com/appName. It is on a cluster of IBM websphere servers being served by several nodes: hosta.foo.com, hostb.foo.com, hostc.foo.com


My question HttpServletRequest.getServerName() would it be foo.com or hosta.foo.com? (I think just foo.com) with HttpServletRequest.getLocalName() returning hosta.foo.com?

can someone one definitively confirm that behavior?? On my local dev env. It all shows up as localhost.
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you do a testing servlet and find out yourself?
 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that when I do that in my local dev env the httpServletRequest. Has"localhost".

I'm not allowed to set a remote debuger or install VM.

I guess I could find an old laptop to simulate requests for foo.com/app versus qa.foo.com/app versus ua.foo.com
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can configure alternate domain names to use in place of localhost for testing in your /etc/hosts file -- assuming you're on a real OS. If you are using Windows, I'm sure that there are other ways to do the same thing.

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Windows uses the same kind of host file as Unix-ish OSes. It's in %systemroot%\system32\drivers\etc\
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Ulf.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!