Class ClassLoaderTheme

java.lang.Object
org.keycloak.theme.ClassLoaderTheme
All Implemented Interfaces:
Theme

public class ClassLoaderTheme extends Object implements Theme
Author:
Stian Thorgersen
  • Constructor Details

  • Method Details

    • init

      public void init(String name, Theme.Type type, ClassLoader classLoader) throws IOException
      Throws:
      IOException
    • getName

      public String getName()
      Specified by:
      getName in interface Theme
    • getParentName

      public String getParentName()
      Specified by:
      getParentName in interface Theme
    • getImportName

      public String getImportName()
      Specified by:
      getImportName in interface Theme
    • getType

      public Theme.Type getType()
      Specified by:
      getType in interface Theme
    • getTemplate

      public URL getTemplate(String name)
      Specified by:
      getTemplate in interface Theme
    • getResourceAsStream

      public InputStream getResourceAsStream(String path) throws IOException
      Specified by:
      getResourceAsStream in interface Theme
      Throws:
      IOException
    • getMessages

      public Properties getMessages(Locale locale) throws IOException
      Description copied from interface: Theme
      Same as getMessages(baseBundlename, locale), but uses a default baseBundlename such as "messages".
      Specified by:
      getMessages in interface Theme
      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

      public Properties getMessages(String baseBundlename, Locale locale) throws IOException
      Description copied from interface: Theme
      Retrieve localized messages from a message bundle.
      Specified by:
      getMessages in interface Theme
      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

      public Properties getEnhancedMessages(RealmModel realm, Locale locale) throws IOException
      Description copied from interface: Theme
      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.

      Specified by:
      getEnhancedMessages in interface Theme
      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

      public Properties getProperties()
      Specified by:
      getProperties in interface Theme