*
The moose likes Servlets and the fly likes Server Name and URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Server Name and URL" Watch "Server Name and URL" New topic
Author

Server Name and URL

Sahil Sharma
Ranch Hand

Joined: Aug 27, 2003
Posts: 152
Hi all,

Small question I have.
If the link to my application is on four different portals, Then how can i
know in my application where the request has come from?I need to get the
server name and URL of the application from which my application was
requested.

Thanx
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

How is the server implemented ? Is it a servlet?


Groovy
Sahil Sharma
Ranch Hand

Joined: Aug 27, 2003
Posts: 152
thats correct.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Use the getRemoteAddr() of the HttpServletRequest interface.
http://java.sun.com/webservices/docs/1.4/api/javax/servlet/http/HttpServletRequest.html
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Moving to Servlet forum...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
Originally posted by Sahil Sharma:
Hi all,

Small question I have.
If the link to my application is on four different portals, Then how can i
know in my application where the request has come from?I need to get the
server name and URL of the application from which my application was
requested.

Thanx


Are you looking for something like a "referrer"?


James Carman, President<br />Carman Consulting, Inc.
vasu devan
Ranch Hand

Joined: Apr 14, 2005
Posts: 38
hi..

use getHostName() or getRequestURL() in http.servlet.http.HttpServletRequest object

cheers
vasu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Server Name and URL
 
Similar Threads
Server Name and URL
Displaying IP Address instead of domain name on url
how to hide application name in url
How I run my web application on browser after deploying it on Websphere Application Server 6
server id