The URL generation service enables you to generate Web addresses, including:
● URLs for Web Dynpro applications
● URLs for public Web resources (MIMEs)
● Path of the Web resource to public resources (MIMEs)
● Path of the file system to public resources
● URL of the Web resources download
// All used classes of the URL generation service are contained in package // com.sap.tc.webdynpro.services.sal.url.api
// Get root of public resource path, that is the file system path to // the directory in which public resources of the application server // are deployed String resourcePath = WDURLGenerator.getResourcePath();
// Get root of public resource path for the deployable object “Test” String depObjResourcePath = WDURLGenerator.getResourcePath(“Test”);
// Get Web resource path for a deployable object part, that is the first part // of the URL for a Web resource, that points to a directory in the scope of // the specified deployable object part WDDeployableObjectPart appPart = WDDeployableObject.getPart(“Test”, “TestApp”, WDDeployableObjectPart.APPLICATION); String webResourcePath = WDURLGenerator.getWebResourcePath(appPart);
// alternative method webResourcePath = WDURLGenerator.getWebResourceURL(appPart);
// Web resource URL for a specific MIME in the scope of the // deployable object part appPart String mimeURL = WDURLGenerator.getWebResourceURL(appPart, “images\icon.gif”);
// Absolute URL for that MIME String absoluteMimeURL = WDURLGenerator.getAbsoluteWebResourceURL(appPart, “images\icon.gif”);
// URL to the application specified by appPart String applicationURL1 = WDURLGenerator.getApplicationURL(appPart);
// alternative method String applicationURL2 = WDURLGenerator.getApplicationURL(“Test”, “TestApp”);
|
In addition, the URL generator enables a direct method call for the creation of URLs, thus providing direct access to the context of the application or the component. The methods areIWDApplication or IWDComponent.