aspose file tools*
The moose likes Servlets and the fly likes ipaddress in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ipaddress in servlets" Watch "ipaddress in servlets" New topic
Author

ipaddress in servlets

santosh akella
Ranch Hand

Joined: Oct 24, 2004
Posts: 32
hi

i have a login page developed in servlets..
i want the IPADDRESS of the user u calls this servlet can it be possible
how can this be done??
thank u
Frederic Filiatrault
Ranch Hand

Joined: Jul 12, 2004
Posts: 69
Hi !

Sure ! Here it is:


javax.servlet
Interface ServletRequest
public java.lang.String getRemoteAddr()

Returns the Internet Protocol (IP) address of the client or last proxy that sent the request. For HTTP servlets, same as the value of the CGI variable REMOTE_ADDR.

Returns:
a String containing the IP address of the client that sent the request





F.<br />SCJP, SCJD, SCWCD, SCBCD<br /> <br />Failure is not an option... It comes with the software bundle.
santosh akella
Ranch Hand

Joined: Oct 24, 2004
Posts: 32
thank u
i got it ....
well i want all the information passed by the user and create an XML file
for passing this information to another server .
how can i do this.

thank u once again
Frederic Filiatrault
Ranch Hand

Joined: Jul 12, 2004
Posts: 69
It goes back to HTTP request. All the info you received from the request are the only you can use. Look at the ServletRequest interface and HttpServletRequest. Does interface/classes will give you all the info that you can obtain from the client.

It makes sense, no ?

thk !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ipaddress in servlets