• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

HttpServletRequest questions

 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67695
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Master Rancher
Posts: 43045
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67695
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Ulf.
 
reply
    Bookmark Topic Watch Topic
  • New Topic