Spring Framework WebMvcConfigurationSupport - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework WebMvcConfigurationSupport class.

This code example shows how to use the following methods:
		return this.servlet.wrappedResponse.encodeURL(path); 
	} 
 
 
	@Configuration 
	static class WebConfig extends WebMvcConfigurationSupport { 
 
		@Override 
		public void addResourceHandlers(ResourceHandlerRegistry registry) { 
			registry.addResourceHandler("/resources/**") 
				.addResourceLocations("classpath:org/springframework/web/servlet/resource/test/") 
				.resourceChain(true).addResolver(new VersionResourceResolver().addContentVersionStrategy("/**")); 
		} 
	} 
 
	@SuppressWarnings("serial") 
	private static class TestServlet extends HttpServlet { 
 
		private HttpServletResponse wrappedResponse; 
 
6
CodeRank
This code example shows how to use the following methods:resourceHandlerMapping, getInterceptors
	} 
 
	@Override 
	public HandlerMapping resourceHandlerMapping ( ) 
	{ 
		SimpleUrlHandlerMapping handlerMapping = (SimpleUrlHandlerMapping) super.resourceHandlerMapping(); 
		handlerMapping.setInterceptors(getInterceptors()); 
		return handlerMapping; 
	} 
 
	@Override 
	public void configureDefaultServletHandling ( DefaultServletHandlerConfigurer configurer ) 
	{ 
		configurer.enable(); 
	} 
 
	@Override 
	public void addResourceHandlers ( ResourceHandlerRegistry registry ) 
	{ 
		ResourceHandlerRegistration resourceHandlerRegistration = registry.addResourceHandler("/**"); 
6
CodeRank
This code example shows how to use the following methods:
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; 
import org.springframework.web.servlet.view.InternalResourceViewResolver; 
 
@Configuration 
@ComponentScan(basePackages = "org.springframework.web.issues", excludeFilters = { @Filter(Configuration.class) }) 
public class WebConfig extends WebMvcConfigurationSupport { 
 
	@Override 
	public void addViewControllers(ViewControllerRegistry registry) { 
		registry.addViewController("/").setViewName("home"); 
	} 
 
	@Bean 
	public InternalResourceViewResolver viewResolver() { 
		InternalResourceViewResolver resolver = new InternalResourceViewResolver(); 
		resolver.setPrefix("/WEB-INF/views/"); 
		resolver.setSuffix(".jsp"); 
		return resolver; 
	}	 
 
5
CodeRank
This code example shows how to use the following methods:
 *  
 * 
 */ 
@Configuration 
@EnableWebMvc 
public class WebMvcConfig extends WebMvcConfigurationSupport { 
 
    /** 
     * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our 
     * controllers. For example, once security has been applied for administrators try commenting out the modifications 
     * to the super class and requesting <a 
     * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will 
     * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss 
     * how to secure the service tier which helps mitigate bypassing of the URL based security too. 
     */ 
    @Bean 
    @Override 
    public RequestMappingHandlerMapping requestMappingHandlerMapping() { 
        RequestMappingHandlerMapping result = super.requestMappingHandlerMapping(); 
        result.setUseSuffixPatternMatch(false); 
3
CodeRank
This code example shows how to use the following methods:
 * <p>Typically extending from {@link WebMvcConfigurerAdapter} and adding  
 * {@code @EnableWebMvc} is sufficient.  
 *  
 */ 
@Configuration 
public class WebConfig extends WebMvcConfigurationSupport { 
	 
	@Autowired 
	private ApplicationConfig applicationConfig; 
 
	@Override 
	public void addViewControllers(ViewControllerRegistry registry) { 
		registry.addViewController("/").setViewName("home"); 
		registry.addViewController("/login").setViewName("login"); 
	} 
 
	@Bean 
	public InternalResourceViewResolver viewResolver() { 
		InternalResourceViewResolver resolver = new InternalResourceViewResolver(); 
		resolver.setPrefix("/WEB-INF/views/"); 
4
CodeRank
This code example shows how to use the following methods:
 */ 
@Configuration 
@EnableWebMvc 
@PropertySource("classpath:resources.properties") 
@ComponentScan(basePackages = "com.sishuok.spring4") 
public class MvcConfiguration extends WebMvcConfigurationSupport { 
 
    @Autowired 
    private Environment env; 
 
    @Override 
    protected Validator getValidator() { 
        LocalValidatorFactoryBean localValidatorFactoryBean = 
                new LocalValidatorFactoryBean(); 
        localValidatorFactoryBean.setProviderClass(HibernateValidator.class); 
        localValidatorFactoryBean.setValidationMessageSource(messageSource()); 
        return localValidatorFactoryBean; 
    } 
 
    @Override 
4
CodeRank
This code example shows how to use the following methods:
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; 
import org.thymeleaf.templateresolver.TemplateResolver; 
 
@Configuration 
@ComponentScan(basePackages = { "org.springframework.samples.async" }) 
public class WebMvcConfig extends WebMvcConfigurationSupport { 
 
	@Override 
	public void configureAsyncSupport(AsyncSupportConfigurer configurer) { 
		configurer.setDefaultTimeout(30*1000L); 
	} 
 
	@Override 
	protected void configureMessageConverters(List<HttpMessageConverter<?>> converters) { 
		converters.add(new MappingJackson2HttpMessageConverter()); 
	} 
 
	public void addViewControllers(ViewControllerRegistry registry) { 
		registry.addViewController("/").setViewName("chat"); 
	} 
4
CodeRank
This code example shows how to use the following methods:
 * @author Stephen K Samuel samspade79@gmail.com 25 Mar 2012 20:49:26 
 *  
 */ 
 
@Configuration 
public class WebConfig extends WebMvcConfigurationSupport implements ApplicationListener<ContextRefreshedEvent> { 
 
	protected static final Logger			logger	= LoggerFactory.getLogger(WebConfig.class); 
 
	@Autowired 
	private GlobalModelAttributesInterceptor	globalModelAttributesInterceptor; 
 
	@Override 
	protected void addFormatters(FormatterRegistry registry) { 
	} 
 
	@Override 
	public void addInterceptors(InterceptorRegistry registry) { 
		registry.addInterceptor(globalModelAttributesInterceptor); 
	} 
4
CodeRank
This code example shows how to use the following methods:mvcConversionService, mvcValidator
@Configuration 
public class WebConfig extends WebMvcConfigurationSupport { 
  @Bean 
  public WebBindingInitializer bindingInitializer() { 
    ConfigurableWebBindingInitializer initializer = new LimsBindingInitializer(); 
    initializer.setConversionService(mvcConversionService()); 
    initializer.setValidator(mvcValidator()); 
    return initializer; 
  } 
 
  @Bean 
  public SessionAttributeStore sessionAttributeStore() { 
    SessionConversationAttributeStore sessionAttributeStore = new SessionConversationAttributeStore(); 
    sessionAttributeStore.setNumConversationsToKeep(1000); 
    return sessionAttributeStore; 
  } 
 
  @Bean 
  public RequestMappingHandlerAdapter requestMappingHandlerAdapter() { 
    RequestMappingHandlerAdapter adapter = super.requestMappingHandlerAdapter(); 
4
CodeRank
This code example shows how to use the following methods:
@Configuration 
@EnableWebMvc 
@ComponentScan(basePackages = "com.sishuok.mvc", useDefaultFilters = false, includeFilters = { 
        @ComponentScan.Filter(type = FilterType.ANNOTATION, value = {Controller.class}) 
}) 
public class MvcConfig extends WebMvcConfigurationSupport { 
 
    @Bean 
    public ViewResolver viewResolver() { 
        InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); 
        viewResolver.setPrefix("/WEB-INF/jsp/"); 
        viewResolver.setSuffix(".jsp"); 
        return viewResolver; 
    } 
 
    @Override 
    protected void addResourceHandlers(ResourceHandlerRegistry registry) { 
        registry.addResourceHandler("/static/**").addResourceLocations("/WEB-INF/static/"); 
    } 
} 
4
CodeRank
See Code Examples for Spring Framework WebMvcConfigurationSupport Methods: