AU Services"

From Documentation
(Created page with '{{ZKDevelopersReferencePageHeader}} =Version History= {{LastUpdated}} {| border='1px' | width="100%" ! Version !! Date !! Content |- |   |   |   |} {{ZKDeveloper…')
 
m (remove empty version history (via JWB))
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{ZKDevelopersReferencePageHeader}}
 
{{ZKDevelopersReferencePageHeader}}
  
=Version History=
+
An AU service (<javadoc type="interface">org.zkoss.zk.au.AuService</javadoc>) is a plugin used to intercept the AU requests (<javadoc>org.zkoss.zk.au.AuRequest</javadoc>) sent from the client.
{{LastUpdated}}
+
 
{| border='1px' | width="100%"
+
By plugging in an AU service, you could
! Version !! Date !! Content
+
 
|-
+
* Ignore some AU requests (such as [[ZK Developer's Reference/Security Tips/Block Request for Inaccessible Widgets|hostile requests]])
| &nbsp;
+
* Change the default way of handling an AU request
| &nbsp;
+
* Handle application-specific AU requests
| &nbsp;
+
 
|}
+
To plug an AU service to a desktop, you could invoke <javadoc method="addListener(java.lang.Object)" type="interface">org.zkoss.zk.ui.sys.Desktop</javadoc>. 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 <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/Life Cycle Listener|Life Cycle Listener]].
 +
 
 +
<source lang="java">
 +
public class MyDesktopInit implements DesktopInit {
 +
    public void init(Desktop desktop, Object request) {
 +
        desktop.addListener(new MyAuService()); //assume you have an AU service called MyAuService
 +
    }
 +
}
 +
</source>
 +
 
 +
 
  
 
{{ZKDevelopersReferencePageFooter}}
 
{{ZKDevelopersReferencePageFooter}}

Latest revision as of 04:33, 5 February 2024

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
    }
}




Last Update : 2024/02/05

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