コード例 #1
0
  /**
   * 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();
  }
コード例 #2
0
 @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;
 }
コード例 #3
0
 private String getFlowExecutionKey() {
   RequestContext requestContext = RequestContextHolder.getRequestContext();
   return requestContext.getFlowExecutionContext().getKey().toString();
 }
コード例 #4
0
 private void saveState(Object state) {
   RequestContext requestContext = RequestContextHolder.getRequestContext();
   requestContext.getViewScope().put(FACES_VIEW_STATE, state);
 }