1 4 5 9 10 package org.openlaszlo.servlets.responders; 11 12 import java.io.*; 13 import java.util.Properties ; 14 import javax.servlet.ServletConfig ; 15 import javax.servlet.ServletException ; 16 import javax.servlet.http.HttpServletRequest ; 17 import javax.servlet.http.HttpServletResponse ; 18 import javax.servlet.ServletOutputStream ; 19 import org.openlaszlo.cache.DataCache; 20 import org.openlaszlo.cache.RequestCache; 21 import org.openlaszlo.server.LPS; 22 23 import org.apache.log4j.Logger; 24 25 28 public final class ResponderDATA extends ResponderCache 29 { 30 private static DataCache mCache = null; 31 private static boolean mIsInitialized = false; 32 private static Logger mLogger = Logger.getLogger(ResponderDATA.class); 33 34 synchronized public void init(String reqName, ServletConfig config, Properties prop) 35 throws ServletException , IOException 36 { 37 if (! mIsInitialized) { 39 String cacheDir = config.getInitParameter("lps.dcache.directory"); 41 if (cacheDir == null) { 42 cacheDir = prop.getProperty("dcache.directory"); 43 } 44 if (cacheDir == null) { 45 cacheDir = LPS.getWorkDirectory() + File.separator + "dcache"; 46 } 47 48 File cache = checkDirectory(cacheDir); 49 mLogger.info("Data Cache is at " + cacheDir); 50 51 try { 55 mCache = new DataCache(cache, prop); 56 } catch (IOException e) { 57 throw new ServletException (e.getMessage()); 58 } 59 60 mIsInitialized = true; 61 } 62 super.init(reqName, config, mCache, prop); 63 } 64 65 static public RequestCache getCache() { 66 return mCache; 67 } 68 } 69 | Popular Tags |