Spring Framework ResourceHandlerRegistry - 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 ResourceHandlerRegistry class.

This code example shows how to use the following methods:addResourceHandler
	@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; 
 
		@Override 
		protected void doGet(HttpServletRequest request, HttpServletResponse response) { 
			this.wrappedResponse = response; 
		} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addResourceHandler
	} 
	 
	@Override 
	public void addResourceHandlers(ResourceHandlerRegistry aRegistry)
	{ 
		aRegistry.addResourceHandler("/s/*").addResourceLocations("classpath:/META-INF/webapp/WEB-INF/view/scripts/*");
		aRegistry.addResourceHandler("/c/*").addResourceLocations("classpath:/META-INF/webapp/WEB-INF/view/css/*");
		aRegistry.addResourceHandler("/i/*").addResourceLocations("classpath:/META-INF/webapp/WEB-INF/view/images/*");
		aRegistry.addResourceHandler("/WEB-INF/view/*").addResourceLocations("classpath:/META-INF/webapp/WEB-INF/view/*");
		aRegistry.addResourceHandler("/favicon.ico").addResourceLocations("classpath:/META-INF/webapp/WEB-INF/view/images/favicon.ico");
	} 
	 
	@Bean 
	public ViewResolver viewResolver() 
	{ 
		UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
		viewResolver.setViewClass(JstlView.class);
		viewResolver.setPrefix("WEB-INF/view/");
		viewResolver.setSuffix(".jsp");
		return viewResolver;
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addResourceHandler
@EnableWebMvc 
public class WebConfig extends WebMvcConfigurerAdapter {
 
	@Override 
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/gui/**").addResourceLocations("/WEB-INF/static/");
                  registry.addResourceHandler("/webjars/**").addResourceLocations("/webjars/");
		super.addResourceHandlers(registry);
	} 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addResourceHandler
        "com.jiwhiz.web.controller" 
}) 
public class WebConfig extends WebMvcConfigurerAdapter {
 
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
        registry.addResourceHandler("/presentation/**").addResourceLocations("/presentation/");
        registry.addResourceHandler("/**").addResourceLocations("/");
    } 
 
    @Override 
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    } 
 
    @Bean 
    public SimpleMappingExceptionResolver exceptionResolver() {
        SimpleMappingExceptionResolver exceptionResolver = new SimpleMappingExceptionResolver();
 
//        Properties exceptionMappings = new Properties(); 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addResourceHandler
		configurer.setCheckRefresh(true);
		return configurer;
	} 
 
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
	} 
	 
    @Bean 
    public MessageSource messageSource() {
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
        messageSource.setBasename("/WEB-INF/messages/messages");
        return messageSource;
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addResourceHandler
        return interceptor;
    } 
     
    @Override 
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/libs/**").addResourceLocations("/libs/");
        registry.addResourceHandler("/app/**").addResourceLocations("/app/");
        registry.addResourceHandler("/assets/**").addResourceLocations("/assets/");
    } 
     
    @Override 
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(webContentInterceptor());
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addResourceHandler
		conversionService.setConverters(Collections.singleton(new AccessTokenRequestConverter()));
		return conversionService;
	} 
 
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
	} 
 
	@Override 
	public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
		converters.add(new BufferedImageHttpMessageConverter());
	} 
 
	@Configuration 
	@EnableOAuth2Client 
	protected static class ResourceConfiguration { 
 
		@Value("${accessTokenUri}") 
		private String accessTokenUri;
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addResourceHandler
        return result; 
    } 
 
    @Override 
    protected void addResourceHandlers(ResourceHandlerRegistry registry) { 
        registry.addResourceHandler("/resources/**").addResourceLocations("/resources/").setCachePeriod(31556926); 
    } 
 
    @Bean 
    public ContentNegotiatingViewResolver contentNegotiatingViewResolver() { 
        ContentNegotiatingViewResolver result = new ContentNegotiatingViewResolver(); 
        Map<String, String> mediaTypes = new HashMap<String, String>(); 
        mediaTypes.put("json", MediaType.APPLICATION_JSON_VALUE); 
        result.setMediaTypes(mediaTypes); 
        MappingJacksonJsonView jacksonView = new MappingJacksonJsonView(); 
        jacksonView.setExtractValueFromSingleKeyModel(true); 
        Set<String> modelKeys = new HashSet<String>(); 
        modelKeys.add("events"); 
        modelKeys.add("event"); 
        jacksonView.setModelKeys(modelKeys); 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addResourceHandler
		return resolver; 
	} 
	 
	@Override 
	protected void addResourceHandlers(ResourceHandlerRegistry registry) { 
		registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); 
	} 
 
	// Configuration for CRUD controller 
	// See ~.crudcontroller 
	 
	@Override 
	protected void addFormatters(FormatterRegistry registry) { 
		AccountConverter accountConverter = new AccountConverter(this.applicationConfig.accountManager()); 
		registry.addConverter(accountConverter); 
	} 
	 
	// Configuration for the interceptor logging HandlerMethod information 
	// See ~.handlermethodinterceptor 
 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addResourceHandler
	*/ 
 
	@Override 
	public void addResourceHandlers(ResourceHandlerRegistry registry)
	{ 
		registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
	} 
 
	@Override 
	public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
	{ 
		configurer.enable();
	} 
 
	@Bean(name = "messageSource") 
	public MessageSource configureMessageSource()
	{ 
		ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
		messageSource.setBasename("classpath:messages");
		messageSource.setCacheSeconds(5);
4
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Spring Framework ResourceHandlerRegistry Methods: