cancel
Showing results for 
Search instead for 
Did you mean: 

Getting current portal url and port no

Former Member
0 Kudos

Dear all,

Please let me know how to get the current portal hostname and port no . We are accessing the port thru <b>virtual hostname</b> and not by physical server name. We are using EP 7.0 SP10 . I need this virtual hostname and port no to build the url to access the images stored in server from Web Dynpro. I have created http alias for the images folder in the server. I need to build the url like <http>://<hostname>:<port>/<image alias name>/***.jpg to access the images from server.

Pls also share any other suggestions to access the images from the sever thru web dynpro

Thanks in Advance.

Regards

Vasudevan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hai,

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

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

Regards,

Naga

Answers (2)

Answers (2)

Former Member
0 Kudos

Dear All,

I need to access the portal through http://<hostname>:<port>/irj/portal instead of http://<companyname>.com. Can anybody help me on this.

Also i need to know the port no. of my portal, how can i obtain this information through?

Please Help.

Regards,

Vinayak

Former Member
0 Kudos

here is a better way:

IWDRequest req = WDProtocolAdapter.getProtocolAdapter().getRequestObject();

int localPort = req.getServerPort();

String localhost = req.getServerName();

Former Member
0 Kudos

Hi friends.

I have used the last post, but it is not working.

Mat be the API had changed.

What class or interface could give me this data in web dynpro component?

Too, I'm using the SAP NetWeaver Developer Studio

Version: 2.0.16

Build id: 200602130353

Thank you.

Manuel Loayza

Living La Vida JAVA

Edited by: Manuel Loayza Gahona on Jul 23, 2008 6:54 PM

Former Member
0 Kudos

Which class are you not able to find?

This is the package for the wdrequest and protocol adapter:

com.sap.tc.webdynpro.services.sal.adapter.api.IWDRequest

com.sap.tc.webdynpro.services.sal.adapter.api.WDProtocolAdapter;

Former Member
0 Kudos

Hi Apurv.

The methods getServerPort() and getServerName() are not available in the IWDRequest implementation class.

I'm using the follwoing import statement:

import com.sap.tc.webdynpro.services.sal.adapter.api.IWDRequest;

import com.sap.tc.webdynpro.services.sal.adapter.api.WDProtocolAdapter;

Thank you.

Former Member
0 Kudos

I guess you have a very old library. See if you can get the latest NWDS coz the one that i am using is version 8.X.X

Former Member
0 Kudos

Dear apurv.

If I will get this version of IDE, could it make problems with Web AS when I have to deploy this component to the AS?.

Thank you

Former Member
0 Kudos

You will be able to compile it with the new IDE but it will throw runtime exception if that implementation is not present on the server. If you have OS level access to the server then you could do a file system search to find if that class is present.

I prefer DOS command over windows search options.

eg:

findstr /msi WDProtocolAdapter *.jar

Former Member
0 Kudos

Hi Vasudevan,

Try using the inet6Adress class for this it will provide you the nessecary details

Regards

Amit