private ItemChangeEvent createItemChangeEvent(FacesContext facesContext) {
    if (facesContext == null) {
      throw new NullPointerException();
    }

    // Submitted value == null means "the component was not submitted at all".
    String activeItem = getSubmittedActiveItem();
    if (activeItem == null) {
      return null;
    }

    String previous = (String) getValue();
    if (previous == null || !previous.equalsIgnoreCase(activeItem)) {
      UIComponent prevComp = null;
      UIComponent actvComp = null;

      if (previous != null) {
        try {
          prevComp = (UIComponent) getItem(previous);
        } catch (TogglePanelVisitException e) {
          if (LOG.isDebugEnabled()) {
            LOG.debug("Cannot include dynamic TogglePanelComponents in itemChangeEvents");
          }
          prevComp = null;
        }
      }
      if (activeItem != null) {
        try {
          if (LOG.isDebugEnabled()) {
            LOG.debug("Cannot include dynamic TogglePanelComponents in itemChangeEvents");
          }
          actvComp = (UIComponent) getItem(activeItem);
        } catch (TogglePanelVisitException e) {
          actvComp = null;
        }
      }

      return new ItemChangeEvent(this, previous, prevComp, activeItem, actvComp);
    }
    return null;
  }
  /**
   * Note: Filter does not delegate to chain, since it would lead into cycle by calling {@link
   * PushServlet#service(ServletRequest, ServletResponse)}.
   */
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
      throws IOException, ServletException {
    if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
      HttpServletRequest httpReq = (HttpServletRequest) request;
      HttpServletResponse httpResp = (HttpServletResponse) response;

      if ("GET".equals(httpReq.getMethod())) {
        String pushSessionId = httpReq.getParameter(PUSH_SESSION_ID_PARAM);

        Session session = null;

        if (pushSessionId != null) {
          ensureServletContextAvailable(request);
          PushContext pushContext =
              (PushContext) servletContext.getAttribute(PushContext.INSTANCE_KEY_NAME);
          session = pushContext.getSessionManager().getPushSession(pushSessionId);
        }

        if (session == null) {
          if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(MessageFormat.format("Session {0} was not found", pushSessionId));
          }
          httpResp.sendError(HttpServletResponse.SC_BAD_REQUEST);
          return;
        }

        httpResp.setContentType("text/plain");

        Meteor meteor =
            Meteor.build(httpReq, SCOPE.REQUEST, Collections.<BroadcastFilter>emptyList(), null);

        try {
          Request pushRequest = new RequestImpl(meteor, session);

          httpReq.setAttribute(SESSION_ATTRIBUTE_NAME, session);
          httpReq.setAttribute(REQUEST_ATTRIBUTE_NAME, pushRequest);

          pushRequest.suspend();
        } catch (Exception e) {
          LOGGER.error(e.getMessage(), e);
        }

        return;
      }
    }
  }