we are progressing on a Grails project. Grails version we are using is 1.3.7 and tomcat 7.0.14 is used for deployment. We are using a filter class to manage our logins and other access restrictions and also using a taglib to show the success and error messages from request or params generically
The problem is everything works charm on local system when ran with (grails run-app) but when created the war and deployed on tomcat the filters and taglibs are not working even the flow doesn't seem hitting both
My code for filter is as below. Any comments on this will be greatly helpful as we are stuck with this
Code:class MyFilters { def userService def filters = { all(controller:'*', action:'*') { before = { request.serverUrl = "http://${request?.getServerName()}" if(request.getServerPort()) request.serverUrl = "http://${request.getServerName()}:${request.getServerPort()}" if(request?.getCookie("ftCookie")) request?.user = userService?.getUserCredentialFor(request?.getCookie("ftCookie")) if(!request.getCookie("ftCookie") && ((!controllerName.equals('public')) && (!controllerName.equals('login') && actionName.equals('show')) && (!controllerName.equals('onBoarding')))) { //Login by giving username and password to login/show redirect(controller:'public', action:'index') //return false } if(request.getCookie("ftCookie") && ((controllerName.equals('login') && actionName.equals('show')) || (controllerName.equals('public')) || (controllerName.equals('onBoarding')))) { request.user = userService.getUserCredentialFor(request.getCookie("ftCookie")) if(request.user instanceof UserDTO) { if(request?.user?.role == 1) { redirect(controller:'dashboard', action:'siteAdmin') } else if(request?.user?.role == 2){ redirect(controller:'organization', action:'site') } else { response.deleteCookie("ftCookie") redirect(controller:'public', action:'index') } } else { response.deleteCookie("ftCookie") redirect(controller:'public', action:'index') } } } after = { } afterView = { } } }


Reply With Quote
