Skip to Content
avatar image
Former Member

How to get Server Port Number

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    May 17, 2006 at 07:02 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 17, 2006 at 09:06 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    May 29, 2006 at 09:09 AM

    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

    Add comment
    10|10000 characters needed characters exceeded