在 websphere 重定向期间 flashAttributes 丢失
flashAttributes are lost during redirection at 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) line 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,所以它可以在旧版本中修复
在 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) line 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,所以它可以在旧版本中修复