コード例 #1
0
 /**
  * @return actual ExoContainer instance.
  * @deprecated use {@link #getContainer(ServletContext)} instead
  */
 protected KernelContainer getContainer() {
   KernelContainer container = KernelContainerContext.getCurrentContainer();
   if (container instanceof RootContainer) {
     container = RootContainer.getInstance().getPortalContainer("portal");
   }
   return container;
 }
コード例 #2
0
  /**
   * @param sctx {@link ServletContext}
   * @return actual ExoContainer instance
   */
  protected KernelContainer getContainer(ServletContext sctx) {
    KernelContainer container = KernelContainerContext.getCurrentContainer();
    if (container instanceof RootContainer) {
      String containerName = null;
      // check attribute in servlet context first
      if (sctx.getAttribute(SetCurrentIdentityFilter.PORTAL_CONTAINER_NAME) != null)
        containerName = (String) sctx.getAttribute(SetCurrentIdentityFilter.PORTAL_CONTAINER_NAME);

      // if not set then use default name.
      if (containerName == null) containerName = "portal";
      container = RootContainer.getInstance().getPortalContainer(containerName);
    }
    return container;
  }