@Override public boolean isActive() { PortletStateScopedBeanHolder holder = PortletStateScopedBeanHolder.getBeanHolder(); return (holder != null); }
/** * Removes the bean holder for the current request. Deletes all beans contained therein. * If response is provided, the beans are deserialized and stored. * * @param resp The response for setting the bean values */ public static void removeBeanHolder(StateAwareResponse resp) { PortletStateScopedBeanHolder bh = getBeanHolder(); if (bh != null) { bh.removeAll(resp); } holders.remove(); if (isTrace) { StringBuilder txt = new StringBuilder(80); txt.append("Removed render state bean holder."); txt.append(" ThreadId=").append(Thread.currentThread().getId()); LOG.trace(txt.toString()); } }
@Override public <T> T get(Contextual<T> bean, CreationalContext<T> crco) { PortletStateScopedBeanHolder holder = PortletStateScopedBeanHolder.getBeanHolder(); if (holder == null) { throw new ContextNotActiveException("The render state context is not active."); } // The bean hoder will return an existing bean instance or create a new one // if no existing instance is available. T inst = holder.getBean(bean, crco); return inst; }
@Override public <T> T get(Contextual<T> bean) { PortletStateScopedBeanHolder holder = PortletStateScopedBeanHolder.getBeanHolder(); if (holder == null) { throw new ContextNotActiveException("The render state context is not active."); } return holder.getBean(bean); }
PortletStateScopedBeanHolder.getBeanHolder(); Class<? extends PortletSerializable> beanClass = portletSerializable.getClass(); String name;