Skip to content

Commit

Permalink
Remove beans to depend on zkspringboot (#16)
Browse files Browse the repository at this point in the history
- By extension fixes #22 as urlMappingFilter will not be used
  • Loading branch information
maiconandsilva committed May 17, 2023
1 parent e7245a6 commit 23be1f8
Showing 1 changed file with 0 additions and 58 deletions.
58 changes: 0 additions & 58 deletions grailszk/src/main/groovy/zk/GrailszkGrailsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@ import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.config.CustomScopeConfigurer
import org.springframework.boot.web.servlet.FilterRegistrationBean
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean
import org.springframework.boot.web.servlet.ServletRegistrationBean
import org.springframework.boot.web.servlet.filter.OrderedFilter
import org.springframework.core.Ordered
import org.springframework.core.io.FileSystemResource
import org.zkoss.lang.Library
import org.zkoss.zk.au.http.DHtmlUpdateServlet
import org.zkoss.zk.grails.DesktopCounter
import org.zkoss.zk.grails.ZkBuilder
import org.zkoss.zk.grails.ZkConfigHelper
import org.zkoss.zk.grails.artefacts.*
import org.zkoss.zk.grails.composer.GrailsBindComposer
import org.zkoss.zk.grails.composer.JQueryComposer
Expand All @@ -31,14 +25,8 @@ import org.zkoss.zk.grails.scope.PageScope
import org.zkoss.zk.grails.select.JQuery
import org.zkoss.zk.grails.web.ComposerMapping
import org.zkoss.zk.grails.web.ZKGrailsOpenSessionInViewFilter
import org.zkoss.zk.grails.web.ZKGrailsPageFilter
import org.zkoss.zk.grails.web.ZULUrlMappingsFilter
import org.zkoss.zk.ui.Component
import org.zkoss.zk.ui.Executions
import org.zkoss.zk.ui.http.DHtmlLayoutServlet
import org.zkoss.zk.ui.http.HttpSessionListener

import javax.servlet.DispatcherType

@Slf4j
class GrailszkGrailsPlugin extends Plugin {
Expand Down Expand Up @@ -174,57 +162,11 @@ Chanwit Kaewkasi <chanwit@gmail.com>: Original author of ZKGrails (versions 2.5.
bean.autowire = "byName"
}

// web.xml
// Filter
//
// e.g. ["zul"]
//
def supportExts = ZkConfigHelper.supportExtensions
boolean supportsAsync = grailsApplication.metadata.getServletVersion() >= "3.0"

//
// e.g. ["*.zul", "/zkau/*"]
//
def filterUrls = supportExts.collect{ "*." + it } + ["/zkau/*"]
def urls = supportExts.collect { "*.$it" } + ["*.zul", "*.dsp", "*.zhtml", "*.xml2html"]

// Servlet
auEngine(ServletRegistrationBean, new DHtmlUpdateServlet(), "/zkau/*")

zkLoader(ServletRegistrationBean, new DHtmlLayoutServlet(), urls as String[]) {
initParameters = [ "update-uri": "/zkau", "compress": "false" ]
loadOnStartup = 0
}

GOSIVFilter(FilterRegistrationBean) {
filter = bean(ZKGrailsOpenSessionInViewFilter)
urlPatterns = filterUrls
}

pageFilter(FilterRegistrationBean) {
name = "sitemesh"
filter = bean(ZKGrailsPageFilter)
urlPatterns = ["/*"]
order = OrderedFilter.HIGHEST_PRECEDENCE
asyncSupported = supportsAsync
dispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.ERROR)
}

urlMappingFilter(FilterRegistrationBean) {
name = "urlMapping"
filter = bean(ZULUrlMappingsFilter)
urlPatterns = ["/*"]
order = OrderedFilter.LOWEST_PRECEDENCE
asyncSupported = supportsAsync
dispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD)
}

// Listener
ZkSessionCleaner(ServletListenerRegistrationBean) {
listener = bean(HttpSessionListener)
order = Ordered.HIGHEST_PRECEDENCE
}

//
// Registering ViewModel Beans to support MVVM
//
Expand Down

0 comments on commit 23be1f8

Please sign in to comment.