-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: bugA general bugA general bug
Milestone
Description
Szczepan Kuzniarz opened SPR-11295 and commented
In Spring 2.5.x the type of RequestAttributes stored in RequestContextHolder while handling portlet request was always PortletRequestAttributes. It was guaranteed by the code in DispatcherPortlet.doRenderService/doActionService methods:
...
// Expose current RequestAttributes to current thread.
RequestAttributes previousRequestAttributes = RequestContextHolder.getRequestAttributes();
PortletRequestAttributes requestAttributes = new PortletRequestAttributes(request);
RequestContextHolder.setRequestAttributes(requestAttributes, this.threadContextInheritable);
...
Since Spring 3.2.x the type is indeterminate - sometimes it is PortletRequestAttributes and sometimes ServletRequestAttributes (if there is RequestContextListener present). This is caused by the following code in FrameworkPortlet.processRequest method:
...
// Expose current RequestAttributes to current thread.
RequestAttributes previousRequestAttributes = RequestContextHolder.getRequestAttributes();
PortletRequestAttributes requestAttributes = null;
if (previousRequestAttributes == null || previousRequestAttributes.getClass().equals(PortletRequestAttributes.class)) {
requestAttributes = new PortletRequestAttributes(request);
RequestContextHolder.setRequestAttributes(requestAttributes, this.threadContextInheritable);
}
...
Is the condition in if statement correct? It seems to me it should be:
if (previousRequestAttributes == null || !previousRequestAttributes.getClass().equals(PortletRequestAttributes.class)) {
Affects: 3.2.6, 4.0 GA
Referenced from: commits 1be3a6c, 7d94b5e, 2d892da
Backported to: 3.2.10
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: bugA general bugA general bug