摘要
目前会话信息的保存主要基于session进行直接管理,session机制基于无连接的HTTP协议实现了有连接服务,对保存客户端和服务器之间的会话状态有着重要的作用,但是session直接存储机制的固有缺陷将造成表现层的业务组件直接与session耦合,给系统单元测试带来困难,同时也不利于系统的会话建模。IoC(inversion of control)模式很好的解决了组件的耦合和测试问题,但是IoC管理的都是无态POJO(plain old Java object)。提出了一种基于IoC模式的有态POJO管理模型,将有态POJO的依赖关系和生命周期作为通用组件纳入模型的管理,并证明了有态POJO和无态POJO之间的引用完整性约束。通过对比可以看出,该模型有效地解决了传统session机制所存在的缺陷。
Connection-oriented service is implemented by session mechanism based on unconnected Http protocol. It is important to preserve conversation states between clients and servers. At present the preservation of conversation information is mainly managed by the session. But the intrinsic defects of directly session accessing would result in tight coupling between the session and the business com- ponents of the presentation layer, and the difficulty of system unit test, as well as causing troubles in system conversation modeling. The components coupling and the test issues are solved well by IoC (inversion of control) pattern, but the objects managed by IoC are stateless POJO (plain old Java object) s. A management model of stateful POJO based on IoC pattern is proposed, by which the dependencies and the lifecycle of stateful POJO is managed as a common component, and the constraint of referential integrity between stateful POJO and stateless POJO is also proved. The defects of the traditional session mechanism could be effectively solved with this model by comparison.
出处
《计算机工程与设计》
CSCD
北大核心
2007年第9期1998-2000,2017,共4页
Computer Engineering and Design
基金
四川省计算机软件重点实验室基金项目(00060510)
关键词
无态POJO
有态POJO
耦合
反转控制
会话建模
stateless POJO
stateful POJO
coupling
inversion of control
conversation modeling