cancel
Showing results for 
Search instead for 
Did you mean: 

Read entire URL with WD

Former Member
0 Kudos

Hi @ all,

I have to do some upgrade work for my WD application from 6.4 to version 7.0

I have some codings that don`t work anymore, where the Request URL was read out like this way:

HttpServletRequest request = (HttpServletRequest)WDProtocolAdapter.getProtocolAdapter().getRequestObject();

String url = (String) request.getRequestURL().toString();

With this i got values like this: http://sappep.server-customer.de:60000/irj/portal/anonymous/activation?guest_user=ep_selfreg_anon

In NW 7 this coding doesn`t work at all. There must be a new method of access I cannot find.

Please note: I need the entire url and not only the parameters of the url. How to get the url parameters I already got in an other document but how to get the entire url?

Thx in advance

Mathias

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello,

if you want to determine the url and port on which the application is running, you can use:


wdThis.wdGetAPI().getComponent().getApplication().getURLService().getGeneralService().getAbsoluteWebResourceURL(wdThis.wdGetAPI().getComponent().getDeployableObjectPart().getName()));
String[] url = wdContext.currentContextElement().getUrl().split("/");

Inside the url[] the ip is on position 2.

kind regards

Fabian

Former Member
0 Kudos

Hi friends.

I have tried the 2 previous responses, but both return the same value, and it is equals to:

../../sap.com/cafeugpuidt/AppWorkset

Then, I can't get the server name and the port number of the server.

Thank you for your response.

Manuel Loayza

Former Member
0 Kudos

Hi

Use this to get URL of deployed application


String appURL = null;
try {
	WDDeployableObjectPart currentAppPart =wdThis
						.wdGetAPI()
						.getComponent()
						.getApplication()
						.getDeployableObjectPart();
					
appURL = WDURLGenerator.getApplicationURL(currentAppPart);
					
} catch (final WDURLException ex) {
wdComponentAPI.getMessageManager().reportException(
					new WDNonFatalException(ex),
					false);
			}

Mandeep Virk

Former Member
0 Kudos

Hi,

If you know the name of the querystring parameter, then you can read it within your WD application like the following:


//let's say the URL is of the form http://<servername>:<port>/webdynpro/dispatcher/<package>/<component>/<Application name>?param1="abc"&param2="123"

String qParam1 = WDProtocolAdapter.getProtocolAdapter().getRequestParameter("param1");
String qParam2 = WDProtocolAdapter.getProtocolAdapter().getRequestParameter("param2");

For your requirement about server information, you can use


String serverName    = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getServerName();
String serverPort    = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getServerPort();

In case you don't see the above mentioned methods (I use CE), then you can also use the not-so-sophisticated way of reading the server information:


String appURL = WDURLGenerator.getWorkloadBalancedApplicationURL(wdComponentAPI.getApplication().getDeployableObjectPart());

/**
 *appURL will be of the form  http://<servername>:<port>/webdynpro/dispatcher/<package>/<component>/<Application name>
 *now you can do a standard string split to fetch the information
 */

Regards,

Satyajit.