Hi, The issues you describe is only an issue if the portlet application is not using the redirect result type as result to event actions. So the workaround is to always use the redirect action type for rendering the results. I do agree that the current implementation is not optimal. In JSR286, there's something called "action scoped request attributes" which is probably better suited for saving such state information.
Regards, Nils-Helge Garli Hegvik On Mon, May 23, 2011 at 11:41 AM, huang.mi...@gmail.com < huang.mi...@gmail.com> wrote: > Hi Nils-H, > Just have read the WW-2052. I think the session map is not equivalent to > the render parameter since the session is shared across all requests in the > same session. > For the WW-2052 issue, if this is a problem for the project, it's more of > a portal implementation's problem instead of struts'. The fix method for the > WW-2052 is actually creating a more serious issue than the original. > As I'm digging deeper into the session issue I've mentioned, the > PortletStateInterceptor may has same issue when do saveStack and > restoreStack operation. In the example case I've posted in the last email, > the problem may not only render wrong JSP: since wrong stack value is also > restored from session, the JSP render will not have any problem on > generating render result. But the problem is actually worse: A request of > request A may get totally unrelated response of request B without any error > report! > > Regards, > Miles. > > 在 2011-05-23Mon的 08:34 +0200,Nils-Helge Garli Hegvik写道: > > Hi! > > It used to be a render parameter, but was changed due to > this:https://issues.apache.org/jira/browse/WW-2052 > > Nils-H > > On Sun, May 22, 2011 at 8:02 PM, huang.mi...@gmail.com > <huang.mi...@gmail.com> wrote: > > Hi Pyerson, > > I'm also using portlet2 plugin, which seems derived from struts portlet > > plugin, brings same method to handle directRender from action phase. Thus it > > has same problems :). But since the source is from struts bundled portlet > > plugin, I'd better discuss this issue here. > > First let me clear the ACTION word. It's both used in struts and portlet > > specification, referencing totally different things. I'll use "portlet > > action phase" and "struts action" here to avoid confusing, although it's > > cumbersome. > > First some background information about this issue: > > A portlet action phase request is mapped to a struts action request by the > > struts portlet plugin. Due to the portlet JSR definition, in action phase > > process no output is rendered. Instead a follow on render phase request is > > used to take the actual render responsible. However the struts action can > > define a JSP render result. In this case, the struts action's result process > > actually not do render process, but save the render JSP location to the > > session map and finished the result process immediately. The actual JSP > > render process is taken place by the follow on portlet render phase request, > > which is mapping to the struts portlet plugin internal defined > > "directRender" action. The directRender action load the previously saved JSP > > location and do the actual JSP render as it's result. Thus the portlet > > render phase response get JSP render output AS IF it is rendered out by the > > result defined in the struts action. See the in question source code which > > is doing the process described here: > > > > org.apache.struts2.portlet.result.PortletResult.executeActionResult(String, > > ActionInvocation) > > org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction, > > > > The problem is: > > The session is shared by all requests in the same session, in a > > multi-threaded concurrent executing environment. This may cause > > indeterminable problems on a heavy load site. > > Suppose 2 request(Request A and Request B) from same session come to the > > portal at nearly same time. The process sequence of the 2 request may like > > this: > > 1. Request A get action phase process, and its struts action (action A) > > result process stored the JSP location (a.jsp) to the session map. > > 2. Request B get action phase process, and its struts action (action B) > > result process stored the JSP location (b.jsp) to the session map, which > > overwrites JSP location (a.jsp) set by action A. > > 3. Request A get render phase process, and the renderDirect action get > > incorrect JSP location b.jsp. Request A will render the wrong JSP result. > > 4. Request B get render phase process, and the renderDirect action get > > correct JSP location b.jsp, and render the JSP result correctly. > > This problem may not easy to reproduce during the development lifecycle, > > except you use an automatic load testing tool to test it. But when the > > system is deployed to the production environment and the site load get > > heavy, the possibility to run into the issue case get higher. > > Hope I have described the issue clearly and feel free to place a note on > > what I have missing. > > > > Best Regards, > > Miles. > > > > > > 在 2011-05-21Sat的 20:54 -0400,Jason Pyeron写道: > > > > I am having a little trouble following what you are saying. Do you have an > > example that might better say the issue. > > > > I am currently using the portlet2 plugin as well. > > > > ________________________________ > > > > From: Miles Huang [mailto:miles.hu...@surwing.com > > <miles.hu...@surwing.com>] > > Sent: Saturday, May 21, 2011 11:52 > > To: dev@struts.apache.org > > Subject: Portlet plugin renderDirect location transfer via session may > > has concurrent issue > > > > > > Hi, > > I'm using struts2 portlet plugin for a portlet project recently. > > In some case, I have to use renderDirect action to render JSP result > > directly from an portlet action phase request. > > When I'm examining the PortletResult source code, surprisingly I found > > the result location is transfer to the renderDirect action via session map > > instead of render parameter. > > Is there any special reason to do this? I think current via session > > method may result current issue: Suppose multiple client in same session > > (normally multiple opened browser windows) send action phase request to the > > portlet concurrently, the result location of a action phase request may > > override > > by another request. > > Any one can confirm on this? > > > > Thanks, > > Miles. > > > > -- > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > > - - > > - Jason Pyeron PD Inc. http://www.pdinc.us - > > - Principal Consultant 10 West 24th Street #100 - > > - +1 (443) 269-1555 x333 Baltimore, Maryland 21218 - > > - - > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > > This message is copyright PD Inc, subject to license 20080407P00. > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org > > For additional commands, e-mail: dev-h...@struts.apache.org > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org > For additional commands, e-mail: dev-h...@struts.apache.org > > >