2

I have a Grails 3.1.3 app with the following setup:

class UrlMappings {
    static mappings = {
        "/error"(controller: 'error', action: 'error')      
        "/$controller/$action?/$id?"()      
        "/"(controller: "index", action: "index")       
    }
}

class IndexController {     
    static allowedMethods = [index:'GET']

    def index() {
        println "Reached index action"
        ...
    }   
}

class FormInterceptor implements grails.artefact.Interceptor {

    int order = HIGHEST_PRECEDENCE + 100

    FormInterceptor() {
        matchAll()
    }

    boolean before() {
        println "request.requestURI: ${request.requestURI}"
    }
    ...
}

When navigating to the app's context root (i.e. http://localhost:8080/app-context-root/), the following output results:

request.requestURI: /app-context-root/
Reached index action

Aside from using a redirect in UrlMappings.groovy, can I have the url mapping from / to /app-context-root/index/index happen BEFORE my interceptors receive the request URI?

mwersch
  • 105
  • 7

0 Answers0