Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > ServletRequest - can I get the host name exactly as requested?

Reply
Thread Tools

ServletRequest - can I get the host name exactly as requested?

 
 
pwfarwell@yahoo.com
Guest
Posts: n/a
 
      01-24-2006
I am seeing a problem with the ServletRequest getServerName() method.
On JBoss and Weblogic, this method returns the host name exactly as it
was specified in the request.

If the original request was:

http://fooHost/dir1/dir2/some.html

getServerName() returns "fooHost" as the server name for JBoss and
Weblogic.

But on Oracle Application Server, getServerName() returns the fully
qualified host name, e.g. "fooHost.acme.com". This causes problems with
an AJAX call that attempts to match "fooHost" with "fooHost.acme.com",
and fails because the two strings don't match (even though they point
to the same server).

Does any one know a more reliable way to get the host name (in a form
that matches the original request)? Is there a better option than
getServerName()?

 
Reply With Quote
 
 
 
 
Raymond DeCampo
Guest
Posts: n/a
 
      01-24-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I am seeing a problem with the ServletRequest getServerName() method.
> On JBoss and Weblogic, this method returns the host name exactly as it
> was specified in the request.
>
> If the original request was:
>
> http://fooHost/dir1/dir2/some.html
>
> getServerName() returns "fooHost" as the server name for JBoss and
> Weblogic.
>
> But on Oracle Application Server, getServerName() returns the fully
> qualified host name, e.g. "fooHost.acme.com". This causes problems with
> an AJAX call that attempts to match "fooHost" with "fooHost.acme.com",
> and fails because the two strings don't match (even though they point
> to the same server).
>
> Does any one know a more reliable way to get the host name (in a form
> that matches the original request)? Is there a better option than
> getServerName()?
>


The problem with Oracle AS is that you are likely accessing the
containers via Web Cache and/or Apache. When relaying the request,
Oracle probably uses the fully qualified domain name to find the next
node in the chain. So by the time it gets to the J2EE containers, there
may be no way to distinguish between a request for "foohost" and
"foohost.acme.com".

HTH,
Ray

--
This signature intentionally left blank.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to retreive the ServletRequest time srini.vinod@gmail.com Java 13 01-14-2008 02:57 AM
About content types and ServletRequest sasuke Java 3 12-24-2007 06:57 PM
ServletRequest and combo box newbie question Santosh Java 2 09-08-2004 06:08 PM
ServletRequest.setAttribute question Joerg Gippert Java 2 07-30-2003 11:28 PM
request.getHeader("Host") returns wrong host name Orpheus66 Java 0 07-30-2003 02:59 PM



Advertisments