private RequestContext getRequestContext( String ejbName, ActionType actionType,
Principal principal, RoleGroup callerRoles ) throws IOException
{
if(principal == null)
throw PicketBoxMessages.MESSAGES.invalidNullArgument("principal");
RequestContext requestCtx = RequestResponseContextFactory.createRequestCtx();
SubjectType subject = this.getSubjectType( principal, callerRoles );
ResourceType resourceType = getResourceType( ejbName );
EnvironmentType environmentType = getEnvironmentType();
RequestType requestType = getRequestType( subject, resourceType, actionType, environmentType );
requestCtx.setRequest( requestType );
return requestCtx;
}