Package org.zkoss.web.util.resource

## Class ServletLabelLocator

- java.lang.Object
- - org.zkoss.web.util.resource.ServletLabelLocator

- All Implemented Interfaces:
    `LabelLocator`

      public class ServletLabelLocator
      extends java.lang.Object
      implements LabelLocator

  Used by Labels to load labels from a servlet context.
  Author:
    tomyeh

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ServletLabelLocator​(javax.servlet.ServletContext ctx)` | Constructs a locator where the properties file is decided by the library property called org.zkoss.util.label.web.location.
    `ServletLabelLocator​(javax.servlet.ServletContext ctx, java.lang.String path)` | Constructs a locator for the given path.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(java.lang.Object o)` |
    `int` | `hashCode()` |
    `java.net.URL` | `locate​(java.util.Locale locale)` | Returns URL containing the labels for the specified locale, or null if not available.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ServletLabelLocator

          public ServletLabelLocator​(javax.servlet.ServletContext ctx)

      Constructs a locator where the properties file is decided by the library property called org.zkoss.util.label.web.location. If not defined, /WEB-INF/zk-label.properties is assumed

    - #### ServletLabelLocator

          public ServletLabelLocator​(javax.servlet.ServletContext ctx,
                                     java.lang.String path)

      Constructs a locator for the given path.
      Parameters:
        `path` - the path of the properties file
        Notice that `file://path` is supported (but not http://).
      Since:
        5.0.7

  - ### Method Detail

    - #### locate

          public java.net.URL locate​(java.util.Locale locale)
                              throws java.io.IOException

      Description copied from interface: `LabelLocator`
      Returns URL containing the labels for the specified locale, or null if not available.

      It must be thread-safe.

      Specified by:
        `locate` in interface `LabelLocator`
      Throws:
        `java.io.IOException`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals​(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`