Skip to content

Commit

Permalink
Another attempt at making the ui sample work
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyer committed Jul 23, 2013
1 parent db27620 commit d639763
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
<systemPropertyVariables>
<java.security.egd>file:/dev/./urandom</java.security.egd>
</systemPropertyVariables>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>
<plugin>
Expand Down
33 changes: 14 additions & 19 deletions spring-cli/samples/ui.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,25 @@ class Example {
model.putAll([title: "My Page", date: new Date(), message: "Hello World"])
return "home";
}

}

import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

@Configuration
@Log
class MvcConfiguration extends WebMvcConfigurerAdapter {

@Override
void addInterceptors(InterceptorRegistry registry) {
log.info("Registering interceptor")
registry.addInterceptor(interceptor())
}
@Override
void addInterceptors(InterceptorRegistry registry) {
log.info "Registering interceptor"
registry.addInterceptor(interceptor())
}

@Bean
HandlerInterceptor interceptor() {
log.info("Creating interceptor")
new HandlerInterceptorAdapter() {
@Override
void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView mav) {
log.info("Model: " + mav.model)
}
}
}
@Bean
HandlerInterceptor interceptor() {
log.info "Creating interceptor"
[
postHandle: { request, response, handler, mav ->
log.info "Intercepted: model=" + mav.model
}
] as HandlerInterceptorAdapter
}
}

0 comments on commit d639763

Please sign in to comment.