code: public static String getRequestURIForGrailsDispatchURI(HttpServletRequest request) {
          UrlPathHelper pathHelper = new UrlPathHelper();
          if (request.getRequestURI().endsWith(GRAILS_DISPATCH_EXTENSION)) {
              String path = pathHelper.getPathWithinApplication(request);
              if (path.startsWith(GRAILS_SERVLET_PATH)) {
                  path = path.substring(GRAILS_SERVLET_PATH.length(),path.length());
              }
              return path.substring(0, path.length() - GRAILS_DISPATCH_EXTENSION.length());
          }
          return pathHelper.getPathWithinApplication(request);
      }
docs: The Grails dispatch servlet maps URIs like /app/grails/example/index.dispatch. This method infers the
  controller URI for the dispatch URI so that /app/grails/example/index.dispatch becomes /app/example/index
  
  @param request The request