/**
   * Retrieve the current Spring flowId (if any).
   *
   * @return The current Spring flowId.
   */
  public static String getSpringFlowId() {
    if (!isSpringEnvironment()) {
      return null;
    }
    FacesContext facesContext = FacesContext.getCurrentInstance();
    // obtain key by evaluating expression with Spring VariableResolver
    Object value = null;
    if (1 == springLoaded) {
      value =
          facesContext
              .getApplication()
              .createValueBinding("#{flowExecutionKey}")
              .getValue(facesContext);
      if (null != value) {
        // Spring Web Flow 1.x confirmed
        flowIdParameterName = "_flowExecutionKey";
      }
    } else if (2 == springLoaded) {
      value =
          RequestContextHolder.getRequestContext().getFlowExecutionContext().getKey().toString();
      if (null != value) {
        // Spring Web Flow 2.x confirmed
        flowIdParameterName = "org.springframework.webflow.FlowExecutionKey";
      }
    }

    if (null == value) {
      return null;
    }

    return value.toString();
  }
 @Override
 public Object getState(FacesContext facesContext, String viewId) {
   if (!JsfUtils.isFlowRequest()) {
     return super.getState(facesContext, viewId);
   }
   RequestContext requestContext = RequestContextHolder.getRequestContext();
   Object state = requestContext.getViewScope().get(FACES_VIEW_STATE);
   if (state == null) {
     logger.debug("No matching view in view scope");
   }
   return state;
 }
 private String getFlowExecutionKey() {
   RequestContext requestContext = RequestContextHolder.getRequestContext();
   return requestContext.getFlowExecutionContext().getKey().toString();
 }
 private void saveState(Object state) {
   RequestContext requestContext = RequestContextHolder.getRequestContext();
   requestContext.getViewScope().put(FACES_VIEW_STATE, state);
 }