| Author |
Hwo to find the origin of a request
|
Matt Brown
Ranch Hand
Joined: Jan 26, 2004
Posts: 69
|
|
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?
|
"I just use my muscles as a conversation piece, like someone walking a cheetah down 42nd Street." - Arnold Schwarzenegger
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
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.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Matt Brown
Ranch Hand
Joined: Jan 26, 2004
Posts: 69
|
|
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
Joined: Dec 11, 2004
Posts: 13410
|
|
|
If a machine is behind a subnet, you're not going to be able to get it's internal IP.
|
 |
Matt Brown
Ranch Hand
Joined: Jan 26, 2004
Posts: 69
|
|
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.
|
 |
 |
|
|
subject: Hwo to find the origin of a request
|
|
|