【问题标题】:Spring WebFlow: Getting HTTPServletRequest from ServletExternalContextSpring WebFlow:从 ServletExternalContext 获取 HTTPServletRequest
【发布时间】:2015-12-01 00:57:01
【问题描述】:

两个相关问题:

  1. 我读过的旧帖子表明 ServletExternalContext 有一个方法 getRequest,它返回 httpServletRequest。在当前版本的 Spring Webflow (2.4) 中,此方法不可见(即受保护)。那么,有人可以确认如果我想获取 httpServletRequest 数据(例如请求 URL),我必须通过 Spring MVC 来代替吗?

  2. 第二个问题:我了解 webflow 旨在与多个框架一起使用,而不仅仅是 servlet。但是,我不明白为什么它必须与嵌入它的框架完全隔离。谁能解释一下原因

【问题讨论】:

    标签: spring-webflow


    【解决方案1】:
    1. 是的,有可能

      ServletExternalContext externalContext = (ServletExternalContext) ctx.getExternalContext();
      HttpServletRequest httpServletRequest = (HttpServletRequest)externalContext.getNativeRequest();
      
    2. 没有实际意义

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-19
      • 2013-09-12
      • 1970-01-01
      • 2018-02-07
      • 1970-01-01
      • 2021-08-17
      • 2017-09-16
      相关资源
      最近更新 更多