Package org.zkoss.zk.ui.util

## Interface URIInterceptor

-     public interface URIInterceptor

  Used to intercept the loading of ZUML pages associated with the specified URI. Developers usually use it to do the security check.

  How this interface is used.

  1. First, you specify a class that implements this interface in WEB-INF/zk.xml as a listener. Then, an instance of the specified class is created.
  2. Each time ZK wants to load a page definition based on an URI, `request(java.lang.String)` is called against the instance created in the previous step.

  Note:

  - Unlike `ExecutionInit` and others listeners, the same instance of `URIInterceptor` is used for the whole application. Thus, you have to make sure it can be accessed concurrently.
  - `request(java.lang.String)` is called even if the page definition is cached.

  ### Differences to `RequestInterceptor`

  `URIInterceptor` is called when retrieving a page definition from an URI (`PageDefinitions.getPageDefinition(org.zkoss.zk.ui.WebApp, org.zkoss.util.resource.Locator, java.lang.String)`). It may or may not be caused by a client request. On the other hand, `RequestInterceptor` is called when ZK Loader or ZK Update Engine is receiving a client request.

  Author:
    tomyeh
  See Also:
    `RequestInterceptor`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `request​(java.lang.String uri)` | Called when the current user requests to load the page of the specified URI.

- - ### Method Detail

    - #### request

          void request​(java.lang.String uri)
                throws java.lang.Exception

      Called when the current user requests to load the page of the specified URI.

      To deny the access, the class shall throw an exception. If you want to redirect to another page, you can configure it with <error-page> by specifying the corresponding page and exception in WEB-INF/zk.xml.

      Throws:
        `java.lang.Exception`