// registration context
registrationContext = wsrpConsumer.getRegistrationContext();
// create runtime context
SecurityContext securityContext = invocation.getSecurityContext();
ParameterValidation.throwIllegalArgExceptionIfNull(securityContext, SECURITY_CONTEXT);
String authType = WSRPUtils.convertRequestAuthTypeToWSRPAuthType(securityContext.getAuthType());
String portletInstanceKey = WSRPTypeFactory.getPortletInstanceKey(invocation.getInstanceContext());
String namespacePrefix = WSRPTypeFactory.getNamespacePrefix(invocation.getWindowContext(), getPortletHandle());
runtimeContext = WSRPTypeFactory.createRuntimeContext(authType, portletInstanceKey, namespacePrefix);
WSRPPortletInfo info = wsrpConsumer.getPortletInfo(invocation);
// user context
userContext = wsrpConsumer.getUserContextFrom(info, invocation, runtimeContext);
// templates
wsrpConsumer.setTemplatesIfNeeded(info, invocation, getRuntimeContext());
// set the session id if needed
wsrpConsumer.getSessionHandler().setSessionIdIfNeeded(invocation, getRuntimeContext(), getPortletHandle());
// create markup params
org.gatein.pc.api.spi.UserContext userContext = invocation.getUserContext();
ParameterValidation.throwIllegalArgExceptionIfNull(userContext, USER_CONTEXT);
PortletInvocationContext context = invocation.getContext();
ParameterValidation.throwIllegalArgExceptionIfNull(context, INVOCATION_CONTEXT);
final MediaType contentType = context.getResponseContentType();
ParameterValidation.throwIllegalArgExceptionIfNull(contentType, CONTENT_TYPE);
String mode;
try
{
mode = WSRPUtils.getWSRPNameFromJSR168PortletMode(invocation.getMode());
}
catch (Exception e)
{
log.debug("Mode was null in context.");
mode = WSRPConstants.VIEW_MODE;
}
String windowState;
try
{
windowState = WSRPUtils.getWSRPNameFromJSR168WindowState(invocation.getWindowState());
}
catch (Exception e)
{
log.debug("WindowState was null in context.");
windowState = WSRPConstants.NORMAL_WINDOW_STATE;
}
this.markupParams = WSRPTypeFactory.createMarkupParams(securityContext.isSecure(),
WSRPUtils.convertLocalesToRFC3066LanguageTags(userContext.getLocales()),
Collections.singletonList(contentType.getValue()), mode, windowState);
String userAgent = WSRPConsumerImpl.getHttpRequest(invocation).getHeader(USER_AGENT);
getMarkupParams().setClientData(WSRPTypeFactory.createClientData(userAgent));
getMarkupParams().getExtensions().addAll(ExtensionAccess.getConsumerExtensionAccessor().getRequestExtensionsFor(MarkupParams.class));