IP servlet 1.2

    It is a Java servlet lets you request client's IP address. Servlet simply returns IP address. If you are providing a parameter callback than server returns data in JSONP format - so you will be able to use client's IP in your JavaScript applications.

How to use it:

a) copy ipPackage.jar into your WEB-INF/lib directory.

b) define a servlet in your web.xml file:


define a mapping:


Servlet accepts the following parameters:

callback - Optional parameter. Describes a name for your JavaScript callback

    The following example illustrates the usage. JavaScript function f describes our callback.

<script language="JavaScript">

function f(info)
  alert("Client's IP: "+info);


var e = document.createElement("script");
e.src = 'http://your_server/servlet/ip?callback=f';


    For downloading:  ipPackage.jar   

  © Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: