WARequestContext

Rationale

Over time WASession became more and more covered with functionality that was not session related and only relevant for a single request. To counter this Seaside 3.0 introduces WARequestContext where request handling information is stored.

Usage

WARequestContext can be access in a similar way how WASession could be accessed in Seaside 2.8 and earlier.

WACurrentRequestContext value. "answers the current request contest"
WACurrentRequestContext value request. "answers the current request"
WACurrentRequestContext value session. "answers the current session"
WACurrentRequestContext value application. "answers the current application"

We also added GRObject as a common superclass of most classes in Seaside. From within any object that subclasses GRObject you can also access the current request context like so:

self requestContext.

Similarly there are shortcuts for the current session and application:

self session.
self application.

Migration

Seaside 2.8 code should mostly continue working. However we deprecated the following methods on WASession and moved them to WARequestContext:

  • #addLoadScript:
  • #currentRequest
  • #returnResponse:
  • #closePopup (now WARequestContext>>#closeThisPopupAndReloadOpener)
  • #closePopupWithoutReloadingOpener (now WARequestContext>>#closeThisPopup)
  • #respond: (now WARequestContext>>#respondAndContinue:)
  • #redirect
  • #redirectResponseFor:
  • #redirectTo:
  • #redirectWithMessage:delay:
  • #redirectWithCookie:

We recommend that you update your code because these methods will be removed in the next major version of Seaside. We also recommend that you replace

WACurrentSession value

with

WACurrentRequestContext session

in your code.