1 15 16 package com.jdon.container.visitor; 17 18 import javax.servlet.http.HttpServletRequest ; 19 import javax.servlet.http.HttpSession ; 20 21 import com.jdon.bussinessproxy.TargetMetaDef; 22 import com.jdon.util.Debug; 23 24 37 public class VisitorFactory { 38 39 private final static String module = VisitorFactory.class.getName(); 40 41 private ComponentVisitor componentVisitor; 42 43 46 public VisitorFactory(ComponentVisitor componentVisitor) { 47 this.componentVisitor = componentVisitor; 48 } 49 56 public ComponentVisitor getVisitor(HttpServletRequest request, 57 TargetMetaDef targetMetaDef) { 58 HttpSession session = request.getSession(); 59 ComponentVisitor cm = (ComponentVisitor)session.getAttribute("HttpSessionProxyVisitor"); 60 if (cm == null){ 61 Debug.logVerbose("[JdonFramework] first time get ComponentVisitor ", module); 62 cm = new HttpSessionProxyVisitor(componentVisitor); 63 session.setAttribute("HttpSessionProxyVisitor", cm); 64 } 65 return cm; 66 } 67 68 75 public ComponentVisitor getVisitor(TargetMetaDef targetMetaDef) { 76 return componentVisitor; 77 78 } 79 80 } 81 | Popular Tags |