org.eclnt.jsfserver.session

## Class UsageWithoutSessionContext

- java.lang.Object
- - org.eclnt.jsfserver.session.UsageWithoutSessionContext

-     public class UsageWithoutSessionContext
      extends java.lang.Object

  In case of e.g. testing server side functions you want the CaptainCasa Server side framework to behave "tolerant" when it comes to accessing information that normally resides within the session environment of the server side processing.
  Example: the `Statusbar` processing depends on the availablilty of a central status bar instance within the current session.
  By using method `initUsageWithoutSessionContext()` you can switch on this "tolerance".
  Please pay attention: you NEVER should use this function within a normal server environment, because it hides certain error messages, that by default indicate problems you should be aware of!

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `UsageWithoutSessionContext.DummyHttpSession`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UsageWithoutSessionContext()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `findWebcontentDirectory()` Find webcontent directory.
    `static HttpSession` | `getDummyHttpSession(boolean createIfNotExists)` Internal use only.
    `static DefaultScreens.SessionAccess` | `getDummySessionAccess()` Internal use only.
    `static SessionInfo` | `getDummySessionInfo()` Internal use only.
    `static SubpageContext` | `getDummySubpageContext()`
    `static java.lang.String` | `getServletTempDirectory()` Functions may require access to files that are stored in the servlet temp directory at runtime.
    `static java.lang.String` | `getWebcontentDirectory()` Functions may require access to files that are part of the webcontent at runtime.
    `static void` | `initCurrentThreadWithoutSessionContext()` Initializes the Java environment, so that it is "tolerant" against missing information, that normally resides on session level.
    `static void` | `initCurrentThreadWithSessionContext()` Switch back method for `initCurrentThreadWithoutSessionContext()`.
    `static void` | `initUsageWithoutSessionContext()` Initializes the Java environment, so that it is "tolerant" against missing information, that normally resides on session level.
    `static void` | `initUsageWithSessionContext()` Ends the special mode, that was opened with `initUsageWithoutSessionContext()`.
    `static boolean` | `isUsedWithoutSessionContext()`
    `static void` | `processThrowable(java.lang.Throwable t)` Internal use only.
    `static void` | `setServletTempDirectory(java.lang.String servletTempDirectory)`
    `static void` | `setSessionInfo(SessionInfo si)` Functions may require access to the session info also when being used/tested outside the session context.
    `static void` | `setWebcontentDirectory(java.lang.String webcontentDirectory)`

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

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

- - ### Constructor Detail

    - #### UsageWithoutSessionContext

          public UsageWithoutSessionContext()

  - ### Method Detail

    - #### initUsageWithoutSessionContext

          public static void initUsageWithoutSessionContext()

      Initializes the Java environment, so that it is "tolerant" against missing information, that normally resides on session level. The information is stored in some static variable, so that the whole Java process now is used without session context.

    - #### initUsageWithSessionContext

          public static void initUsageWithSessionContext()

      Ends the special mode, that was opened with `initUsageWithoutSessionContext()`.

    - #### initCurrentThreadWithoutSessionContext

          public static void initCurrentThreadWithoutSessionContext()

      Initializes the Java environment, so that it is "tolerant" against missing information, that normally resides on session level. The information is stored on thread level.

    - #### initCurrentThreadWithSessionContext

          public static void initCurrentThreadWithSessionContext()

      Switch back method for `initCurrentThreadWithoutSessionContext()`.

    - #### isUsedWithoutSessionContext

          public static boolean isUsedWithoutSessionContext()

    - #### getDummySessionInfo

          public static SessionInfo getDummySessionInfo()

      Internal use only.

    - #### setSessionInfo

          public static void setSessionInfo(SessionInfo si)

      Functions may require access to the session info also when being used/tested outside the session context. With this function you can set the SessionInfo-instance that is used is session information is requested.

    - #### getDummySessionAccess

          public static DefaultScreens.SessionAccess getDummySessionAccess()

      Internal use only.

    - #### getDummyHttpSession

          public static HttpSession getDummyHttpSession(boolean createIfNotExists)

      Internal use only.

    - #### getDummySubpageContext

          public static SubpageContext getDummySubpageContext()

    - #### processThrowable

          public static void processThrowable(java.lang.Throwable t)

      Internal use only.
      Delegates the error by default - and hides it if running in mode "usage without session context".

    - #### getWebcontentDirectory

          public static java.lang.String getWebcontentDirectory()

      Functions may require access to files that are part of the webcontent at runtime. You can pass here the name of a directory in which to look for these files directly.
      Returns:

    - #### setWebcontentDirectory

          public static void setWebcontentDirectory(java.lang.String webcontentDirectory)

    - #### getServletTempDirectory

          public static java.lang.String getServletTempDirectory()

      Functions may require access to files that are stored in the servlet temp directory at runtime. You can pass here a name of a directory in which to look for these files directly.
      Returns:

    - #### setServletTempDirectory

          public static void setServletTempDirectory(java.lang.String servletTempDirectory)

    - #### findWebcontentDirectory

          public static java.lang.String findWebcontentDirectory()

      Find webcontent directory. If an explicit directory is set via `setWebcontentDirectory(String)`, then this is the one returned.
      Otherwise: if a system property value is available via "usagewithoutsessioncontext.webcontent.dir" then this directory is used.
      Otherwise: null is returned

Copyright © CaptainCasa Gmbh. All Rights Reserved.