[ http://issues.apache.org/struts/browse/WW-1514?page=comments#action_38972 ] mark commented on WW-1514: --------------------------
http://www.comedysportzla.com/mb1/board1/1186.shtml - http://www.comedysportzla.com/mb1/board1/1187.shtml - http://www.comedysportzla.com/mb1/board1/1188.shtml - http://www.comedysportzla.com/mb1/board1/1189.shtml - http://www.comedysportzla.com/mb1/board1/1190.shtml - http://www.comedysportzla.com/mb1/board1/1191.shtml - http://www.comedysportzla.com/mb1/board1/1192.shtml - http://www.comedysportzla.com/mb1/board1/1193.shtml - http://www.comedysportzla.com/mb1/board1/1194.shtml - http://www.comedysportzla.com/mb1/board1/1195.shtml - http://www.comedysportzla.com/mb1/board1/1196.shtml - http://www.comedysportzla.com/mb1/board1/1197.shtml - http://www.comedysportzla.com/mb1/board1/1198.shtml - http://www.comedysportzla.com/mb1/board1/1199.shtml - http://www.comedysportzla.com/mb1/board1/1200.shtml - http://www.comedysportzla.com/mb1/board1/1201.shtml - http://www.comedysportzla.com/mb1/board1/1202.shtml - http://www.comedysportzla.com/mb1/board1/1203.shtml - http://www.comedysportzla.com/mb1/board1/1204.shtml - http://www.comedysportzla.com/mb1/board1/1205.shtml - http://www.comedysportzla.com/mb1/board1/1206.shtml - http://www.comedysportzla.com/mb1/board1/1207.shtml - http://www.comedysportzla.com/mb1/board1/1208.shtml - http://www.comedysportzla.com/mb1/board1/1209.shtml - http://www.comedysportzla.com/mb1/board1/1210.shtml - http://www.comedysportzla.com/mb1/board1/1211.shtml - http://www.comedysportzla.com/mb1/board1/1212.shtml - http://www.comedysportzla.com/mb1/board1/1213.shtml - http://www.comedysportzla.com/mb1/board1/1214.shtml - http://www.comedysportzla.com/mb1/board1/1215.shtml - http://www.comedysportzla.com/mb1/board1/1216.shtml - http://www.comedysportzla.com/mb1/board1/1217.shtml - http://www.comedysportzla.com/mb1/board1/1218.shtml - http://www.comedysportzla.com/mb1/board1/1219.shtml - http://www.comedysportzla.com/mb1/board1/1220.shtml - http://www.comedysportzla.com/mb1/board1/1221.shtml - http://www.comedysportzla.com/mb1/board1/1222.shtml - http://www.comedysportzla.com/mb1/board1/1223.shtml - http://www.comedysportzla.com/mb1/board1/1224.shtml - http://www.comedysportzla.com/mb1/board1/1225.shtml - http://www.comedysportzla.com/mb1/board1/1226.shtml - http://www.comedysportzla.com/mb1/board1/1227.shtml - http://www.comedysportzla.com/mb1/board1/1228.shtml - http://www.comedysportzla.com/mb1/board1/1229.shtml - http://www.comedysportzla.com/mb1/board1/1230.shtml - http://www.comedysportzla.com/mb1/board1/1231.shtml - http://www.comedysportzla.com/mb1/board1/1232.shtml - http://www.comedysportzla.com/mb1/board1/1233.shtml - http://www.comedysportzla.com/mb1/board1/1234.shtml - http://www.comedysportzla.com/mb1/board1/1235.shtml - http://www.comedysportzla.com/mb1/board1/1236.shtml - http://www.comedysportzla.com/mb1/board1/1237.shtml - http://www.comedysportzla.com/mb1/board1/1238.shtml - http://www.comedysportzla.com/mb1/board1/1239.shtml - http://www.comedysportzla.com/mb1/board1/1240.shtml - http://www.comedysportzla.com/mb1/board1/1241.shtml - http://www.comedysportzla.com/mb1/board1/1242.shtml - http://www.comedysportzla.com/mb1/board1/1243.shtml - http://www.comedysportzla.com/mb1/board1/1244.shtml - http://www.comedysportzla.com/mb1/board1/1245.shtml - http://www.comedysportzla.com/mb1/board1/1246.shtml - http://www.comedysportzla.com/mb1/board1/1247.shtml - http://www.comedysportzla.com/mb1/board1/1248.shtml - http://www.comedysportzla.com/mb1/board1/1249.shtml - http://www.comedysportzla.com/mb1/board1/1250.shtml - http://www.comedysportzla.com/mb1/board1/1251.shtml - http://www.comedysportzla.com/mb1/board1/1252.shtml - http://www.comedysportzla.com/mb1/board1/1253.shtml - http://www.comedysportzla.com/mb1/board1/1254.shtml - http://www.comedysportzla.com/mb1/board1/1255.shtml - http://www.comedysportzla.com/mb1/board1/1256.shtml - http://www.comedysportzla.com/mb1/board1/1257.shtml - http://www.comedysportzla.com/mb1/board1/1258.shtml - http://www.comedysportzla.com/mb1/board1/1259.shtml - http://www.comedysportzla.com/mb1/board1/1260.shtml - http://www.comedysportzla.com/mb1/board1/1261.shtml - http://www.comedysportzla.com/mb1/board1/1262.shtml - http://www.comedysportzla.com/mb1/board1/1263.shtml - http://www.comedysportzla.com/mb1/board1/1264.shtml - http://www.comedysportzla.com/mb1/board1/1265.shtml - http://www.comedysportzla.com/mb1/board1/1266.shtml - http://www.comedysportzla.com/mb1/board1/1267.shtml - http://www.comedysportzla.com/mb1/board1/1268.shtml - http://www.comedysportzla.com/mb1/board1/1269.shtml - http://www.comedysportzla.com/mb1/board1/1270.shtml - http://www.comedysportzla.com/mb1/board1/1271.shtml - http://www.comedysportzla.com/mb1/board1/1272.shtml - http://www.comedysportzla.com/mb1/board1/1273.shtml - http://www.comedysportzla.com/mb1/board1/1274.shtml - http://www.comedysportzla.com/mb1/board1/1275.shtml - http://www.comedysportzla.com/mb1/board1/1276.shtml - http://www.comedysportzla.com/mb1/board1/1277.shtml - http://www.comedysportzla.com/mb1/board1/1278.shtml - http://www.comedysportzla.com/mb1/board1/1279.shtml - http://www.comedysportzla.com/mb1/board1/1280.shtml - http://www.comedysportzla.com/mb1/board1/1281.shtml - > Conversation Scope > ------------------ > > Key: WW-1514 > URL: http://issues.apache.org/struts/browse/WW-1514 > Project: Struts 2 > Issue Type: New Feature > Components: Interceptors > Reporter: Mark Menard > Priority: Minor > Attachments: ConversationScopeAware.java, > ConversationScopeInterceptor.java > > > Problem: A user may need to, or be able to use, multiple tabs on the same > work flow process, using different data, that would usually be stored in the > user's session. The problem is if you use the Session scope you can only have > one version of the users data in memory. This can result in a "crossing of > the streams" between their two (or more) independent work flows. Ad-hoc > solutions on a per action basis could be implemented, but this is awkward at > best. > Example: User opens two processes of the same type, using the same action(s), > in separate tabs in their browser, working on independent data sets. Each > data model must be stored separately in their session. > Solution: Implement a "Conversation Scope" using an Interceptor and a marker > interface for Actions to implement that will transparently manage multiple > independent conversations of the same type on independent data sets. > ConversationScopeInterceptor: This interceptor does the hard lifting. It > maintains a conversationMap in each users session that allows for the storage > of multiple converstaionModels. The conversationModels are keyed using an > incrementing int, and the current time in milliseconds when the conversation > began. The incrementing of the conversation counter is synchronized. > Additionally the interceptor pushes the conversationModel onto the ValueStack > much the same way as ModelDriven pushes the model onto the ValueStack. > ConversationScopeAware: This is a marker interface for Actions to implement. > It includes methods to set/get the conersationId, set/get/prepare the > conversationModel. prepareConversationModel() is called at the start of a > conversation and allows the action to prepare the data model the user will be > working with over the conversation. > Motivation: The major motivation for this was work that we did in Struts 1 to > work around the pervasive use of session forms. We realized that users could > cross the streams with multiple forms in memory. To work around this we > created a deep Action hierarchy that handled swapping the "conversation" data > into and out of a Map backed form. Although Struts 2 does not suffer from the > same pervasive need to use session forms there are times when a conversation > is needed and with modern browsers and the wide usage of tabs, it is just a > matter of time before a user opens two tabs on the same type of conversation. > View requirements: In order to track the conversation the HTML form must > contain: > <input type="hidden" name="S2_CONVERSATION_ID" value="<the_current > conversation_id"> > The current conversation id is available as a property of any Action that > implements ConversationScopeAware and can be included with the following: > <s:hidden name="S2_CONVERSATION_ID" value="%{conversationId}" /> > Possible Improvements: Slip stream this right into ModelAware, and just use > getModel() from the ModelAware interface and supplement it with set and > prepare methods. I didn't want to do that initially because I'm not sure it > would be appropriate, nor do I like non-explicit things. It would make moving > a model aware action to a conversation model scope easier, but using > coversationModel just means changing getModel() to getConversationModel() in > your action. > Additionally this could be improved by setting the conversatonId onto the > ValueStack, and retrieving it off the stack in the view. This would allow for > the removal of the get/setConversationId() from the ConversationScopeAware > interface. I just couldn't figure out how to do that. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
