clean
[zkgrails.git] / ZkGrailsPlugin.groovy
blobdba62661fc0bfa483a6b0664292485b0cd8d26b0
1 class ZkGrailsPlugin {
3 def version = 0.5
4 def dependsOn = [:]
6 // TODO Fill in these fields
7 def author = "chanwit"
8 def authorEmail = ""
9 def title = "ZK (3.0.7) for Grails"
10 def description = '''\
11 Derived from Flyisland ZK Grails Plugin, This plugin adds ZK Ajax framework (www.zkoss.org) support into Grails applications
12 '''
14 // URL to the plugin's documentation
15 def documentation = "http://grails.org/Zk+Plugin"
17 def doWithSpring = {
18 // TODO Implement runtime spring config (optional)
21 def doWithApplicationContext = { applicationContext ->
25 def doWithWebDescriptor = { xml ->
26 // quick hack for page filtering
27 def pageFilter = xml.filter.find { it.'filter-name' == 'sitemesh'}
28 pageFilter.'filter-class'.replaceBody('org.zkoss.zkgrails.ZKGrailsPageFilter')
30 def listenerElements = xml.'listener'[0]
31 listenerElements + {
32 'listener' {
33 'display-name' ("ZK Session Cleaner")
34 'listener-class' ("org.zkoss.zk.ui.http.HttpSessionListener")
38 def servletElements = xml.'servlet'[0]
39 def mappingElements = xml.'servlet-mapping'[0]
41 servletElements + {
42 'servlet' {
43 'servlet-name' ("zkLoader")
44 'servlet-class' ("org.zkoss.zk.ui.http.DHtmlLayoutServlet")
45 'init-param' {
46 'param-name' ("update-uri")
47 'param-value' ("/zkau")
49 'load-on-startup' (0)
53 def urls = ["*.zul", "*.zhtml", "*.svg", "*.xml2html"]
54 urls.each {p ->
55 mappingElements + {
56 'servlet-mapping' {
57 'servlet-name'("zkLoader")
58 'url-pattern'("${p}")
63 servletElements + {
64 'servlet' {
65 'servlet-name' ("auEngine")
66 'servlet-class' ("org.zkoss.zk.au.http.DHtmlUpdateServlet")
69 mappingElements + {
70 'servlet-mapping' {
71 'servlet-name'("auEngine")
72 'url-pattern'("/zkau/*")
77 def doWithDynamicMethods = { ctx ->
78 // TODO Implement registering dynamic methods to classes (optional)
81 def onChange = { event ->
82 // TODO Implement code that is executed when any artefact that this plugin is
83 // watching is modified and reloaded. The event contains: event.source,
84 // event.application, event.manager, event.ctx, and event.plugin.
87 def onConfigChange = { event ->
88 // TODO Implement code that is executed when the project configuration changes.
89 // The event is the same as for 'onChange'.