Joshua,

Try something like the following:

import java.net.InetAddress;
import java.io.PrintWriter;

String remoteHost = request.getRemoteHost();
InetAddress clientAddr = InetAddress.getByName(remoteHost);
String dQuad = clientAddr.getHostAddress();
// Do something with the dotted quad address e.g., only allow
// local network access
if (!dQuad.startsWith("192.168.")) {
    PrintWriter out = response.getWriter();
    response.setContentType("text/plain");
    out.println("Go to hell " + dQuad);
}

Ideally, this would be done in a filter servlet.  Even more ideally, you'd
do this sort of filtering at the firewall level as your firewall will be
much better at spotting IP spoofing.

Chris.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to