Skip to content

Commit 2d892da

Browse files
committed
FrameworkPortlet exposes local PortletRequestAttributes in case of pre-bound ServletRequestAttributes as well
Issue: SPR-11295
1 parent 938a284 commit 2d892da

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/FrameworkPortlet.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import org.springframework.core.env.ConfigurableEnvironment;
4545
import org.springframework.web.context.request.RequestAttributes;
4646
import org.springframework.web.context.request.RequestContextHolder;
47+
import org.springframework.web.context.request.ServletRequestAttributes;
4748
import org.springframework.web.portlet.context.ConfigurablePortletApplicationContext;
4849
import org.springframework.web.portlet.context.PortletApplicationContextUtils;
4950
import org.springframework.web.portlet.context.PortletRequestAttributes;
@@ -516,7 +517,8 @@ protected final void processRequest(PortletRequest request, PortletResponse resp
516517
// Expose current RequestAttributes to current thread.
517518
RequestAttributes previousRequestAttributes = RequestContextHolder.getRequestAttributes();
518519
PortletRequestAttributes requestAttributes = null;
519-
if (previousRequestAttributes == null || previousRequestAttributes.getClass().equals(PortletRequestAttributes.class)) {
520+
if (previousRequestAttributes == null || previousRequestAttributes.getClass().equals(PortletRequestAttributes.class) ||
521+
previousRequestAttributes.getClass().equals(ServletRequestAttributes.class)) {
520522
requestAttributes = new PortletRequestAttributes(request, response);
521523
RequestContextHolder.setRequestAttributes(requestAttributes, this.threadContextInheritable);
522524
}

0 commit comments

Comments
 (0)