@Configuration
public class MvcConfig
extends org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
Constructor and Description |
---|
MvcConfig() |
Modifier and Type | Method and Description |
---|---|
org.springframework.web.filter.CharacterEncodingFilter |
characterEncodingFilter()
Character encoding filter that forces content-type in response to be UTF-8.
|
void |
configurePathMatch(org.springframework.web.servlet.config.annotation.PathMatchConfigurer configurer) |
DirectoryWriter |
directoryWriter()
Get the directory writer to use.
|
GenieResourceHttpRequestHandler |
genieResourceHttpRequestHandler(DirectoryWriter directoryWriter,
org.springframework.context.ApplicationContext context,
org.springframework.core.io.Resource jobsDir)
Get a static resource handler for Genie Jobs.
|
java.lang.String |
hostName()
Get the hostname for this application.
|
org.springframework.core.io.Resource |
jobsDir(org.springframework.core.io.ResourceLoader resourceLoader,
JobsProperties jobsProperties)
Get the jobs dir as a Spring Resource.
|
org.springframework.core.io.ResourceLoader |
resourceLoader()
Get a resource loader.
|
org.springframework.web.client.RestTemplate |
restTemplate(int httpConnectTimeout,
int httpReadTimeout)
Get RestTemplate for calling between Genie nodes.
|
org.springframework.retry.support.RetryTemplate |
retryTemplate(int noOfRetries,
int initialInterval,
int maxInterval)
Get RetryTemplate.
|
addArgumentResolvers, addCorsMappings, addFormatters, addInterceptors, addResourceHandlers, addReturnValueHandlers, addViewControllers, configureAsyncSupport, configureContentNegotiation, configureDefaultServletHandling, configureHandlerExceptionResolvers, configureMessageConverters, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidator
public void configurePathMatch(org.springframework.web.servlet.config.annotation.PathMatchConfigurer configurer)
Turn off . recognition in paths. Needed due to Job id's in paths potentially having '.' as character.
configurePathMatch
in interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer
configurePathMatch
in class org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@Bean @ConditionalOnMissingBean public org.springframework.core.io.ResourceLoader resourceLoader()
@Bean @ConditionalOnMissingBean public java.lang.String hostName() throws java.net.UnknownHostException
java.net.UnknownHostException
- When the host can't be calculatedInetAddress.getCanonicalHostName()
@Bean(name="genieRestTemplate") public org.springframework.web.client.RestTemplate restTemplate(@Value(value="${genie.http.connect.timeout:2000}") int httpConnectTimeout, @Value(value="${genie.http.read.timeout:10000}") int httpReadTimeout)
httpConnectTimeout
- http connection timeout in millisecondshttpReadTimeout
- http read timeout in milliseconds@Bean(name="genieRetryTemplate") public org.springframework.retry.support.RetryTemplate retryTemplate(@Value(value="${genie.retry.noOfRetries:5}") int noOfRetries, @Value(value="${genie.retry.initialInterval:10000}") int initialInterval, @Value(value="${genie.retry.maxInterval:60000}") int maxInterval)
noOfRetries
- number of retriesinitialInterval
- initial interval for the back-off policymaxInterval
- maximum interval for the back-off policy@Bean @ConditionalOnMissingBean public DirectoryWriter directoryWriter()
@Bean @ConditionalOnMissingBean public org.springframework.core.io.Resource jobsDir(org.springframework.core.io.ResourceLoader resourceLoader, JobsProperties jobsProperties) throws java.io.IOException
resourceLoader
- The resource loader to usejobsProperties
- The jobs properties to usejava.io.IOException
- on error reading or creating the directory@Bean @ConditionalOnMissingBean public GenieResourceHttpRequestHandler genieResourceHttpRequestHandler(DirectoryWriter directoryWriter, org.springframework.context.ApplicationContext context, org.springframework.core.io.Resource jobsDir)
directoryWriter
- The directory writer to use for converting directory resourcescontext
- The spring application contextjobsDir
- The location the user is requesting the jobs be stored@Bean public org.springframework.web.filter.CharacterEncodingFilter characterEncodingFilter()