【问题标题】:Secured tag of Spring Web Flow: How to pass Flow scope parameter to a Spring bean method?Spring Web Flow 的安全标签:如何将 Flow 范围参数传递给 Spring bean 方法?
【发布时间】:2017-02-28 18:39:21
【问题描述】:

我正在使用 Spring 安全性保护 Spring Web Flow 状态。在secured 标记中,我正在调用Spring bean 的方法并尝试将Flow 范围参数传递给它。除了传递 Flow 范围参数外,一切正常 - 传递了 null。

这是来自 Web Flow xml 的 sn-p:

<action-state id="securedAction">
    <secured attributes="@myAction.accessGranted(#flowScope.parameter)" />
    ...
    ...
</action-state>

Flow范围参数如何传递?

【问题讨论】:

  • 您是否在没有#的情况下绑定了 flowScope.parameter?
  • 是的,我也试过这个。

标签: spring spring-security spring-webflow spring-el


【解决方案1】:

我找到了我自己问题的答案 - 与其尝试通过 Java 方法参数从流中传递流范围参数,不如在被调用方法中通过 org.springframework.webflow.execution.RequestContextHolder 获取它:

RequestContextHolder.getRequestContext().getFlowScope().get("parameter");

附:
如果要设置流范围参数,请使用

RequestContextHolder.getRequestContext().getFlowScope().put("parameter", myParameterObject);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-02
    • 2019-06-06
    • 2018-01-24
    • 1970-01-01
    • 1970-01-01
    • 2012-03-20
    相关资源
    最近更新 更多