to banq --jdf学习疑问

08-09-18 pub
一. * it's scope is a instance for per request of one user ;

这个是TargetMetaRequest ?

二.

/**

* create a UserTargetMetaDef instance.

*

* @param containerWrapper

* @param targetMetaDef

* @param request

* @return

*/

public static TargetMetaRequest create(TargetMetaDef targetMetaDef,

HttpServletRequest request){

ContainerWrapper containerWrapper = servletContainerFinder.findContainer(request);

TargetMetaRequest targetMetaRequest = new TargetMetaRequest(targetMetaDef);

VisitorFactory visitorFactory = (VisitorFactory)containerWrapper.lookup(ComponentKeys.VISITOR_FACTORY);

ComponentVisitor cm = visitorFactory.getVisitor(request, targetMetaRequest.getTargetMetaDef());

targetMetaRequest.setComponentVisitor(cm);

return targetMetaRequest;

}

UserTargetMetaDef == targetMetaRequest ?

三.

* this class inlude those datas that read from the web container or others.

* these datas is stateful, and it's scope is one instance per client.

* usually they are saved in httpSession of the web container.

SessionContext还是放到httpSession中了?oojdon说是不由web container管理?

    

banq
2008-09-18 14:44
>SessionContext还是放到httpSession中了

是的,可以用自己的缓存来替代httpSession,这里使用访问者模式便于替换。以前有人提过,可以查查。

pub
2008-09-20 10:11
是不是应该说是间接的通过httpsession来管理sessioncontext的生存期?

1.sessioncontext是通过SessionContextFactoryVisitable new SessionContext();得到的

2.httpsession通过new HttpSessionProxyVisitor implements HttpSessionBindingListener 来得到一个自有的HttpSessionBindingListener

3.HttpSessionProxyVisitor 中对sessioncontext引用,当httpsession失效时调用 删除掉对sessioncontext的引用,然后GC来回收sessioncontext

猜你喜欢