aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/HTTPSessionUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/HTTPSessionUtils.java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/HTTPSessionUtils.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/HTTPSessionUtils.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/HTTPSessionUtils.java
new file mode 100644
index 000000000..1e9cb9024
--- /dev/null
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/HTTPSessionUtils.java
@@ -0,0 +1,70 @@
+package at.gv.egovernment.moa.id.util;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.servlet.http.HttpSession;
+
+public class HTTPSessionUtils {
+
+// public static HashMap<String, Object> extractAllProperties(HttpSession session) {
+// @SuppressWarnings("unchecked")
+// Enumeration<String> keys = (Enumeration<String>)session.getAttributeNames();
+// HashMap<String, Object> properties = new HashMap<String, Object>();
+//
+// while(keys.hasMoreElements()) {
+// Object keyObject = keys.nextElement();
+// String key = keyObject.toString();
+// Object value = session.getAttribute(key);
+// properties.put(key, value);
+// }
+//
+// return properties;
+// }
+//
+// public static void pushAllProperties(HttpSession session, HashMap<String, Object> properties) {
+// Set<String> keys = properties.keySet();
+// Iterator<String> keysIterator = keys.iterator();
+// while(keysIterator.hasNext()) {
+// String key = keysIterator.next();
+// session.setAttribute(key, properties.get(key));
+// }
+// }
+//
+// public static boolean getHTTPSessionBoolean(HttpSession session, String name, boolean fallback) {
+// Object obj = session.getAttribute(name);
+// if(obj == null) {
+// return fallback;
+// }
+//
+// if(obj instanceof Boolean) {
+// Boolean b = (Boolean)obj;
+// if(b != null) {
+// return b.booleanValue();
+// }
+// }
+// return fallback;
+// }
+//
+// public static void setHTTPSessionBoolean(HttpSession session, String name, boolean value) {
+// session.setAttribute(name, new Boolean(value));
+// }
+//
+// public static String getHTTPSessionString(HttpSession session, String name, String fallback) {
+// Object obj = session.getAttribute(name);
+// if(obj == null) {
+// return fallback;
+// }
+//
+// if(obj instanceof String) {
+// return (String)obj;
+// }
+// return fallback;
+// }
+//
+// public static void setHTTPSessionString(HttpSession session, String name, String value) {
+// session.setAttribute(name, value);
+// }
+}