1 20 package org.enhydra.barracuda.core.util.http; 21 22 import javax.servlet.*; 23 24 import org.enhydra.barracuda.core.comp.*; 25 import org.enhydra.barracuda.core.event.*; 26 import org.enhydra.barracuda.plankton.data.ReferenceFactory; 27 28 29 35 public class ContextServices extends org.enhydra.barracuda.plankton.http.ContextServices { 36 37 43 public static ServletContext getContext(ViewContext vc) { 44 EventContext ec = vc.getEventContext(); 45 if (ec!=null && (ec instanceof ControlEventContext)) { 46 return getContext((ControlEventContext) ec); 47 } else { 48 return null; 49 } 50 } 51 52 58 public static ServletContext getContext(ControlEventContext ec) { 59 return ec.getConfig().getServletContext(); 60 } 61 62 73 public static Object getObjectFromCache(ViewContext vc, Object key, ReferenceFactory factory) { 74 return getObjectFromCache(getContext(vc), key, factory); 75 } 76 77 88 public static Object getObjectFromCache(ControlEventContext ec, Object key, ReferenceFactory factory) { 89 return getObjectFromCache(getContext(ec), key, factory); 90 } 91 92 } 93 | Popular Tags |