Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
162b9e84
Commit
162b9e84
authored
Jul 27, 2016
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
618e6d6b
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
87 additions
and
30 deletions
+87
-30
HttpEncodingAutoConfiguration.java
...boot/autoconfigure/web/HttpEncodingAutoConfiguration.java
+3
-1
HttpEncodingAutoConfigurationTests.java
...autoconfigure/web/HttpEncodingAutoConfigurationTests.java
+10
-8
AutoConfigureJsonTesters.java
...oot/test/autoconfigure/json/AutoConfigureJsonTesters.java
+1
-0
RelaxedDataBinder.java
...java/org/springframework/boot/bind/RelaxedDataBinder.java
+0
-1
RelaxedNames.java
...main/java/org/springframework/boot/bind/RelaxedNames.java
+23
-1
YamlJavaBeanPropertyConstructor.java
...gframework/boot/bind/YamlJavaBeanPropertyConstructor.java
+1
-2
AbstractConfigurableEmbeddedServletContainer.java
...mbedded/AbstractConfigurableEmbeddedServletContainer.java
+1
-0
JettyEmbeddedServletContainerFactory.java
.../embedded/jetty/JettyEmbeddedServletContainerFactory.java
+11
-4
TomcatEmbeddedServletContainerFactory.java
...mbedded/tomcat/TomcatEmbeddedServletContainerFactory.java
+24
-9
UndertowEmbeddedServletContainerFactory.java
...ded/undertow/UndertowEmbeddedServletContainerFactory.java
+11
-4
JettyEmbeddedServletContainerFactoryTests.java
...dded/jetty/JettyEmbeddedServletContainerFactoryTests.java
+1
-0
UndertowEmbeddedServletContainerFactoryTests.java
...ndertow/UndertowEmbeddedServletContainerFactoryTests.java
+1
-0
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfiguration.java
View file @
162b9e84
...
@@ -67,7 +67,8 @@ public class HttpEncodingAutoConfiguration {
...
@@ -67,7 +67,8 @@ public class HttpEncodingAutoConfiguration {
return
new
LocaleCharsetMappingsCustomizer
(
this
.
properties
);
return
new
LocaleCharsetMappingsCustomizer
(
this
.
properties
);
}
}
private
static
class
LocaleCharsetMappingsCustomizer
implements
EmbeddedServletContainerCustomizer
,
Ordered
{
private
static
class
LocaleCharsetMappingsCustomizer
implements
EmbeddedServletContainerCustomizer
,
Ordered
{
private
final
HttpEncodingProperties
properties
;
private
final
HttpEncodingProperties
properties
;
...
@@ -86,6 +87,7 @@ public class HttpEncodingAutoConfiguration {
...
@@ -86,6 +87,7 @@ public class HttpEncodingAutoConfiguration {
public
int
getOrder
()
{
public
int
getOrder
()
{
return
0
;
return
0
;
}
}
}
}
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java
View file @
162b9e84
...
@@ -145,8 +145,8 @@ public class HttpEncodingAutoConfigurationTests {
...
@@ -145,8 +145,8 @@ public class HttpEncodingAutoConfigurationTests {
@Test
@Test
public
void
noLocaleCharsetMapping
()
{
public
void
noLocaleCharsetMapping
()
{
load
(
EmptyConfiguration
.
class
);
load
(
EmptyConfiguration
.
class
);
Map
<
String
,
EmbeddedServletContainerCustomizer
>
beans
=
Map
<
String
,
EmbeddedServletContainerCustomizer
>
beans
=
this
.
context
this
.
context
.
getBeansOfType
(
EmbeddedServletContainerCustomizer
.
class
);
.
getBeansOfType
(
EmbeddedServletContainerCustomizer
.
class
);
assertThat
(
beans
.
size
()).
isEqualTo
(
1
);
assertThat
(
beans
.
size
()).
isEqualTo
(
1
);
assertThat
(
this
.
context
.
getBean
(
MockEmbeddedServletContainerFactory
.
class
)
assertThat
(
this
.
context
.
getBean
(
MockEmbeddedServletContainerFactory
.
class
)
.
getLocaleCharsetMappings
().
size
()).
isEqualTo
(
0
);
.
getLocaleCharsetMappings
().
size
()).
isEqualTo
(
0
);
...
@@ -156,15 +156,17 @@ public class HttpEncodingAutoConfigurationTests {
...
@@ -156,15 +156,17 @@ public class HttpEncodingAutoConfigurationTests {
public
void
customLocaleCharsetMappings
()
{
public
void
customLocaleCharsetMappings
()
{
load
(
EmptyConfiguration
.
class
,
"spring.http.encoding.mapping.en:UTF-8"
,
load
(
EmptyConfiguration
.
class
,
"spring.http.encoding.mapping.en:UTF-8"
,
"spring.http.encoding.mapping.fr_FR:UTF-8"
);
"spring.http.encoding.mapping.fr_FR:UTF-8"
);
Map
<
String
,
EmbeddedServletContainerCustomizer
>
beans
=
Map
<
String
,
EmbeddedServletContainerCustomizer
>
beans
=
this
.
context
this
.
context
.
getBeansOfType
(
EmbeddedServletContainerCustomizer
.
class
);
.
getBeansOfType
(
EmbeddedServletContainerCustomizer
.
class
);
assertThat
(
beans
.
size
()).
isEqualTo
(
1
);
assertThat
(
beans
.
size
()).
isEqualTo
(
1
);
assertThat
(
this
.
context
.
getBean
(
MockEmbeddedServletContainerFactory
.
class
)
assertThat
(
this
.
context
.
getBean
(
MockEmbeddedServletContainerFactory
.
class
)
.
getLocaleCharsetMappings
().
size
()).
isEqualTo
(
2
);
.
getLocaleCharsetMappings
().
size
()).
isEqualTo
(
2
);
assertThat
(
this
.
context
.
getBean
(
MockEmbeddedServletContainerFactory
.
class
)
assertThat
(
this
.
context
.
getBean
(
MockEmbeddedServletContainerFactory
.
class
)
.
getLocaleCharsetMappings
().
get
(
Locale
.
ENGLISH
)).
isEqualTo
(
Charset
.
forName
(
"UTF-8"
));
.
getLocaleCharsetMappings
().
get
(
Locale
.
ENGLISH
))
.
isEqualTo
(
Charset
.
forName
(
"UTF-8"
));
assertThat
(
this
.
context
.
getBean
(
MockEmbeddedServletContainerFactory
.
class
)
assertThat
(
this
.
context
.
getBean
(
MockEmbeddedServletContainerFactory
.
class
)
.
getLocaleCharsetMappings
().
get
(
Locale
.
FRANCE
)).
isEqualTo
(
Charset
.
forName
(
"UTF-8"
));
.
getLocaleCharsetMappings
().
get
(
Locale
.
FRANCE
))
.
isEqualTo
(
Charset
.
forName
(
"UTF-8"
));
}
}
private
void
assertCharacterEncodingFilter
(
CharacterEncodingFilter
actual
,
private
void
assertCharacterEncodingFilter
(
CharacterEncodingFilter
actual
,
...
@@ -233,10 +235,10 @@ public class HttpEncodingAutoConfigurationTests {
...
@@ -233,10 +235,10 @@ public class HttpEncodingAutoConfigurationTests {
}
}
@Bean
@Bean
public
EmbeddedServletContainerCustomizerBeanPostProcessor
public
EmbeddedServletContainerCustomizerBeanPostProcessor
embeddedServletContainerCustomizerBeanPostProcessor
()
{
embeddedServletContainerCustomizerBeanPostProcessor
()
{
return
new
EmbeddedServletContainerCustomizerBeanPostProcessor
();
return
new
EmbeddedServletContainerCustomizerBeanPostProcessor
();
}
}
}
}
}
}
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/AutoConfigureJsonTesters.java
View file @
162b9e84
...
@@ -33,6 +33,7 @@ import org.springframework.boot.test.json.JacksonTester;
...
@@ -33,6 +33,7 @@ import org.springframework.boot.test.json.JacksonTester;
* auto-configuration of JSON testers.
* auto-configuration of JSON testers.
*
*
* @author Phillip Webb
* @author Phillip Webb
* @since 1.4.0
*/
*/
@Target
(
ElementType
.
TYPE
)
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
...
...
spring-boot/src/main/java/org/springframework/boot/bind/RelaxedDataBinder.java
View file @
162b9e84
...
@@ -276,7 +276,6 @@ public class RelaxedDataBinder extends DataBinder {
...
@@ -276,7 +276,6 @@ public class RelaxedDataBinder extends DataBinder {
if
(
path
.
name
(++
index
)
==
null
)
{
if
(
path
.
name
(++
index
)
==
null
)
{
return
path
.
toString
();
return
path
.
toString
();
}
}
String
name
=
path
.
prefix
(
index
);
String
name
=
path
.
prefix
(
index
);
TypeDescriptor
descriptor
=
wrapper
.
getPropertyTypeDescriptor
(
name
);
TypeDescriptor
descriptor
=
wrapper
.
getPropertyTypeDescriptor
(
name
);
if
(
descriptor
==
null
||
descriptor
.
isMap
())
{
if
(
descriptor
==
null
||
descriptor
.
isMap
())
{
...
...
spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java
View file @
162b9e84
/*
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -79,24 +79,30 @@ public final class RelaxedNames implements Iterable<String> {
...
@@ -79,24 +79,30 @@ public final class RelaxedNames implements Iterable<String> {
enum
Variation
{
enum
Variation
{
NONE
{
NONE
{
@Override
@Override
public
String
apply
(
String
value
)
{
public
String
apply
(
String
value
)
{
return
value
;
return
value
;
}
}
},
},
LOWERCASE
{
LOWERCASE
{
@Override
@Override
public
String
apply
(
String
value
)
{
public
String
apply
(
String
value
)
{
return
value
.
toLowerCase
();
return
value
.
toLowerCase
();
}
}
},
},
UPPERCASE
{
UPPERCASE
{
@Override
@Override
public
String
apply
(
String
value
)
{
public
String
apply
(
String
value
)
{
return
value
.
toUpperCase
();
return
value
.
toUpperCase
();
}
}
};
};
public
abstract
String
apply
(
String
value
);
public
abstract
String
apply
(
String
value
);
...
@@ -109,34 +115,43 @@ public final class RelaxedNames implements Iterable<String> {
...
@@ -109,34 +115,43 @@ public final class RelaxedNames implements Iterable<String> {
enum
Manipulation
{
enum
Manipulation
{
NONE
{
NONE
{
@Override
@Override
public
String
apply
(
String
value
)
{
public
String
apply
(
String
value
)
{
return
value
;
return
value
;
}
}
},
},
HYPHEN_TO_UNDERSCORE
{
HYPHEN_TO_UNDERSCORE
{
@Override
@Override
public
String
apply
(
String
value
)
{
public
String
apply
(
String
value
)
{
return
value
.
replace
(
"-"
,
"_"
);
return
value
.
replace
(
"-"
,
"_"
);
}
}
},
},
UNDERSCORE_TO_PERIOD
{
UNDERSCORE_TO_PERIOD
{
@Override
@Override
public
String
apply
(
String
value
)
{
public
String
apply
(
String
value
)
{
return
value
.
replace
(
"_"
,
"."
);
return
value
.
replace
(
"_"
,
"."
);
}
}
},
},
PERIOD_TO_UNDERSCORE
{
PERIOD_TO_UNDERSCORE
{
@Override
@Override
public
String
apply
(
String
value
)
{
public
String
apply
(
String
value
)
{
return
value
.
replace
(
"."
,
"_"
);
return
value
.
replace
(
"."
,
"_"
);
}
}
},
},
CAMELCASE_TO_UNDERSCORE
{
CAMELCASE_TO_UNDERSCORE
{
@Override
@Override
public
String
apply
(
String
value
)
{
public
String
apply
(
String
value
)
{
Matcher
matcher
=
CAMEL_CASE_PATTERN
.
matcher
(
value
);
Matcher
matcher
=
CAMEL_CASE_PATTERN
.
matcher
(
value
);
...
@@ -148,9 +163,11 @@ public final class RelaxedNames implements Iterable<String> {
...
@@ -148,9 +163,11 @@ public final class RelaxedNames implements Iterable<String> {
matcher
.
appendTail
(
result
);
matcher
.
appendTail
(
result
);
return
result
.
toString
();
return
result
.
toString
();
}
}
},
},
CAMELCASE_TO_HYPHEN
{
CAMELCASE_TO_HYPHEN
{
@Override
@Override
public
String
apply
(
String
value
)
{
public
String
apply
(
String
value
)
{
Matcher
matcher
=
CAMEL_CASE_PATTERN
.
matcher
(
value
);
Matcher
matcher
=
CAMEL_CASE_PATTERN
.
matcher
(
value
);
...
@@ -162,20 +179,25 @@ public final class RelaxedNames implements Iterable<String> {
...
@@ -162,20 +179,25 @@ public final class RelaxedNames implements Iterable<String> {
matcher
.
appendTail
(
result
);
matcher
.
appendTail
(
result
);
return
result
.
toString
();
return
result
.
toString
();
}
}
},
},
SEPARATED_TO_CAMELCASE
{
SEPARATED_TO_CAMELCASE
{
@Override
@Override
public
String
apply
(
String
value
)
{
public
String
apply
(
String
value
)
{
return
separatedToCamelCase
(
value
,
false
);
return
separatedToCamelCase
(
value
,
false
);
}
}
},
},
CASE_INSENSITIVE_SEPARATED_TO_CAMELCASE
{
CASE_INSENSITIVE_SEPARATED_TO_CAMELCASE
{
@Override
@Override
public
String
apply
(
String
value
)
{
public
String
apply
(
String
value
)
{
return
separatedToCamelCase
(
value
,
true
);
return
separatedToCamelCase
(
value
,
true
);
}
}
};
};
public
abstract
String
apply
(
String
value
);
public
abstract
String
apply
(
String
value
);
...
...
spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java
View file @
162b9e84
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -69,7 +69,6 @@ public class YamlJavaBeanPropertyConstructor extends Constructor {
...
@@ -69,7 +69,6 @@ public class YamlJavaBeanPropertyConstructor extends Constructor {
typeMap
=
new
HashMap
<
String
,
Property
>();
typeMap
=
new
HashMap
<
String
,
Property
>();
this
.
properties
.
put
(
type
,
typeMap
);
this
.
properties
.
put
(
type
,
typeMap
);
}
}
try
{
try
{
typeMap
.
put
(
alias
,
this
.
propertyUtils
.
getProperty
(
type
,
name
));
typeMap
.
put
(
alias
,
this
.
propertyUtils
.
getProperty
(
type
,
name
));
}
}
...
...
spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java
View file @
162b9e84
...
@@ -342,6 +342,7 @@ public abstract class AbstractConfigurableEmbeddedServletContainer
...
@@ -342,6 +342,7 @@ public abstract class AbstractConfigurableEmbeddedServletContainer
return
this
.
localeCharsetMappings
;
return
this
.
localeCharsetMappings
;
}
}
@Override
public
void
setLocaleCharsetMappings
(
Map
<
Locale
,
Charset
>
localeCharsetMappings
)
{
public
void
setLocaleCharsetMappings
(
Map
<
Locale
,
Charset
>
localeCharsetMappings
)
{
Assert
.
notNull
(
localeCharsetMappings
,
"localeCharsetMappings must not be null"
);
Assert
.
notNull
(
localeCharsetMappings
,
"localeCharsetMappings must not be null"
);
this
.
localeCharsetMappings
=
localeCharsetMappings
;
this
.
localeCharsetMappings
=
localeCharsetMappings
;
...
...
spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java
View file @
162b9e84
...
@@ -20,12 +20,14 @@ import java.io.File;
...
@@ -20,12 +20,14 @@ import java.io.File;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
import
java.net.InetSocketAddress
;
import
java.net.URL
;
import
java.net.URL
;
import
java.nio.charset.Charset
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletException
;
...
@@ -355,10 +357,7 @@ public class JettyEmbeddedServletContainerFactory
...
@@ -355,10 +357,7 @@ public class JettyEmbeddedServletContainerFactory
addJspServlet
(
context
);
addJspServlet
(
context
);
context
.
addBean
(
new
JasperInitializer
(
context
),
true
);
context
.
addBean
(
new
JasperInitializer
(
context
),
true
);
}
}
for
(
Locale
locale
:
getLocaleCharsetMappings
().
keySet
())
{
addLocaleMappings
(
context
);
context
.
addLocaleEncoding
(
locale
.
toString
(),
getLocaleCharsetMappings
().
get
(
locale
).
toString
());
}
ServletContextInitializer
[]
initializersToUse
=
mergeInitializers
(
initializers
);
ServletContextInitializer
[]
initializersToUse
=
mergeInitializers
(
initializers
);
Configuration
[]
configurations
=
getWebAppContextConfigurations
(
context
,
Configuration
[]
configurations
=
getWebAppContextConfigurations
(
context
,
initializersToUse
);
initializersToUse
);
...
@@ -367,6 +366,14 @@ public class JettyEmbeddedServletContainerFactory
...
@@ -367,6 +366,14 @@ public class JettyEmbeddedServletContainerFactory
postProcessWebAppContext
(
context
);
postProcessWebAppContext
(
context
);
}
}
private
void
addLocaleMappings
(
WebAppContext
context
)
{
for
(
Map
.
Entry
<
Locale
,
Charset
>
entry
:
getLocaleCharsetMappings
().
entrySet
())
{
Locale
locale
=
entry
.
getKey
();
Charset
charset
=
entry
.
getValue
();
context
.
addLocaleEncoding
(
locale
.
toString
(),
charset
.
toString
());
}
}
private
void
configureSession
(
WebAppContext
context
)
{
private
void
configureSession
(
WebAppContext
context
)
{
SessionManager
sessionManager
=
context
.
getSessionHandler
().
getSessionManager
();
SessionManager
sessionManager
=
context
.
getSessionHandler
().
getSessionManager
();
int
sessionTimeout
=
(
getSessionTimeout
()
>
0
?
getSessionTimeout
()
:
-
1
);
int
sessionTimeout
=
(
getSessionTimeout
()
>
0
?
getSessionTimeout
()
:
-
1
);
...
...
spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java
View file @
162b9e84
...
@@ -27,6 +27,7 @@ import java.util.Collection;
...
@@ -27,6 +27,7 @@ import java.util.Collection;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.Map.Entry
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
...
@@ -194,15 +195,8 @@ public class TomcatEmbeddedServletContainerFactory
...
@@ -194,15 +195,8 @@ public class TomcatEmbeddedServletContainerFactory
context
.
setParentClassLoader
(
context
.
setParentClassLoader
(
this
.
resourceLoader
!=
null
?
this
.
resourceLoader
.
getClassLoader
()
this
.
resourceLoader
!=
null
?
this
.
resourceLoader
.
getClassLoader
()
:
ClassUtils
.
getDefaultClassLoader
());
:
ClassUtils
.
getDefaultClassLoader
());
// override defaults, see org.apache.catalina.util.CharsetMapperDefault.properties
resetDefaultLocaleMapping
(
context
);
context
.
addLocaleEncodingMappingParameter
(
Locale
.
ENGLISH
.
toString
(),
addLocaleMappings
(
context
);
DEFAULT_CHARSET
.
displayName
());
context
.
addLocaleEncodingMappingParameter
(
Locale
.
FRENCH
.
toString
(),
DEFAULT_CHARSET
.
displayName
());
for
(
Locale
locale
:
getLocaleCharsetMappings
().
keySet
())
{
context
.
addLocaleEncodingMappingParameter
(
locale
.
toString
(),
getLocaleCharsetMappings
().
get
(
locale
).
toString
());
}
try
{
try
{
context
.
setUseRelativeRedirects
(
false
);
context
.
setUseRelativeRedirects
(
false
);
}
}
...
@@ -228,6 +222,27 @@ public class TomcatEmbeddedServletContainerFactory
...
@@ -228,6 +222,27 @@ public class TomcatEmbeddedServletContainerFactory
postProcessContext
(
context
);
postProcessContext
(
context
);
}
}
/**
* Override Tomcat's default locale mappings to align with other containers. See
* {@code org.apache.catalina.util.CharsetMapperDefault.properties}.
* @param context the context to reset
*/
private
void
resetDefaultLocaleMapping
(
TomcatEmbeddedContext
context
)
{
context
.
addLocaleEncodingMappingParameter
(
Locale
.
ENGLISH
.
toString
(),
DEFAULT_CHARSET
.
displayName
());
context
.
addLocaleEncodingMappingParameter
(
Locale
.
FRENCH
.
toString
(),
DEFAULT_CHARSET
.
displayName
());
}
private
void
addLocaleMappings
(
TomcatEmbeddedContext
context
)
{
for
(
Map
.
Entry
<
Locale
,
Charset
>
entry
:
getLocaleCharsetMappings
().
entrySet
())
{
Locale
locale
=
entry
.
getKey
();
Charset
charset
=
entry
.
getValue
();
context
.
addLocaleEncodingMappingParameter
(
locale
.
toString
(),
charset
.
toString
());
}
}
private
void
addDefaultServlet
(
Context
context
)
{
private
void
addDefaultServlet
(
Context
context
)
{
Wrapper
defaultServlet
=
context
.
createWrapper
();
Wrapper
defaultServlet
=
context
.
createWrapper
();
defaultServlet
.
setName
(
"default"
);
defaultServlet
.
setName
(
"default"
);
...
...
spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java
View file @
162b9e84
...
@@ -19,6 +19,7 @@ package org.springframework.boot.context.embedded.undertow;
...
@@ -19,6 +19,7 @@ package org.springframework.boot.context.embedded.undertow;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.nio.charset.Charset
;
import
java.security.KeyManagementException
;
import
java.security.KeyManagementException
;
import
java.security.KeyStore
;
import
java.security.KeyStore
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.NoSuchAlgorithmException
;
...
@@ -28,6 +29,7 @@ import java.util.Collection;
...
@@ -28,6 +29,7 @@ import java.util.Collection;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
javax.net.ssl.KeyManager
;
import
javax.net.ssl.KeyManager
;
...
@@ -383,10 +385,7 @@ public class UndertowEmbeddedServletContainerFactory
...
@@ -383,10 +385,7 @@ public class UndertowEmbeddedServletContainerFactory
File
dir
=
getValidSessionStoreDir
();
File
dir
=
getValidSessionStoreDir
();
deployment
.
setSessionPersistenceManager
(
new
FileSessionPersistence
(
dir
));
deployment
.
setSessionPersistenceManager
(
new
FileSessionPersistence
(
dir
));
}
}
for
(
Locale
locale
:
getLocaleCharsetMappings
().
keySet
())
{
addLocaleMappings
(
deployment
);
deployment
.
addLocaleCharsetMapping
(
locale
.
toString
(),
getLocaleCharsetMappings
().
get
(
locale
).
toString
());
}
DeploymentManager
manager
=
Servlets
.
newContainer
().
addDeployment
(
deployment
);
DeploymentManager
manager
=
Servlets
.
newContainer
().
addDeployment
(
deployment
);
manager
.
deploy
();
manager
.
deploy
();
SessionManager
sessionManager
=
manager
.
getDeployment
().
getSessionManager
();
SessionManager
sessionManager
=
manager
.
getDeployment
().
getSessionManager
();
...
@@ -435,6 +434,14 @@ public class UndertowEmbeddedServletContainerFactory
...
@@ -435,6 +434,14 @@ public class UndertowEmbeddedServletContainerFactory
OptionMap
.
builder
().
set
(
Options
.
THREAD_DAEMON
,
true
).
getMap
());
OptionMap
.
builder
().
set
(
Options
.
THREAD_DAEMON
,
true
).
getMap
());
}
}
private
void
addLocaleMappings
(
DeploymentInfo
deployment
)
{
for
(
Map
.
Entry
<
Locale
,
Charset
>
entry
:
getLocaleCharsetMappings
().
entrySet
())
{
Locale
locale
=
entry
.
getKey
();
Charset
charset
=
entry
.
getValue
();
deployment
.
addLocaleCharsetMapping
(
locale
.
toString
(),
charset
.
toString
());
}
}
private
void
registerServletContainerInitializerToDriveServletContextInitializers
(
private
void
registerServletContainerInitializerToDriveServletContextInitializers
(
DeploymentInfo
deployment
,
ServletContextInitializer
...
initializers
)
{
DeploymentInfo
deployment
,
ServletContextInitializer
...
initializers
)
{
ServletContextInitializer
[]
mergedInitializers
=
mergeInitializers
(
initializers
);
ServletContextInitializer
[]
mergedInitializers
=
mergeInitializers
(
initializers
);
...
...
spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java
View file @
162b9e84
...
@@ -335,4 +335,5 @@ public class JettyEmbeddedServletContainerFactoryTests
...
@@ -335,4 +335,5 @@ public class JettyEmbeddedServletContainerFactoryTests
String
charsetName
=
context
.
getLocaleEncoding
(
locale
);
String
charsetName
=
context
.
getLocaleEncoding
(
locale
);
return
(
charsetName
!=
null
)
?
Charset
.
forName
(
charsetName
)
:
null
;
return
(
charsetName
!=
null
)
?
Charset
.
forName
(
charsetName
)
:
null
;
}
}
}
}
spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java
View file @
162b9e84
...
@@ -277,4 +277,5 @@ public class UndertowEmbeddedServletContainerFactoryTests
...
@@ -277,4 +277,5 @@ public class UndertowEmbeddedServletContainerFactoryTests
String
charsetName
=
info
.
getLocaleCharsetMapping
().
get
(
locale
.
toString
());
String
charsetName
=
info
.
getLocaleCharsetMapping
().
get
(
locale
.
toString
());
return
(
charsetName
!=
null
)
?
Charset
.
forName
(
charsetName
)
:
null
;
return
(
charsetName
!=
null
)
?
Charset
.
forName
(
charsetName
)
:
null
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment