|
Hello, user.
How to convert URI into controller and action name? So I need grails controller and action name in servlet filter. Looking at grails source I found that with UrlMappingsHolder it possible to obtain UrlMappingInfo that requieres GrailsWebRequest (GrailsWebRequestFilter put GrailsWebRequest into servlet context) I think putting servlet filter after GrailsWebRequestFilter solve converting issue (ant getting UrlMappingsHolder via grails application context). Is it wrong? In xml parameter (of plugin script doWithWebDescriptor closure) I can't (manage to) find GrailsWebRequestFilter entry to put my servlet entry after it. class SimpleCacheGrailsPlugin { ... def loadAfter = ['controllers'] ... def doWithWebDescriptor = { xml -> if (manager?.hasGrailsPlugin("controllers")) { def webRequestFilter = null; xml.filter.each { f -> if (f == 'org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter') { webRequestFilter = f; } } //failed ****assert(webRequestFilter != null);**** } } ... } Or maybe is there a more simple way? -- Regards, Bakhtiyor --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
Yes you need to put your filter after the URL mapping one. Then use
the Spring RequestContextHolder object def webRequest = RequestContextHolder.currentRequestAttributes() println webRequest.controllerName println webRequest.actionName Cheers On 10/4/07, Bakhtiyor Khodjayev <[hidden email]> wrote: > Hello, user. > > How to convert URI into controller and action name? > > So I need grails controller and action name in servlet filter. > Looking at grails source I found that with UrlMappingsHolder it > possible to obtain UrlMappingInfo that requieres GrailsWebRequest > (GrailsWebRequestFilter put GrailsWebRequest into servlet context) > > I think putting servlet filter after GrailsWebRequestFilter solve > converting issue (ant getting UrlMappingsHolder via grails > application context). Is it wrong? > > In xml parameter (of plugin script doWithWebDescriptor closure) I > can't (manage to) find GrailsWebRequestFilter entry to put my servlet > entry after it. > > > class SimpleCacheGrailsPlugin { > ... > def loadAfter = ['controllers'] > ... > def doWithWebDescriptor = { xml -> > if (manager?.hasGrailsPlugin("controllers")) { > def webRequestFilter = null; > xml.filter.each { f -> > if (f == > 'org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter') { > webRequestFilter = f; > } > } > //failed > ****assert(webRequestFilter != null);**** > } > } > ... > } > > Or maybe is there a more simple way? > > > -- > Regards, > Bakhtiyor > > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > -- Graeme Rocher Grails Project Lead http://grails.org --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
