Hi ED,
a little bit more low level call of another WD url is done by the following code snippet:
//@@begin onActionRedirect(ServerEvent)
// Application is in the deployable object of the caller component in this case.
IWDDeployableObject componentDPO =
wdComponentAPI.getDeployableObjectPart().getDeployableObject();
String appName = "RedirApp";
WDDeployableObjectPart[] applicationParts =
componentDPO.getParts(WDDeployableObjectPartType.APPLICATION);
if (applicationParts == null || applicationParts.length == 0) {
throw new WDRuntimeException(
"Redirect error: No application parts available in: " + componentDPO.getName());
}
WDDeployableObjectPart appPart = null;
for (int idx = 0; idx < applicationParts.length; idx++) {
appPart = applicationParts[idx];
if (appPart.getShortName().equals(appName)) {
break;
}
appPart = null;
}
if (appPart == null) {
throw new WDRuntimeException(
"Redirect error: The application: "
+ appName
+ " is not a part of: "
+ componentDPO.getName());
}
Map urlParameters = new HashMap();
urlParameters.put(ClientConstants.APPLICATION_PREFIX + "Param1", "Parameter sent by caller.");
try {
String url = WDURLGenerator.getApplicationURL(appPart, urlParameters);
if (!Task
.getCurrentTask()
.getClient()
.sendRedirect(url, ClientConstants.SESSION_EXPIRED_REDIRECT_TYPE)) {
throw new WDRuntimeException(
"Redirect to application: "
+ appName
+ " in dpo: "
+ componentDPO.getName()
+ " failed.");
}
} catch (WDURLException e) {
throw new WDRuntimeException(e);
} catch (IOException e) {
throw new WDRuntimeException(e);
}
//@@end
Then, somewhere in the called app, you can receive the parameter of the sample by:
String param1 =
Task.getCurrentTask().getWebContextAdapter().getRequestParameter(
ClientConstants.APPLICATION_PREFIX + "Param1");
But beware! I'm not really sure, if this is really a "legal" way of calling another application.
Hope that helps.
Regards
Stefan
Add a comment