1 4 5 9 10 package org.openlaszlo.cache; 11 12 13 import javax.servlet.http.HttpServletRequest ; 14 import javax.servlet.http.HttpServletResponse ; 15 16 import java.io.File ; 17 import java.io.IOException ; 18 import java.io.Serializable ; 19 import java.net.MalformedURLException ; 20 import java.util.Properties ; 21 22 import org.openlaszlo.data.XMLConverter; 23 import org.openlaszlo.data.DataSource; 24 import org.openlaszlo.compiler.CompilationEnvironment; 25 import org.openlaszlo.server.LPS; 26 27 32 public class DataCache extends RequestCache { 33 34 public DataCache(File cacheDirectory, Properties props) 35 throws IOException { 36 37 super("dcache", cacheDirectory, new XMLConverter(), props); 38 } 39 40 43 public Serializable getKey(HttpServletRequest req) 44 throws MalformedURLException { 45 46 48 String hds = req.getParameter("sendheaders"); 52 if (hds == null || hds.equals("true")) { 55 hds = " h=1"; 56 } else { 57 hds = " h=0"; 58 } 59 String enc = mConverter.chooseEncoding(req); 60 if (enc == null) 61 enc = ""; 62 StringBuffer key = new StringBuffer (); 63 key.append(DataSource.getURL(req)); 64 key.append(hds); 65 66 String swfversion = req.getParameter("lzr"); 67 if (swfversion == null) { 68 swfversion = LPS.getProperty("compiler.runtime.default", "swf6"); 69 } 70 key.append(" " + swfversion); 71 72 key.append(" "); 73 key.append(enc); 74 return key.toString(); 75 } 76 77 94 } 95 | Popular Tags |