on 07-22-2009 6:36 AM
Hi all,
I need to initialize an IP address in my application with different values accordingly to system environment where I run my application(dev, qa, prod).How can I do this?
Thanks,
Michael Beilin
Hi,
use this code,
String IP = req.getRemoteAddr();
Regards,
sunaina Reddy T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try
{
String str = WDURLGenerator.getAbsoluteWebResourceURL("/");
if (str != null)
{
URL url = new URL(str);
result =
url.getProtocol()
+ "://"
+ url.getHost()
+ ":"
+ url.getPort();
}
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
The alternative way to achieve this is to use IWDRequest.
IWDRequest req=WDProtocolAdapter.getProtocolAdapter().getRequestObject();
wdComponentAPI.getMessageManager().reportSuccess(req.getServerName());
wdComponentAPI.getMessageManager().reportSuccess(""+req.getServerPort());
Regards,
Srikanth
Edited by: Srikanth Thatipally on Jul 22, 2009 10:04 AM
Edited by: Srikanth Thatipally on Jul 22, 2009 10:08 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael,
Here's how you can get the hostname :
import com.sap.tc.webdynpro.services.task.TaskBinder;
String hostname = TaskBinder.getCurrentTask().getProtocolAdapter().getServerName();
Or you could do something like this to get the IP address :
InetAddress inetaddr = InetAddress.getLocalHost();
String ipaddr = inetaddr.getHostAddress();
Regards,
Pierre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.