cancel
Showing results for 
Search instead for 
Did you mean: 

Help with redirecting URL from Web Dynpro

Former Member
0 Kudos

Hi,

I have a question regarding how i can construct a URL where i would like to forward the user from a WD app based on some user interaction.

The problem is that i need to know the protocol, server & host to resend the control to ( basically append these values to a url path that i have eg: <http(s)>://<host>:<port>/<the path i have>). With NW2004s, the request object is not exposed to us anymore, so i am wondering what is the best way to construct the url.

I have gone through various posts here and the one that came closest to accomplishing what i need is the one by Valery S which recommends creating a Servlet that captures the request info that i need and then calling the WD app including the info that i need as request parameters in the calling URL.

Before i do this, i want to see if anyone has been able to solve this through another approach.

Appreciate the inputs.

Best Regards

Renchy Thomas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Renchy,

Did you try using WDProtocolAdapter API for capturing the request object related stuff? You can get the request parameters like this:

WDWebContextAdapter.getWebContextAdapter().getRequestParameter("<key>")

You can get the host / port of the server using the TaskBinder API and then you can construct your URL.

String serverName = TaskBinder.getCurrentTask().getProtocolAdapter().getServerName();
int currentPort = TaskBinder.getCurrentTask().getProtocolAdapter().getServerPort();

Bala

Former Member
0 Kudos

Bala,

TaskBinder, ITask and result of getProtocolAdapter call are not part of public WD API. It's strongly not recommended to uses non-API classes.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Answers (4)

Answers (4)

Former Member
0 Kudos

Valery,

If it is not recommended to use TaskBinder, 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

Valery,

Actually, you got me wrong about the need to get the protocol/host/port of the server i need to send the call back to. Why i need to get it (from the request object or any where else) is that because the WD application gets called from a content management system that is on a different server and hence the need to send the call back.

I guess the HTTPDestination approach is difinitely an option, but does add the need to maintain the httpdestination everytime it changes in the future.

Thanks again.

Regards

Renchy Thomas

Former Member
0 Kudos

Hi,

Maybe you can make use of the "Suspend/Resume" plugs if you are using NW04s. You will find more details <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70215265-4f5c-2910-1aa9-94ad3209bc8c?prtmode=navigate">here</a>.

Regards,

Satyajit.

Former Member
0 Kudos

Valery,

Thanks for the response.

I know, within the server, it is easier to redirect. Infact i am already doing that. But i need to send the app control to another server which is a content management system. The WDProtocolAdapter interface doesn't give us the info regarding the protocol/host/port. As you pointed out to Bala's post, i can't use the TaskBinder interface too.

How do we get the protocol/host/port info. What is the reason to hide this info from the developers?

Thanks for the help.

Regards

Renchy

Former Member
0 Kudos

Renchy,

Now I see you are conflicting with yourself

On one hand, if you need to redirect to the application hosted on the same server you need no protocol/server/port parameters. And you confirmed that this works for you.

On other hand, you are complaining that WD doesn't know in advance the protocol/host/port of arbitrary server you are planning to redirect to. Well, as I understand this is not API issue, this is configuration issue. You just need some configurable way to store such settings.

If this is true, then I can suggest 2 options:

1. HTTPDestination -- you are setting and configuring destination via VisualAdministrator, then from your code you are lookup destinitation by logical name and get physical URL.

2. IWDConfiguration / WDConfiguration -- you are creating settings as regular properties file, after deployment you may tweak this property file with VisualAdministrator. From code you are using WDConfiguration API to read URL or parts of URL as properties.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi,

In the below option:

<b>1. HTTPDestination -- you are setting and configuring destination via VisualAdministrator, then from your code you are lookup destinitation by logical name and get physical URL.</b>

How do we lookup the destination by logical name? Can you please provide the code snippet?

Thanks,

Former Member
0 Kudos

Renchy,

To construct redirect URL that resides on the same server you do not need protocol/host/port.

Just fire an Exit plug with "Url" parameter (type string) where Url is relative Url on server -- something like /somePath?a=1&b=2

Check WebDynpro tutorials section on SDN for more details on <i>inter-application navigation</i>

Valery Silaev

SaM Solutions

http://www.sam-solutions.net