Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

8. Conversations

In the previous chapter, we discussed session-scoped stateful Seam components. In most web frameworks, the application state is completely managed in the HttpSession object, so the session scope is the only stateful scope. However, for most applications, the session scope is too coarsely grained for effective state management. We already covered most of the reasons in Chapter 6. Let’s quickly recap the key points here:

  • To manage complex application state in an HTTP session, you must write a lot of code to manually shuffle objects into and out of the session. If you forget to save a modified state object back into the session, the application will exhibit hard-to-debug behavior errors at runtime.

  • A single timeout parameter controls the HTTP session. Objects in a session have no notion of a lifecycle. As a result, the HTTP session is a major source of memory leaks in web applications when developers forget to manually clean out objects from a long-running session.

  • The state objects in the HTTP session have no notion of scope. They are shared among all browser windows or tabs in the same user session. That makes web applications behave unexpectedly when the user opens multiple browser tabs for the same application. You can read more about this problem in Chapter 9.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial