You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
810 B
35 lines
810 B
package app |
|
|
|
@Grab("org.thymeleaf:thymeleaf-spring3:2.0.16") |
|
@Controller |
|
class Example { |
|
|
|
@RequestMapping("/") |
|
public String helloWorld(Map<String,Object> model) { |
|
model.putAll([title: "My Page", date: new Date(), message: "Hello World"]) |
|
return "home"; |
|
} |
|
|
|
} |
|
|
|
@Configuration |
|
@Log |
|
class MvcConfiguration extends WebMvcConfigurerAdapter { |
|
|
|
@Override |
|
void addInterceptors(def registry) { |
|
log.info("Registering temporary file interceptor") |
|
registry.addInterceptor(temporaryFileInterceptor()) |
|
} |
|
|
|
@Bean |
|
HandlerInterceptor temporaryFileInterceptor() { |
|
log.info("Creating temporary file interceptor") |
|
new HandlerInterceptorAdapter() { |
|
@Override |
|
postHandle(def request, def response, def handler, ModelAndView mav) { |
|
log.info("Model: " + model) |
|
} |
|
} |
|
} |
|
} |