-------------------------------------------------------------------------------- -- Title: LWContext.lua -- Description: Like a square peg in a round hole -- Author: Raphaël Szwarc http://alt.textdrive.com/lua/ -- Creation Date: February 1, 2005 -- Legal: Copyright (C) 2005 Raphaël Szwarc -------------------------------------------------------------------------------- -- import dependencies local LUObject = require( "LUObject" ) -- define the class local super = LUObject local self = super() -- initialization method function self:init( anApplication, aRequest, aResponse ) self = super.init( self ) self._application = anApplication self._request = aRequest self._response = aResponse return self end -- method to access this context application function self:application() return self._application end -- method to access this context request function self:request() return self._request end -- method to access this context response function self:response() return self._response end -- method to access this context service function self:service() return self._service end -- method to set this context service function self:setService( aValue ) self._service = aValue return self end -- method to access this context session function self:session() if self._session == nil then local aSessionClass = self:application():sessionClass() if aSessionClass ~= nil then self._session = aSessionClass( self ) end end return self._session end return self