catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); }
}
+ private JS session = new JS() {
+ public Object get(Object key) throws JSExn {
+ //#switch(JS.toString(key))
+ case "created": return new JSDate(request.getSession(true).getCreationTime());
+ case "accessed": return new JSDate(request.getSession(true).getLastAccessedTime());
+ case "invalidate": return METHOD;
+ //#end
+ return super.get(key);
+ }
+ public void put(Object key, Object val) throws JSExn {
+ //#switch(JS.toString(key))
+ case "created": throw new JSExn("can not set session.created");
+ case "accessed": throw new JSExn("can not set session.accessed");
+ case "invalidate": throw new JSExn("can not set session.invalidate");
+ //#end
+ super.put(key, val);
+ }
+ public Object callMethod(Object method, final Object a, final Object b, Object c, Object[] rest, int nargs)
+ throws JSExn {
+ //#switch(JS.toString(method))
+ case "invalidate": request.getSession(true).invalidate(); return null;
+ //#end
+ return super.callMethod(method, a, b, c, rest, nargs);
+ }
+ };
private JS params = new JS() {
private List keys = null;
public Object get(Object key) { return request.getParameter(JS.toString(key)); }
case "request.path": return request.getPathInfo();
case "response": return getSub("response");
case "response.header": return responseHeader;
- case "session": return getSub("session");
- case "session.attr": return sessionAttributes;
- case "session.created": return new JSDate(request.getSession(true).getCreationTime());
- case "session.accessed": return new JSDate(request.getSession(true).getLastAccessedTime());
- case "session.invalidate": return METHOD;
+ case "session": return session;
case "page": return getSub("page");
//case "page.lastmodified": return new JSDate(new File(path).lastModified()); FIXME
case "context": return getSub("context");