try {
PortletContainerServices.prepare(uniqueContainerName);
final PortletWindowImpl portletWindow = (PortletWindowImpl)cd.getPortletWindow();
final PortletEntity portletEntity = portletWindow.getPortletEntity();
final PortletDefinition portletDef = portletEntity.getPortletDefinition();
final HttpServletRequest baseRequest = pcs.getHttpServletRequest();
HttpServletRequest wrappedRequest = new ServletRequestImpl(baseRequest, sd.getPerson(), portletDef.getInitSecurityRoleRefSet());
//Wrap the request to scope attributes to this portlet instance
wrappedRequest = new PortletAttributeRequestWrapper(wrappedRequest);
//Set up request attributes (user info, portal session, etc...)