Class WebAppCache

java.lang.Object
org.apache.ofbiz.webapp.WebAppCache

public class WebAppCache extends Object
Cache for web applications information retrieved from component configurations.

This improves performance by avoiding to retrieve web applications from component configurations each time.

This is a cache which doesn't implement any invalidation mechanism. Once a web applications is defined, it is memoized because it is not meant to change while OFBiz is running.

See Also:
  • Constructor Details

    • WebAppCache

      public WebAppCache(Supplier<Collection<ComponentConfig>> supplier)
      Constructs an empty web application cache.
      Parameters:
      supplier - the source from which components configurations are retrieved
  • Method Details

    • getAppBarWebInfos

      public List<ComponentConfig.WebappInfo> getAppBarWebInfos(String serverName)
      Retrieves the web applications information that must be visible in the context of the server serverName.
      Parameters:
      serverName - the name of the server to match
      Returns:
      the corresponding web applications information
    • getAppBarWebInfos

      public List<ComponentConfig.WebappInfo> getAppBarWebInfos(String serverName, String menuName)
      Retrieves the web applications information that must be visible inside the menu menuName in the context of the server serverName.

      When an empty string or null is used for menuName, all the web application information corresponding to serverName are matched.

      Parameters:
      serverName - the name of server to match
      menuName - the name of the menu to match
      Returns:
      the corresponding web applications information
      Throws:
      NullPointerException - when serverName is null
    • getWebappInfo

      public Optional<ComponentConfig.WebappInfo> getWebappInfo(String serverName, String webAppName)
      Retrieves the first web application information which mount point correspond to webAppName in the context of the server serverName.
      Parameters:
      serverName - the name of the server to match
      webAppName - the name of the web application to match
      Returns:
      the corresponding web application information
      Throws:
      NullPointerException - when serverName is null
    • getShared

      public static WebAppCache getShared()
      Provides access to a shared instance of the webapp cache.
      Returns:
      the shared webapp cache.