Home Initializing a filter in Grails
Reply: 0

Initializing a filter in Grails

user980
1#
user980 Published in June 18, 2018, 3:39 am

I'm running Grails 2.3.3 and have introduced a filter:

class HvFilters {

   def HvLoginDetailsService

   def filters = {
      all(controller:'*', action:'*') {
         before = {
         }
         after = { Map model ->
            model.myLoginDetails = HvLoginDetailsService.myLoginDetails()
         }
      }
   }
}

When I build using a run-app I get this error:

2018-02-01 15:54:38,710 [localhost-startStop-1] ERROR context.GrailsContextLoader  - 
Error initializing the application: Method on class [homevu1.HvFilters] was 
used outside of a Grails application. 

I've looked at various posts etc. regarding this GrailsContextLoader error - all signs point to the need to initialize the filter in Bootstrap - I had a go but still getting the same error:

SpringSecurityUtils.clientRegisterFilter(
'HvFilters', SecurityFilterPosition.PRE_AUTH_FILTER.order)
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.304004 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO