1 30 31 package com.caucho.eswrap.javax.servlet.http; 32 33 import javax.servlet.http.HttpSession ; 34 import java.util.Iterator ; 35 36 public class HttpSessionEcmaWrap { 37 static class KeyIterator implements Iterator { 38 String []array; 39 int i; 40 41 public boolean hasNext() { return i < array.length; } 42 public Object next() { return i < array.length ? array[i++] : null; } 43 public void remove() { throw new UnsupportedOperationException (); } 44 45 KeyIterator(String []array) 46 { 47 this.array = array; 48 } 49 } 50 51 public static void setValue(HttpSession session, String name, Object value) 52 { 53 session.putValue(name, value); 54 } 55 56 public static Iterator getValueKeys(HttpSession session) 57 { 58 String []names = session.getValueNames(); 59 60 if (names == null) 61 return null; 62 63 return new KeyIterator(names); 64 } 65 } 66 | Popular Tags |