Class BufferedContentMgr
java.lang.Object
org.eclnt.jsfserver.bufferedcontent.BufferedContentMgr
Class for adding/removing buffered content instances. Each
buffered content instance is added to the user's session context
with its key.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
add
(IBufferedContent bufferedContent) Adds buffered content - the key under which the buffered content is stored in the session contetxt is "bufferedContent_" + the key of the IBufferedContent instance.static void
add
(IBufferedStreamContent bufferedStreamContent) Sames asadd(IBufferedContent)
, just with other paramter type.boolean
static void
Initialization for cross session usage.static Object
readBufferedContent
(javax.servlet.http.HttpSession session, String id) static void
remove
(IBufferedContent bufferedContent) Removes buffered content from the user's session.static void
remove
(IBufferedContent[] bufferedContents) static void
remove
(IBufferedStreamContent bufferedStreamContent) Removes buffered content from the user's session.static void
removeAllContentOlderThan
(long duration) When adding a content then the timestamp is registered.
-
Constructor Details
-
BufferedContentMgr
public BufferedContentMgr()
-
-
Method Details
-
initSpecialCrossSessionUsage
public static void initSpecialCrossSessionUsage()Initialization for cross session usage. You must only uses this mode in very special situations, by default use the default usage (which you do not have to explicitly initilaize). In the special usage mode instanced that are passed are stored in a static hash table, that is available "cross session". The storing as consequence if independent from the current session.
There are some implications that you must pay attention to:
1. two sessions accessing the same content is only possible if both sessions are residing on one and the same application server node. Clustered scenarios are NOT suppored.
2. you have to pay even more attention to removing buffered content. In the default usage mode buffered content is stored within the user's session and as consequence is released if the session is ended - even if you should forget to remove the content. In the special usage mode there is no cleaning up of references at all, if not correctly done from your side!
3. There is a potencial security risk if sensitive data is exposed cross session. This risk has to be managed by your application! -
checkIfSpecialCrossSessionUsageIsActive
public boolean checkIfSpecialCrossSessionUsageIsActive() -
add
Adds buffered content - the key under which the buffered content is stored in the session contetxt is "bufferedContent_" + the key of the IBufferedContent instance.
Please note: every time you add content you need to also think about when to remove the content. Otherwise it will be kept inside the http session "forever". -
add
Sames asadd(IBufferedContent)
, just with other paramter type. -
readBufferedContent
- Returns:
- The buffered content - either an instance of
IBufferedContent
or an instance ofIBufferedStreamContent
.
-
remove
-
remove
Removes buffered content from the user's session. -
remove
Removes buffered content from the user's session. -
removeAllContentOlderThan
public static void removeAllContentOlderThan(long duration) When adding a content then the timestamp is registered. This method removes all content that is older than the duration passed.- Parameters:
duration
- Duration in milliseconds.
-