{
throw new IllegalArgumentException("GetResource needs a valid resource id.");
}
// Create ResourceParams
ResourceParams resourceParams = WSRPTypeFactory.createResourceParams(params.isSecureClientCommunication(),
params.getLocales(), params.getMimeTypes(), params.getMode(), params.getWindowState(), resourceId,
WSRPUtils.getStateChangeFromAccessMode(accessMode));
resourceParams.setNavigationalContext(params.getNavigationalContext());
resourceParams.setClientData(params.getClientData());
resourceParams.setResourceCacheability(WSRPUtils.getResourceCacheabilityFromCacheLevel(invocation.getCacheLevel()));
for (Map.Entry<String, String[]> entry : invocation.getForm().entrySet())
{
String name = entry.getKey();
for (String value : entry.getValue())
{
resourceParams.getFormParameters().add(WSRPTypeFactory.createNamedString(name, value));
}
}
StateString resourceState = invocation.getResourceState();
if (resourceState != null)
{
String state = resourceState.getStringValue();
if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
{
resourceParams.setResourceState(state);
}
}
return WSRPTypeFactory.createGetResource(requestPrecursor.getRegistrationContext(), portletContext,
requestPrecursor.getRuntimeContext(), requestPrecursor.getUserContext(), resourceParams);