@Test public void addWebRequestInterceptors() throws Exception { this.registry.addWebRequestInterceptor(this.webInterceptor1); this.registry.addWebRequestInterceptor(this.webInterceptor2); List<HandlerInterceptor> interceptors = getInterceptorsForPath(null); assertEquals(2, interceptors.size()); verifyWebInterceptor(interceptors.get(0), this.webInterceptor1); verifyWebInterceptor(interceptors.get(1), this.webInterceptor2); }
@Test public void addWebRequestInterceptor() throws Exception { this.registry.addWebRequestInterceptor(this.webInterceptor1); List<HandlerInterceptor> interceptors = getInterceptorsForPath(null); assertEquals(1, interceptors.size()); verifyWebInterceptor(interceptors.get(0), this.webInterceptor1); }
@Test public void addWebRequestInterceptorsWithUrlPatterns() throws Exception { this.registry.addWebRequestInterceptor(this.webInterceptor1).addPathPatterns("/path1"); this.registry.addWebRequestInterceptor(this.webInterceptor2).addPathPatterns("/path2"); List<HandlerInterceptor> interceptors = getInterceptorsForPath("/path1"); assertEquals(1, interceptors.size()); verifyWebInterceptor(interceptors.get(0), this.webInterceptor1); interceptors = getInterceptorsForPath("/path2"); assertEquals(1, interceptors.size()); verifyWebInterceptor(interceptors.get(0), this.webInterceptor2); }
@Override public void addInterceptors(InterceptorRegistry registry) { registry.addWebRequestInterceptor(broadleafRequestInterceptor()); registry.addWebRequestInterceptor(channelInterceptor()); }
@Override public void addInterceptors(InterceptorRegistry registry) { registry.addWebRequestInterceptor(openSessionInViewInterceptor()); }
@Autowired SessionFactory sessionFactory; @Override public void addInterceptors(InterceptorRegistry registry) { registry.addWebRequestInterceptor(openSessionInViewInterceptor()); } @Bean public OpenSessionInViewInterceptor openSessionInViewInterceptor(){ OpenSessionInViewInterceptor openSessionInterceptor = new OpenSessionInViewInterceptor(); openSessionInterceptor.setSessionFactory(sessionFactory); return openSessionInterceptor; }
@Override public void addInterceptors(InterceptorRegistry registry) { // registry.addInterceptor(commonDataInterceptor()); registry.addWebRequestInterceptor(entityManagerInViewInterceptor()) .addPathPatterns("/**") .excludePathPatterns("/static/**", "/public/**", "/resources/**", "/plugin/**", "/images/**"); registry.addInterceptor(localeChangeInterceptor()); super.addInterceptors(registry); }