cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Portal URL -- http://server:port/irj - from WebDynpro code

Former Member
0 Kudos

Hi Friends,

Could anyone please let me know how to get the Portal URL from the WebDynpro. I mean by Portal URL as -<u><i><b> http://myserver:port/irj</b></i></u>;

Being irj as a webapplication, <b><i>how can we get this whole url from webdynpro?</i></b>

Thanks

Raghavendra

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

If it is not recommended to use TaskBinder class, then why does SAP have it in their documentation?

[HERE|http://help.sap.com/saphelp_nw04s/helpdata/en/bb/fdc4402418742ae10000000a155106/frameset.htm]

Former Member
0 Kudos

Got Answer!! its a workaround. I added the servlet.jar to buildpath of project and used the below code. Only problem i have is , How to identify which protocol the portal is using. ie., http or https. Current url works for http

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

String slPortNumber=String.valueOf(TaskBinder.getCurrentTask().getProtocolAdapter().getServerPort());

wdContext.currentContextElement().setImgAnon("http://" + slHostName + ":" + slPortNumber + "/irj/go/km/docs/documents/CompImages/comp-logo.jpg");

Thanks,

Raghavendra

Former Member
0 Kudos

Hi Raghavendra,

I want to retrieve the entire string at a time instead of retrieving the hostname and server port individually and appending them agian.

So can anyone help me in retreving the entire server url at a glance?

Regards

V. Suresh Kumar

Former Member
0 Kudos

This code uses non-API classes. It is strongly recommended not to use them.

Armin

Former Member
0 Kudos

Hi Raags,

I also got teh same problem, I need to fetch server host and port at runtime and I used the same code but its not workin. Actually its not able to resolve the protocol adapter. i tried organizing imports but it didnt worked. I have added servlet.jar in my libraries.

Kindly help.

Regards Manu

Former Member
0 Kudos

Here is a better way:

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

int localPort = req.getServerPort();

String localhost = req.getServerName();