You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Sergio <se...@yahoo.com> on 2003/04/02 23:00:25 UTC
Retrieving Server IP Address
Hey All,
How do I get the server's IP address through the
turbine API? I know how to get the server's name, but
I need the IP address.
Thanks in advance,
Sergio
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
AW: Retrieving Server IP Address
Posted by Jürgen Hoffmann <jh...@byteaction.de>.
Hi,
How about:
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.apache.turbine.util.RunData;
import org.apache.velocity.context.Context;
import
de.byteaction.commons.turbine.modules.actions.EnhancedSecureAction;
public class DnsResolver extends EnhancedSecureAction
{
public DnsResolver()
{
}
public void doPerform(RunData data, Context context) throws
Exception
{
try
{
InetAddress[] addresses =
InetAddress.getAllByName(data.getServerName());
context.put("hostname", addresses[0].getHostName());
context.put("addresses", addresses);
}
catch (UnknownHostException e)
{
context.put("error", "HostNotFound");
}
}
protected boolean isAuthorized(RunData data) throws Exception
{
return super.isAuthorized(data);
}
}
Kind regards
Jürgen Hoffmann
ByteACTION GmbH
cert. Perl Programmer
cert. Linux System Administrator
cert. Java Programmer
-----Ursprüngliche Nachricht-----
Von: Sergio [mailto:serg80@yahoo.com]
Gesendet: Mittwoch, 2. April 2003 23:00
An: turbine-user@jakarta.apache.org
Betreff: Retrieving Server IP Address
Hey All,
How do I get the server's IP address through the
turbine API? I know how to get the server's name, but
I need the IP address.
Thanks in advance,
Sergio
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org