cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Server Port Number

Former Member
0 Kudos

Hi All,

I need to get Server Host name & port number. I got the method for getting host name. But I am not get the method for port number. can give the code for that. please do the needful...

thanks nad regards

Praveen.D

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello Praveen ,

you can use WDURLGenerator.getAbsoluteWebResourceURL(deployableObjectPart)

This will give you the whole url of the application in a string format.

then u need to have a simple logic to get the substring of the url to get only the hostname:hostport.

Vinay

Former Member
0 Kudos

Hi

I think you can get the server name and server port number directly by using following the following:

WDSystemLandscape.getSLDHost()

and WDSystemLandscape.getSLDPort()

I hope it helps

Thanks and regards

Srikant

Former Member
0 Kudos

Hi,

Wouldn't that give you the host and port of the SLD-application server? This doesn't necessarily have to be the application server running Web Dynpros.

Regards

Mattias

Former Member
0 Kudos

Hi,

Try this (although it uses a deprecated API):


WDDeployableObjectPart d = wdComponentAPI.getDeployableObjectPart();
try{
String url = wdComponentAPI.getURLService().getGeneralService().getAbsoluteWebResourceURL(d);
}
catch(WDURLException e){
}

The url will be of the form http://<servername>:<serverport>/.

You can then do a bit of string indexing to find out the port number as well as the server hostname.

Regards,

Satyajit.

Message was edited by: Satyajit Chakraborty