cancel
Showing results for 
Search instead for 
Did you mean: 

Get server name in webdynpro application

Former Member
0 Kudos

Hello everybody,

I want to get server name on which my application is deployed in webdynpro application in coding. So any method or procedure to get server name? If anybody knows then please help its very urgent.

Thanks in Advance,

Bhavik

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bhavik ,

Please find the code below

HttpServletRequest request =Task.getCurrentTask()

.getWebContextAdapter()

.getHttpServletRequest();

String ServerName=request.getServerName();

String port=request.getServerPort();

Regards, Anilkumar

Former Member
0 Kudos

Hi,

You can use the InetAddress class get the hostname

InetAddress n=InetAddress.getLocalHost();

String name=n.getHostName();

Hope this would solve your problem

Do send in your feedback

Regards

Noufal

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Bhavik,

again: you utilize internal API. Read the SDN WebLog Never Ever Hijack Internal Web Dynpro Classes and Interfaces (/people/bertram.ganz/blog/2005/02/02/never-ever-hijack-internal-web-dynpro-classes-and-interfaces) concerning how to use the public Web Dynpro API without losing backward compatability.

Unfortunately there is no public API available in NW04 for accessing this information.

Regards, Bertram

Former Member
0 Kudos

Hi,

As the program runs in the server InetAddress n.gethostname() would return the server name. It works. I have even tried it out.

former_member185029
Active Contributor
0 Kudos

Hi,

InetAddress only gives server name.

What if I need complete path as

http://<servername>.<domain>:<portname>;

I got <servername>.<domain> by getCanonicalHostName method. I need port number as well.

is there anyway we can track this path?

Ashutosh

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

... or SELECT * FROM "SYS"."GLOBAL_NAME", then parse.

greetings

Walter