java - flashAttributes 在 websphere 重定向期间丢失

标签 java spring redirect websphere

在 spring(4.3.2.RELEASE) 和 java(1.8) 应用程序中,我使用 spring-flashAttribute 作为重定向期间传递参数的机制。

RedirectAttributes rm;
(...)
rm.addFlashAttribute("redirModel", rModel);

问题是:传递属性(通过 flashAttribute)适用于 tomcat,但适用于 websphere(8.5.5.11),不知何故这些属性在重定向后丢失。

传递这些属性的地方:org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(HttpServletRequest, HttpServletResponse, HandlerMethod)第804行

(...)
mavContainer.addAllAttributes(RequestContextUtils.getInputFlashMap(request));
(...)

RequestContextUtils 通过以下方式传递这些属性: org.springframework.web.servlet.support.RequestContextUtils:

@SuppressWarnings("unchecked")
public static Map<String, ?> getInputFlashMap(HttpServletRequest request) {
    return (Map<String, ?>) request.getAttribute(DispatcherServlet.INPUT_FLASH_MAP_ATTRIBUTE);
}

有人可以解释一下我应该如何正确地做到这一点吗?

最佳答案

我已经检查并确认,在 websphere 上重定向期间使用 flashAttribiute 相关的问题是由 spring 库引起的,从 4.3.2.RELEASE 迁移到 4.3.9.RELEASE 后问题消失了。

我没有检查比 4.3.9.RELEASE 更旧的库,因此可以在旧版本中修复它

关于java - flashAttributes 在 websphere 重定向期间丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58770303/

相关文章:

java - 混合使用 Log4j 和 commons-logging 会导致 "class loading deadlock"?

java - spring amqp 中的 CannotLoadBeanClassException

java - Spring 批处理 : Tasklet with multi threaded executor has very bad performances related to Throttling algorithm

.htaccess - SSL无限重定向

java - 如何解决 pom.xml 中的错误 - android eclipse 应用程序?

java - 将字符串转换为 Byte[] Java

java - 以相反的顺序打印出任何集合中的项目?

spring - spring mvc3 中的请求映射 url 模式

python - 如何检查标准输入是否有一些数据?

python如何在重定向后获取最终目的地