Class Utils


  • public final class Utils
    extends Object
    Utility class.
    Author:
    Michal Gajdos
    • Method Detail

      • store

        public static void store​(ResourceConfig config,
                                 jakarta.servlet.ServletContext context,
                                 String configName)
        Store resource config as an attribute of given servlet context. If config is null then the previously stored value (if any) is removed. The configName is used as an attribute name suffix.
        Parameters:
        config - resource config to be stored.
        context - servlet context to store the config in.
        configName - name or id of the resource config.
      • retrieve

        public static ResourceConfig retrieve​(jakarta.servlet.ServletContext context,
                                              String configName)
        Load resource config from given servlet context. If found then the resource config is also removed from servlet context. The configName is used as an attribute name suffix.
        Parameters:
        context - servlet context to load resource config from.
        configName - name or id of the resource config.
        Returns:
        previously stored resource config or null if no resource config has been stored.
      • getContextParams

        public static Map<String,​Object> getContextParams​(jakarta.servlet.ServletContext servletContext)
        Extract context params from ServletContext.
        Parameters:
        servletContext - actual servlet context.
        Returns:
        map representing current context parameters.