Class UsageWithoutSessionContext

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

public class UsageWithoutSessionContext extends 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!
  • Constructor Details

    • UsageWithoutSessionContext

      public UsageWithoutSessionContext()
  • Method Details

    • 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()
    • isUsedWithSessionContext

      public static boolean isUsedWithSessionContext()
      Check if current processing runs with session context - which means: current processing runs in normal server mode. There is no test processing.
    • isUsedWithoutSessionContext

      public static boolean isUsedWithoutSessionContext()
      Check if current processing runs without session context - which means: current processing runs in test mode.
    • 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 javax.servlet.http.HttpSession getDummyHttpSession(boolean createIfNotExists)
      Internal use only.
    • getDummySubpageContext

      public static SubpageContext getDummySubpageContext()
    • processThrowable

      public static void processThrowable(Throwable t)
      Internal use only.
      Delegates the error by default - and hides it if running in mode "usage without session context".
    • getWebcontentDirectory

      public static 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(String webcontentDirectory)
    • getServletTempDirectory

      public static 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(String servletTempDirectory)
    • findWebcontentDirectory

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