Grails filter and custom taglib not working when deployed

Ajmal

New member
Grails filter not working when deployed on Tomcat 7.0.14. The application is working fine on the local system. We are using Grails 1.3.7. I also have created a taglib to highlight the error or success message which is working fine with local system on (grails run-app) but again not working with deployment. Can anyone please give some help over this ? My code for filters is as below

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 = {
                
            }
        }
    }
 
Top