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 | 57 |
1 files changed, 47 insertions, 10 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 index 4e7d8d2ed..35481a0a1 100644 --- 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 @@ -1,28 +1,65 @@ 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 IRequest getPendingRequest(HttpSession session) { - Object obj = session.getAttribute(PENDING_REQUEST); - if (obj != null) { - if (obj instanceof IRequest) { - return (IRequest) obj; - } else { + 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; + return null; } - public static void setPendingRequest(HttpSession session, IRequest request) { + public static void setPendingRequest(HttpSession session, Map<String, IRequest> request) { session.setAttribute(PENDING_REQUEST, request); } - public static void removePendingRequest(HttpSession session) { + public static void removeAllPendingRequests(HttpSession session) { 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("Remove PendingRequest with ID " + requestID); + + } + + //setPendingRequest(session, requestmap); + } + } + } } |