掲示板

6.2 parallel rendering issue

9年前 に Srinivas KK によって更新されました。

6.2 parallel rendering issue

Junior Member 投稿: 33 参加年月日: 11/12/04 最新の投稿
I get reference to request object in permission checker and use standard j2ee api request.isUserInRole() to check if user has required role.
I use RequestContextListener ( spring/jodd) to get reference to request object. It works great in 6.1 , but not in 6.2 tomcat instance anymore when parallel rendering is turned on. we can easily replicate this issue using query param - p_p_parallel=0 to turn on/off parallel rendering.

I see request.getUserPrincipal returns null when parallel rendering is turned on , so no roles , so checker returns false.

Spring exception when parallel rendering is on -
("No thread-bound request found: " +
"Are you referring to request attributes outside of an actual web request, " +
"or processing a request outside of the originally receiving thread? " +
"If you are actually operating within a web request and still receive this message, " +
"your code is probably running outside of DispatcherServlet/DispatcherPortlet: " +
"In this case, use RequestContextListener or RequestContextFilter to expose the current request.");

* public static HttpServletRequest getRequest() { Object request =
* RequestContextHolder
* .currentRequestAttributes().resolveReference(RequestAttributes
* .REFERENCE_REQUEST); if (request instanceof HttpServletRequest) { return
* (HttpServletRequest)request; } else if (request instanceof
* PortletRequest) { return
* PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest
* ((PortletRequest)request)); }
*
* throw new RuntimeException("Unknown request type: " + request);
*
* }
9年前 に Santosh Jha によって更新されました。

RE: 6.2 parallel rendering issue

New Member 投稿: 1 参加年月日: 14/04/14 最新の投稿
I am also facing the same issue, did you find any work around? Appreciate your help.
Below is the tacktrace that I see and it happens randomly on going through pages
java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131)
at netxclient.util.RequestUtils.getRequest(RequestUtils.java:21)
at netxclient.util.RestServiceContextUtils.getRequest(RestServiceContextUtils.java:211)
at netxclient.util.RestServiceContextUtils.getReflectedBean(RestServiceContextUtils.java:73)
at netxclient.hook.entitlement.NXIPermissionChecker.getUserBag(NXIPermissionChecker.java:241)

[web.xml
<filter>
<filter-name>requestContextFilter</filter-name>
<filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>requestContextFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>