/** * To be called by the CDI extension afterDeploymentValidation method to * verify that the stored methods are consistent and to create the bean references. * * @param bm BeanManager needed to activate the beans. * @throws InvalidAnnotationException If the deployment is inconsistent or if the * beans cannot be instantiated. */ @Override protected void activateCustomScopes(BeanManager bm) { // Activate the custom scoped beans stateScopedConfig.activate(bm); sessionScopedConfig.activate(bm); }
/** * Sets the portlet session bean holder in a ThreadLocal object for the given * portlet session. If no bean holder exists in the session, a new one is created. * * @param req The portlet request * @return The render state bean holder */ public static void setBeanHolder(PortletRequest req, PortletStateScopedConfig config) { if (isTrace) { StringBuilder txt = new StringBuilder(80); txt.append("Setting render state bean holder."); txt.append(" ThreadId=").append(Thread.currentThread().getId()); txt.append(", config: ").append((config == null) ? "null" : config.getConfigAsString()); LOG.trace(txt.toString()); } PortletStateScopedBeanHolder holder = new PortletStateScopedBeanHolder(req, config); holders.set(holder); }
public String getParameterName(Class<?> beanClass) { return config.getParamName(beanClass); }
summary.addStateBeanErrorString(theClass, txt.toString()); } else { stateScopedConfig.addAnnotation(theClass, (RenderStateScoped) anno);
LOG.debug("ACB instance: " + acb + ", RS config: " + ((acb==null) ? "null" : acb.getSessionScopedConfig())); acb.getSessionScopedConfig().activate(beanmgr); acb.getStateScopedConfig().activate(beanmgr); } catch (Throwable t) { LOG.debug("Could not retrieve annotated config bean.");
/** * Remove & destroy all beans. if a response is provided, store the bean state. * * @param resp The state aware response */ protected void removeAll(StateAwareResponse resp) { for (Contextual<?> bean : beans.keySet()) { if (resp != null) { PortletSerializable thisBean = (PortletSerializable) beans.get(bean).instance; String[] vals = thisBean.serialize(); String pn = config.getParamName((Bean<?>) bean); resp.getRenderParameters().setValues(pn, vals); if (isTrace) { StringBuilder txt = new StringBuilder(128); txt.append("Stored parameter for portlet with namespace: "); txt.append(resp.getNamespace()); txt.append(", paramName: ").append(pn); txt.append(", Values: ").append(Arrays.toString(vals)); LOG.trace(txt.toString()); } } remove(bean); } } }
txt.append("PortletStateScopedBeanHolder configuration."); txt.append(" Annotated Beans: "); txt.append(getConfigAsString()); LOG.debug(txt.toString());
String parmName = config.getParamName((Bean<?>) bean); String[] vals = request.getRenderParameters().getValues(parmName); if (vals == null) {
formatToErrorString(config.getConfigAsString().split("\n")); } else {