Class PentahoSessionHolder


  • public class PentahoSessionHolder
    extends Object
    Stores the IPentahoSession session object for the current thread so that a web service bean can get to it without requiring it to be passed to its methods.

    Configure using system property pentaho.sessionHolder.strategy or setStrategyName(String). Valid values are: MODE_INHERITABLETHREADLOCAL and MODE_GLOBAL.

    Partially inspired by org.springframework.security.context.SecurityContextHolder.

    Author:
    jamesdixon, mlowery (modifications to support global)
    • Constructor Detail

      • PentahoSessionHolder

        public PentahoSessionHolder()
        Default constructor.
    • Method Detail

      • setSession

        public static void setSession​(org.pentaho.platform.api.engine.IPentahoSession session)
        Sets an IPentahoSession for the current thread.
        Parameters:
        session - Session to be set.
      • getSession

        public static org.pentaho.platform.api.engine.IPentahoSession getSession()
        Returns the IPentahoSession for the current thread.
        Returns:
        Returns the thread session.
      • removeSession

        public static void removeSession()
        Removes the IPentahoSession for the current thread. It is important that the framework calls this to prevent session "bleed-through" between requests as threads are reused by the server.
      • setStrategyName

        public static void setStrategyName​(String strategyName)
        Sets the behavior of the session. Valid values are: MODE_INHERITABLETHREADLOCAL and MODE_GLOBAL. The changes to the strategy are applied immediately.
        Parameters:
        strategyName - Name of the strategy to be used.