This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Server Name and URL

 
Sahil Sharma
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is the server implemented ? Is it a servlet?
 
Sahil Sharma
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thats correct.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Servlet forum...
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"?
 
vasu devan
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi..

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

cheers
vasu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic