コード例 #1
0
  protected PortletWindowCache<IPortletWindow> getPortletWindowMap(HttpServletRequest request) {
    request = portalRequestUtils.getOriginalPortletOrPortalRequest(request);

    final String mapAttributeName = PORTLET_WINDOW_ATTRIBUTE + Thread.currentThread().getId();

    // No need to do this in a request attribute mutex since the map is scoped to a specific thread
    @SuppressWarnings("unchecked")
    PortletWindowCache<IPortletWindow> windowCache =
        (PortletWindowCache<IPortletWindow>) request.getAttribute(mapAttributeName);
    if (windowCache == null) {
      windowCache = new PortletWindowCache<IPortletWindow>(false);
      request.setAttribute(mapAttributeName, windowCache);
    }

    return windowCache;
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  protected PortletWindowCache<PortletWindowData> getStatelessPortletWindowDataMap(
      HttpServletRequest request, boolean create) {
    request = portalRequestUtils.getOriginalPortalRequest(request);

    PortletWindowCache<PortletWindowData> windowCache;

    final Object mutex = PortalWebUtils.getRequestAttributeMutex(request);
    synchronized (mutex) {
      windowCache =
          (PortletWindowCache<PortletWindowData>)
              request.getAttribute(PORTLET_WINDOW_DATA_ATTRIBUTE);
      if (windowCache == null) {
        windowCache = new PortletWindowCache<PortletWindowData>();
        request.setAttribute(PORTLET_WINDOW_DATA_ATTRIBUTE, windowCache);
      }
    }

    return windowCache;
  }
コード例 #3
0
  @SuppressWarnings("unchecked")
  protected PortletWindowCache<PortletWindowData> getPortletWindowDataMap(
      HttpServletRequest request, boolean create) {
    request = portalRequestUtils.getOriginalPortalRequest(request);
    final HttpSession session = request.getSession(create);
    if (!create && session == null) {
      return null;
    }

    PortletWindowCache<PortletWindowData> windowCache;

    final Object mutex = WebUtils.getSessionMutex(session);
    synchronized (mutex) {
      windowCache =
          (PortletWindowCache<PortletWindowData>)
              session.getAttribute(PORTLET_WINDOW_DATA_ATTRIBUTE);
      if (windowCache == null) {
        windowCache = new PortletWindowCache<PortletWindowData>();
        session.setAttribute(PORTLET_WINDOW_DATA_ATTRIBUTE, windowCache);
      }
    }

    return windowCache;
  }