1 16 package org.apache.cocoon.components.language.markup.xsp; 17 18 import org.apache.cocoon.environment.Session; 19 20 import java.util.ArrayList ; 21 import java.util.Enumeration ; 22 import java.util.List ; 23 24 31 public class XSPSessionHelper { 32 33 41 public static Object getSessionAttribute(Session session, String name, 42 Object defaultValue) { 43 Object value = null; 44 if (session != null) { 45 value = session.getAttribute(name); 46 } 47 48 if (value == null) { 49 value = defaultValue; 50 } 51 52 return value; 53 } 54 55 60 public static List getSessionAttributeNames(Session session) { 61 ArrayList v = new ArrayList (); 62 if (session == null) { 63 return v; 64 } 65 Enumeration e = session.getAttributeNames(); 66 while (e.hasMoreElements()) { 67 v.add(e.nextElement()); 68 } 69 return v; 70 } 71 } 72 | Popular Tags |