@Configuration
@EnableWebMvc
public class WebMvcConfiguration
extends org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
| Modifier and Type | Field and Description |
|---|---|
static String |
BACKEND_RESOURCES |
static String |
FRONTEND_RESOURCES |
com.fasterxml.jackson.databind.ObjectMapper |
objectMapper
Jackson object mapper used to serialize or deserialize Json objects
|
static String |
WIDGETS_RESOURCES |
static String |
WIDGETS_WC_RESOURCES |
| Constructor and Description |
|---|
WebMvcConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
void |
addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry registry)
In Internet Explorer http requests are cached by default.
|
void |
addResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry)
Add resources handler to help Spring to manage our static resources (from frontend and backend)
|
void |
addViewControllers(org.springframework.web.servlet.config.annotation.ViewControllerRegistry registry) |
void |
configureDefaultServletHandling(org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer configurer)
This allows for mapping the DispatcherServlet to "/" (thus overriding the mapping of the container’s default Servlet), while still allowing static resource
requests to be handled by the container’s default Servlet.
|
void |
configureMessageConverters(List<org.springframework.http.converter.HttpMessageConverter<?>> converters)
Spring MVC use a default objectMapper.
|
org.springframework.web.multipart.support.StandardServletMultipartResolver |
multipartResolver()
To use multipart (based on Servlet 3.0) we need to mark the DispatcherServlet with a
MultipartConfigElement in programmatic Servlet
registration. |
static List<org.springframework.http.MediaType> |
supportedMediaTypes() |
addArgumentResolvers, addCorsMappings, addFormatters, addReturnValueHandlers, configureAsyncSupport, configureContentNegotiation, configureHandlerExceptionResolvers, configurePathMatch, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidatorpublic static final String BACKEND_RESOURCES
public static final String FRONTEND_RESOURCES
public static final String WIDGETS_RESOURCES
public static final String WIDGETS_WC_RESOURCES
@Inject public com.fasterxml.jackson.databind.ObjectMapper objectMapper
DesignerConfig.objectMapper()@Bean public org.springframework.web.multipart.support.StandardServletMultipartResolver multipartResolver()
MultipartConfigElement in programmatic Servlet
registration. Configuration settings such as maximum sizes or storage locations need to be applied at that Servlet registration level as Servlet 3.0 does
not allow for those settings to be done from the MultipartResolver.public void configureDefaultServletHandling(org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer configurer)
configureDefaultServletHandling in interface org.springframework.web.servlet.config.annotation.WebMvcConfigurerconfigureDefaultServletHandling in class org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapterpublic void addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry registry)
addInterceptors in interface org.springframework.web.servlet.config.annotation.WebMvcConfigureraddInterceptors in class org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapterregistry - public void addResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry)
addResourceHandlers in interface org.springframework.web.servlet.config.annotation.WebMvcConfigureraddResourceHandlers in class org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapterpublic void addViewControllers(org.springframework.web.servlet.config.annotation.ViewControllerRegistry registry)
addViewControllers in interface org.springframework.web.servlet.config.annotation.WebMvcConfigureraddViewControllers in class org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapterpublic void configureMessageConverters(List<org.springframework.http.converter.HttpMessageConverter<?>> converters)
objectMapper} because of the subtypes.... So we declare two message converters
objectMapper}configureMessageConverters in interface org.springframework.web.servlet.config.annotation.WebMvcConfigurerconfigureMessageConverters in class org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapterpublic static List<org.springframework.http.MediaType> supportedMediaTypes()
Copyright © 2021. All rights reserved.