Package org.zkoss.zk.ui

## Interface Richlet

- All Known Subinterfaces:
    `StatelessRichlet`
  All Known Implementing Classes:
    `GenericRichlet`

      public interface Richlet

  Defines methods that all richlets must implement. A richlet is a small Java program that creates all necessary components for a given page in response to user's request.

  To activate it, it must be added to `Configuration` by use of `Configuration.addRichlet(java.lang.String, java.lang.Class<?>, java.util.Map<java.lang.String, java.lang.String>)`, or specify <richlet> in zk.xml.

  Author:
    tomyeh

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `destroy()` | Called by the richlet container to indicate to a richlet that the richlet is being taken out of service.
    `LanguageDefinition` | `getLanguageDefinition()` | Returns the default language definition that this richlet belongs to.
    `void` | `init​(RichletConfig config)` | Called by the richlet container to indicate to a richlet that the richlet is being placed into service.
    `void` | `service​(Page page)` | Called by the richlet container to create components when the specified page is visited and created.

- - ### Method Detail

    - #### init

          void init​(RichletConfig config)

      Called by the richlet container to indicate to a richlet that the richlet is being placed into service.

    - #### destroy

          void destroy()

      Called by the richlet container to indicate to a richlet that the richlet is being taken out of service.

    - #### service

          void service​(Page page)
                throws java.lang.Exception

      Called by the richlet container to create components when the specified page is visited and created.
      Throws:
        `java.lang.Exception`

    - #### getLanguageDefinition

          LanguageDefinition getLanguageDefinition()

      Returns the default language definition that this richlet belongs to. Don't return null.

      The default language definition is used to initialize a page when the page is created to be served by this richlet. Note: you can use components from different languages as long as they belong to the same device type (`LanguageDefinition.getDeviceType()`.

      The default language definition controls the URIs used to render a desktop and a page, and the initial zscript codes used to initialize the interpreter (of a page).

      For example, you can return

          LanguageDefinition.lookup("xul/html");