01: package net.sf.crispy.impl.caucho;
02:
03: import java.util.Hashtable;
04: import java.util.Map;
05:
06: import javax.servlet.http.HttpServlet;
07: import javax.servlet.http.HttpServletRequest;
08:
09: import org.apache.commons.logging.Log;
10: import org.apache.commons.logging.LogFactory;
11:
12: /**
13: * Parent class from burlap and hessian server side implementation.
14: *
15: * @author Linke
16: *
17: */
18: public class CauchoServlet extends HttpServlet {
19:
20: protected static final Log log = LogFactory
21: .getLog(CauchoServlet.class);
22:
23: private static final long serialVersionUID = 471335728357234L;
24: private Map cache = new Hashtable();
25:
26: // protected void doGet(HttpServletRequest pvRequest, HttpServletResponse pvResponse) throws ServletException, IOException {
27: // doPost(pvRequest, pvResponse);
28: // }
29:
30: public Object addCache(String pvKey, Object pvValue) {
31: return cache.put(pvKey, pvValue);
32: }
33:
34: public Object getFromCache(String pvKey) {
35: return cache.get(pvKey);
36: }
37:
38: public void clearCahce() {
39: cache.clear();
40: }
41:
42: public int getCacheSize() {
43: return cache.size();
44: }
45:
46: public String getCacheKey(HttpServletRequest pvRequest) {
47: String lvUri = pvRequest.getRequestURI();
48: if (log.isDebugEnabled()) {
49: log.debug("Request-URI: " + lvUri);
50: }
51: int lvLastIndex = lvUri.lastIndexOf("/");
52: lvUri = lvUri.substring(lvLastIndex + 1);
53: if (log.isDebugEnabled()) {
54: log.debug("Cache-Key: " + lvUri);
55: }
56: return lvUri;
57: }
58:
59: }
|