Following class is used to create S2Container in a web application.
- Seasar.Framework.Container.Web.S2HttpModule
To use S2HttpModule, add the followings to the Web.config file and add S2HttpModule to ASP.NET application.
Refer to source/Seasar/Seasar.Framework.Container/Web/Web.config for an example.
Define S2Container path at configPath element in the seasar section in annotation configuration file.
An instance of S2Container may be retrieved after S2HttpModule is started.
Edit Global.asax so S2Container is initialized in Application_Start method and destroyed in Application_End method. SingletonS2ContainerFactory class is in Seasar.Framework.Container.Factory namespace.
Sub Application_Start(ByVal sender AsObject, ByVal e As EventArgs)
SingletonS2ContainerFactory.Init()
EndSubSub Application_End(ByVal sender AsObject, ByVal e As EventArgs)
SingletonS2ContainerFactory.Destroy();
End Sub
A component may be automatically bound to a HttpRequest by defining HttpRequest Request { set; } property to a component.
Also, define S2HttpModule in Web.config.
In a similar manner, HttpResponse and HttpSession may be defined in a propery (set assessor) to automatically bind to a component.
Furthermore, HttpRequest, HttpResponse, HttpSessionState, HttpApplication may respectively be bound to request, response, session, httpApplication components.