From: Matthew B. <mat...@ou...> - 2006-05-17 11:10:14
|
Matthew Buckett wrote: > It seems that lots of bits of code call this method asking for a > NavigationSession and then throw the session away. Almost all the calls > have access to a Request which also contains the NavigationSession. > Should we just switch to always getting the NavigationSession out of the > request? I don't think so. A user only has one NavigationSession and it is designed to track where the user currently is in the site. The NavigationSession is store in the HttpSession so that a new NavigationSession isn't created for every request. The SessionInitializer gets it from the HttpSession and hands it back to the Request. This works for 99% of the time but not all the time because a user may be in 2 parts of the site at the same time. If someone has uploaded a file called test.html into a resource called myfiles (URL: /myfiles/test.html) and the test.html contains links so other content: <html> <head> <title>Hello</title> <link href="../bs_virtual_auto.css" type="text/css" rel="stylesheet"> </head> <body> Hello <img src="/otherplace/myimage.png"/> </body> </html> Now after loading the /myfiles/test.html file the browser will request the contained resources: /bs_virtual_auto.css /otherplace/myimage.png but these are contained in different resources and so when the requests come in the NavigationSession will the switched to the resource containing the file (root resource and /otherplace) now depending on how these requests get processed it maybe that the following happens: - /bs_vistual_auto.css sets NavigationSession resource to / - /otherplace/myimage.png sets NavigationSession resource to /otherplace - /bs_virtual_auto.css starts to output the stylesheet using NavigationSession to discover the resource properties but these are now comming from /otherplace. - /otherplace/myimage.png request completes - /bs_virtual_auto.css request completes. Storing the current resource in the HttpSession is silly due to concurrent requests. So what should we do? NavigationSession doesn't contain the idea of the current resource any longer? I don't think it is sensible todo locking around this due to the fact that the NavigationSession could be accessed at any point during the request and it would create problems if we ever wanted to cluster Bodington. Anyone have any comments? -- -- Matthew Buckett, VLE Developer -- Learning Technologies Group, Oxford University Computing Services -- Tel: +44 (0)1865 283660 http://www.oucs.ox.ac.uk/ltg/ |