public static final long serialVersionUid = 0xfb2aa281;
private JS js;
JSScope newscope;
- Vec v;
+ List v;
public JSTransaction(JS js) throws JSExn {
newscope = new JSScope(null);
this.js = JS.cloneWithNewParentScope(js, newscope);
v = JS.getFormalArgs(this.js);
for(int i=0; i<v.size(); i++) {
- if ("prevalent".equals(v.elementAt(i))) continue;
- newscope.put(v.elementAt(i), JS.getParentScope(js).get(v.elementAt(i)));
+ if ("prevalent".equals(v.get(i))) continue;
+ newscope.put(v.get(i), JS.getParentScope(js).get(v.get(i)));
}
}
public void executeOn(Object o, Date now) {
try {
newscope.put("prevalent", o);
newscope.put("now", new JSDate(now.getTime()));
- Object a = v.size() <= 0 ? null : newscope.get(v.elementAt(0));
- Object b = v.size() <= 1 ? null : newscope.get(v.elementAt(1));
- Object c = v.size() <= 2 ? null : newscope.get(v.elementAt(2));
+ Object a = v.size() <= 0 ? null : newscope.get(v.get(0));
+ Object b = v.size() <= 1 ? null : newscope.get(v.get(1));
+ Object c = v.size() <= 2 ? null : newscope.get(v.get(2));
Object[] rest = v.size() <= 3 ? null : new Object[v.size() - 3];
- for(int i=3; i<v.size(); i++) rest[i-3] = v.elementAt(i);
+ for(int i=3; i<v.size(); i++) rest[i-3] = v.get(i);
js.call(a, b, c, rest, v.size());
} catch (Exception e) { throw new RuntimeException(e); }
}
}
private JS params = new JS() {
+ private List keys = null;
public Object get(Object key) { return request.getParameter(JS.toString(key)); }
- public Enumeration keys() { return request.getParameterNames(); }
+ public Collection keys() {
+ return keys == null ? keys = Collections.list(request.getParameterNames()) : keys; }
};
private JS cookies = new JS() {
/*
*/
};
private JS sessionAttributes = new JS() {
+ private List keys = null;
public Object get(Object key) {
return request.getSession(true).getAttribute(JS.toString(key)); }
public void put(Object key, Object val) {
if (val == null) request.getSession(true).removeAttribute(JS.toString(key));
else request.setAttribute(JS.toString(key), val); }
- public Enumeration keys() { return request.getSession(true).getAttributeNames(); }
+ public Collection keys() {
+ return keys == null ? keys = Collections.list(request.getSession(true).getAttributeNames()) : keys; }
};
private JS requestHeader = new JS() {
+ private List keys = null;
public Object get(Object key) { return request.getHeader(JS.toString(key)); }
- public Enumeration keys() { return request.getHeaderNames(); }
+ public Collection keys() {
+ return keys == null ? keys = Collections.list(request.getHeaderNames()) : keys; }
};
private JS responseHeader = new JS() {
public void put(Object key, Object val) {
if (!f.isDirectory()) return null;
String[] contents = f.list();
JSArray ret = new JSArray(contents.length);
- for(int i=0; i<contents.length; i++) ret.addElement(contents[i]);
+ for(int i=0; i<contents.length; i++) ret.add(contents[i]);
return ret;
//#end
return null;
List c = getChildren();
declare((String)varPut);
- Vec v = ((JSArray)varIn).toVec();
- for (int j=0; j < v.size(); j++) {
- put(varPut, v.elementAt(j));
+ Iterator it = ((JSArray)varIn).toList().iterator(); while (it.hasNext()) {
+ put(varPut, it.next());
for (int i=0; i < c.size(); i++) ((XML.Block)c.get(i)).toXML(w);
}
} catch (JSExn e) { throw new RuntimeException(e); }