org.eclnt.jsfserver.bufferedcontent

## Class BufferedContentMgr

- java.lang.Object
- - org.eclnt.jsfserver.bufferedcontent.BufferedContentMgr

-     public class BufferedContentMgr
      extends java.lang.Object

  Class for adding/removing buffered content instances. Each buffered content instance is added to the user's session context with its key.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BufferedContentMgr()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static 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 as `add(IBufferedContent)`, just with other paramter type.
    `boolean` | `checkIfSpecialCrossSessionUsageIsActive()`
    `static void` | `initSpecialCrossSessionUsage()` Initialization for cross session usage.
    `static java.lang.Object` | `readBufferedContent(HttpSession session, java.lang.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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BufferedContentMgr

          public BufferedContentMgr()

  - ### Method Detail

    - #### 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

          public static 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.
      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

          public static void add(IBufferedStreamContent bufferedStreamContent)

      Sames as `add(IBufferedContent)`, just with other paramter type.

    - #### readBufferedContent

          public static java.lang.Object readBufferedContent(HttpSession session,
                                                             java.lang.String id)

      Returns:
        The buffered content - either an instance of `IBufferedContent` or an instance of `IBufferedStreamContent`.

    - #### remove

          public static void remove(IBufferedContent[] bufferedContents)

    - #### remove

          public static void remove(IBufferedContent bufferedContent)

      Removes buffered content from the user's session.

    - #### remove

          public static void remove(IBufferedStreamContent bufferedStreamContent)

      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.

Copyright © CaptainCasa Gmbh. All Rights Reserved.