cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve the Hostname and port of the server

Former Member
0 Kudos

Hi,

How can i from my webdynpro code get the hostname and the port of the server in which the program is running?

Thanks in Advance!

Jo

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi All,

I could finally get the solution for this. Mostly this will work in NW04S - for versions prior to that, we can use the

getWebContextAdapter().getHttpServletRequest.getServer...

String hostName = TaskBinder.getCurrentTask().getProtocolAdapter().getServerName();

int port = TaskBinder.getCurrentTask().getProtocolAdapter().getServerPort();

Thanks!

Jo

Former Member
0 Kudos
Former Member
0 Kudos

Hi,

I want to construct a URL with the server on which the application is running - this is dynamic.

WDURLGenerator is not helping when i call teh URL from GP Runtime within the portal - so i am trying to construct the URL for the appplication that i need to open in a new window.

Thanks!

Jo

Former Member
0 Kudos

Hi Jo,

I think so u can retrive using this URL:

http://<host name>:<port number>/webdynpro/dispatcher/local/<Web Dynpro project>/<name of Web Dynpro application>.

check on to this link for more details:

http://help.sap.com/saphelp_erp2005/helpdata/en/7d/09044132bcef23e10000000a155106/frameset.htm

Hope tihs helps u,

Regards,

Nagarajan.

Former Member
0 Kudos

Hi Jo,

U can directly c ur host name and port of the server in ur j2ee engine itself.why do u want to get it through the code?

Regards,

Nagarajan.

Former Member
0 Kudos

Hi Jo,

Use following code to retrieve IP address or hostname of your server.

InetAddress n = InetAddress.getLocalHost();

String host_name = n.getHostAddress();

Regards,

Bhavik