diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestStorage.java')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestStorage.java | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestStorage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestStorage.java new file mode 100644 index 000000000..d33d4693d --- /dev/null +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestStorage.java @@ -0,0 +1,68 @@ +package at.gv.egovernment.moa.id.moduls; + +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpSession; + +import at.gv.egovernment.moa.logging.Logger; + +public class RequestStorage { + + private static final String PENDING_REQUEST = "PENDING_REQUEST"; + + public static Map<String,IRequest> getPendingRequest(HttpSession session) { + + + Object obj = session.getAttribute(PENDING_REQUEST); + if (obj != null) { + synchronized (obj) { + if (obj instanceof Map<?,?>) { + if (((Map<?,?>) obj).size() > 0) { + if ( ((Map<?,?>) obj).keySet().toArray()[0] instanceof String) { + if (((Map<?,?>) obj).get(((Map<?,?>) obj).keySet().toArray()[0]) + instanceof IRequest) { + return (Map<String, IRequest>) obj; + + + + } + } + } + } + } + session.setAttribute(PENDING_REQUEST, null); + } + return null; + } + + public static void setPendingRequest(HttpSession session, Map<String, IRequest> request) { + session.setAttribute(PENDING_REQUEST, request); + } + + public static void removeAllPendingRequests(HttpSession session) { + + Logger.debug(RequestStorage.class.getName()+": Remove all PendingRequests"); + + session.setAttribute(PENDING_REQUEST, null); + } + + public static void removePendingRequest(Map<String, IRequest> requestmap, String requestID) { + + if (requestmap != null && requestID != null) { + + synchronized (requestmap) { + + //Map<String, IRequest> requestmap = getPendingRequest(session); + + if (requestmap.containsKey(requestID)) { + requestmap.remove(requestID); + Logger.debug(RequestStorage.class.getName()+": Remove PendingRequest with ID " + requestID); + + } + + //setPendingRequest(session, requestmap); + } + } + } +} |