Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hwo to find the origin of a request

 
Matt Brown
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Servlet that need to handle the requests from different companies.
How do I find the origin of the requests, i.e., from which company the request
was sent? Can I get very fine level to know which computer send the
request?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a slew of methods in HttpServlet request and it's parent ServletRequest such as getRemoteAddr, getRemoteHost, getHeaders, etc...
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletRequest.html

You could also map the company to the user's JSPSESSIONID when they log in.
 
Matt Brown
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the remote IP address I got from these APIs, for example, request.getRemoteAddr(), at desktop/laptop computer
level or at the server level of the remote company?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a machine is behind a subnet, you're not going to be able to get it's internal IP.
 
Matt Brown
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I use a wireless router which can be
connected by many computers, Could I get the IP of the router? What if
the router is installed in a home, in a hotel, or within a
company network? I guess anything behind the router is in the subnet domain. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic