AU Services"

From Documentation
m ((via JWB))
Line 13: Line 13:
 
If you want to plug a particular component, you could invoke <javadoc method="setAuService(org.zkoss.zk.au.AuService)" type="interface">org.zkoss.zk.ui.Component</javadoc>. Unlike desktops, a component can have at most one AU service.
 
If you want to plug a particular component, you could invoke <javadoc method="setAuService(org.zkoss.zk.au.AuService)" type="interface">org.zkoss.zk.ui.Component</javadoc>. Unlike desktops, a component can have at most one AU service.
  
If you want to plug an AU service, you could implement <javadoc type="interface">org.zkoss.zk.ui.util.DesktopInit</javadoc> and register it in zk.xml as described in [[ZK Developer's Reference/Customization/Init and Cleanup|the Init and Cleanup section]].
+
If you want to plug an AU service, you could implement <javadoc type="interface">org.zkoss.zk.ui.util.DesktopInit</javadoc> and register it in zk.xml as described in [[ZK Developer's Reference/Customization/Life Cycle Listener|Life Cycle Listener]].
  
 
<source lang="java">
 
<source lang="java">

Revision as of 07:51, 4 July 2022

An AU service (AuService) is a plugin used to intercept the AU requests (AuRequest) sent from the client.

By plugging in an AU service, you could

  • Ignore some AU requests (such as hostile requests)
  • Change the default way of handling an AU request
  • Handle application-specific AU requests

To plug an AU service to a desktop, you could invoke Desktop.addListener(Object). You could plug as many AU services as you want. Once plugged, all AU requests will go through the AU services (unless it was ignored by other AU service).

If you want to plug a particular component, you could invoke Component.setAuService(AuService). Unlike desktops, a component can have at most one AU service.

If you want to plug an AU service, you could implement DesktopInit and register it in zk.xml as described in Life Cycle Listener.

public class MyDesktopInit implements DesktopInit {
    public void init(Desktop desktop, Object request) {
        desktop.addListener(new MyAuService()); //assume you have an AU service called MyAuService
    }
}

Version History

Last Update : 2022/07/04


Version Date Content
     



Last Update : 2022/07/04

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.