cancel
Showing results for 
Search instead for 
Did you mean: 

Get current URL

Former Member
0 Kudos

Hi,

I have a Web Dynpro logon application. I have 1 portal with two different URLs. Depending on the URL, I want to give users a different role (with different content).

Is it possible to get the current URL from your browser in Web Dynpro?

Kind Regards,

David

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I do not want to get the URL of the application, but the url of the portal: e.g.: http://xxxxx:50000/irj/portal

Is this possible?

Best Regards,

David De Kerpel

Former Member
0 Kudos

Hi David,

You can use this code 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 portal URL.

Regards,

Satyajit.

Former Member
0 Kudos

Hi,

I think it is also possible to get it with WDSystemLandscape.getSLDHost() and WDSystemLandscape.getSLDPort()

or

with the ISystem class, something like

ISystems sys = (ISystems)WDPortalUtils.getServiceReference(ISystems.KEY);

By the way Satyajit I cannot get the method getURLService from wdComponetAPI. I am using SP15

Greetings,

Sandhya

Former Member
0 Kudos

Hi,

If you don't find the API that I have mentioned, then you can also use this:


WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getApplication().getDeployableObjectPart());

The method <i>WDSystemLandscape.getSLDHost()</i> returns the SLD host name, not your portal server name and likewise for the method <i>WDSystemLandscape.getSLDPort()</i>, it returns the SLD port number.

Regards,

Satyajit.

Answers (3)

Answers (3)

Former Member
0 Kudos

I can get the URL with one of the above methods, but I don`t need it anymore. thx for the help

Former Member
0 Kudos

This method:

WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getApplication().getDeployableObjectPart());

is depricated. Is there an other method I can use?

Former Member
0 Kudos

Hi David.

I use the following code to obtain the app URL:

String deployableObjectName = wdComponentAPI.getDeployableObjectPart().getDeployableObjectName();
		try {
			WDDeployableObjectPart deployableObjectPart =
				WDDeployableObject.getDeployableObjectPart( deployableObjectName, "PCT",
					WDDeployableObjectPartType.APPLICATION);
			
			String urlToTargetApp = WDURLGenerator.getApplicationURL(deployableObjectPart, new HashMap());
		} catch (WDURLException e) {
			manager.reportException(e.getLocalizedMessage(), false);
		} catch (WDDeploymentException ex) {
			manager.reportException(ex.getLocalizedMessage(), false);
		}

I hope it helps u.

Best Regards.

Gregory.

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

This will give u the current application url

try {

WDDeployableObjectPart part = wdThis.wdGetAPI().getComponent().getApplication().getDeployableObjectPart();

String appPath =WDURLGenerator.getApplicationURL(part);

wdComponentAPI.getMessageManager().reportSuccess("AppPath"+appPath);

} catch (WDURLException e1) {

wdComponentAPI.getMessageManager().reportException("Exception:"+e1,true);

}

In your case when u need the URL of another application

String depObjectName =

wdComponentAPI.getDeployableObjectPart().getDeployableObjectName();

WDDeployableObjectPart depObjectpart =

WDDeployableObject.getDeployableObjectPart(

depObjectName,

"<application name u want to navigate to>",

WDDeployableObjectPartType.APPLICATION);

String a = WDURLGenerator.getApplicationURL(depObjectPart) ;

Fire exit plug with this String a as the argument.

Regards,

Vijayakhanna Raman