예제 #1
0
  public static Object resolveBean(String beanName, TabScopeManager context) {
    FacesContext fc = FacesContext.getCurrentInstance();
    ExternalContext externalContext = fc.getExternalContext();
    if (externalContext instanceof ServletExternalContext) {
      HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();

      // save backup of current binding to cope with nested tags?
      Object contextBackup = request.getAttribute(PARAM_CURRENT_MANAGER);
      request.setAttribute(PARAM_CURRENT_MANAGER, context);
      try {
        return FacesUtils.getBeanFromContext(fc, beanName);
      } finally {
        if (null != contextBackup) {
          request.setAttribute(PARAM_CURRENT_MANAGER, contextBackup);
        } else {
          request.removeAttribute(PARAM_CURRENT_MANAGER);
        }
      }
    } else if (externalContext instanceof PortletExternalContext) {
      // TODO portlets
      trace.warn("Portlets are not yet supported.");
    }

    return null;
  }
 /** @return */
 public static ImageViewerConfigurationBean getCurrent() {
   return (ImageViewerConfigurationBean)
       org.eclipse.stardust.ui.web.common.util.FacesUtils.getBeanFromContext(BEAN_NAME);
 }