Interface Theme

All Known Implementing Classes:
ClassLoaderTheme, FileBasedTheme, FolderTheme

public interface Theme
Author:
Stian Thorgersen
  • Field Details

  • Method Details

    • getName

      String getName()
    • getParentName

      String getParentName()
    • getImportName

      String getImportName()
    • getType

      Theme.Type getType()
    • getTemplate

      URL getTemplate(String name) throws IOException
      Throws:
      IOException
    • getResourceAsStream

      InputStream getResourceAsStream(String path) throws IOException
      Throws:
      IOException
    • getMessages

      Properties getMessages(Locale locale) throws IOException
      Same as getMessages(baseBundlename, locale), but uses a default baseBundlename such as "messages".
      Parameters:
      locale - The locale of the desired message bundle.
      Returns:
      The localized messages from the bundle.
      Throws:
      IOException - If bundle can not be read.
    • getMessages

      Properties getMessages(String baseBundlename, Locale locale) throws IOException
      Retrieve localized messages from a message bundle.
      Parameters:
      baseBundlename - The base name of the bundle, such as "messages" in messages_en.properties.
      locale - The locale of the desired message bundle.
      Returns:
      The localized messages from the bundle.
      Throws:
      IOException - If bundle can not be read.
    • getEnhancedMessages

      Properties getEnhancedMessages(RealmModel realm, Locale locale) throws IOException
      Retrieve localized messages from a message bundle named "messages" and enhance those messages with messages from realm localization.

      In general, the translation for the most specific applicable language is used. If a translation exists both in the message bundle and realm localization, the realm localization translation is used.

      Parameters:
      realm - The realm from which the localization should be retrieved
      locale - The locale of the desired message bundle.
      Returns:
      The localized messages from the bundle, enhanced with realm localization
      Throws:
      IOException - If bundle can not be read.
    • getProperties

      Properties getProperties() throws IOException
      Throws:
      IOException
    • hasResource

      default boolean hasResource(String path) throws IOException
      Check if a resource exists in the theme.
      Parameters:
      path - path of the resource
      Returns:
      true if the resource exists
      Throws:
      IOException
    • hasContentHash

      default boolean hasContentHash(String path) throws IOException
      Check if the given path contains a content hash. If a resource is requested from this path, and it has a content hash, this guarantees that if the file exists in two versions of the theme, it will contain the same contents. With this guarantee, a different version of Keycloak can return the same contents even if a caller asks for a different version of Keycloak.
      Parameters:
      path - path to check for a content hash
      Throws:
      IOException
    • isAbstract

      default boolean isAbstract() throws IOException
      Method to know if the theme is just an abstract theme (only to be extended by other themes). By default it just checks the abstract property.
      Returns:
      true if abstract, false if not
      Throws:
      IOException - Some error reading the properties