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:

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:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called when the current user requests to load the page of the specified URI.
  • Method Details

    • request

      void request(String uri) throws 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:
      Exception