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
00b2954e
Commit
00b2954e
authored
May 10, 2019
by
Brian Clozel
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16730 from eiselems
* pr/16730: Fix 'spring.resources.cache.period' for WebMvc
parents
0b4934d1
94a9748c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
ResourceProperties.java
...gframework/boot/autoconfigure/web/ResourceProperties.java
+4
-0
ResourcePropertiesTests.java
...ework/boot/autoconfigure/web/ResourcePropertiesTests.java
+1
-1
WebMvcAutoConfigurationTests.java
...toconfigure/web/servlet/WebMvcAutoConfigurationTests.java
+3
-4
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java
View file @
00b2954e
...
@@ -476,6 +476,10 @@ public class ResourceProperties {
...
@@ -476,6 +476,10 @@ public class ResourceProperties {
.
staleIfError
(
duration
.
getSeconds
(),
TimeUnit
.
SECONDS
));
.
staleIfError
(
duration
.
getSeconds
(),
TimeUnit
.
SECONDS
));
map
.
from
(
this
::
getSMaxAge
).
whenNonNull
().
to
((
duration
)
->
control
map
.
from
(
this
::
getSMaxAge
).
whenNonNull
().
to
((
duration
)
->
control
.
sMaxAge
(
duration
.
getSeconds
(),
TimeUnit
.
SECONDS
));
.
sMaxAge
(
duration
.
getSeconds
(),
TimeUnit
.
SECONDS
));
// check if cacheControl remained untouched
if
(
control
.
getHeaderValue
()
==
null
)
{
return
null
;
}
return
control
;
return
control
;
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ResourcePropertiesTests.java
View file @
00b2954e
...
@@ -76,7 +76,7 @@ public class ResourcePropertiesTests {
...
@@ -76,7 +76,7 @@ public class ResourcePropertiesTests {
public
void
emptyCacheControl
()
{
public
void
emptyCacheControl
()
{
CacheControl
cacheControl
=
this
.
properties
.
getCache
().
getCachecontrol
()
CacheControl
cacheControl
=
this
.
properties
.
getCache
().
getCachecontrol
()
.
toHttpCacheControl
();
.
toHttpCacheControl
();
assertThat
(
cacheControl
.
getHeaderValue
()
).
isNull
();
assertThat
(
cacheControl
).
isNull
();
}
}
@Test
@Test
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java
View file @
00b2954e
...
@@ -803,13 +803,12 @@ public class WebMvcAutoConfigurationTests {
...
@@ -803,13 +803,12 @@ public class WebMvcAutoConfigurationTests {
Map
<
String
,
Object
>
handlerMap
=
getHandlerMap
(
Map
<
String
,
Object
>
handlerMap
=
getHandlerMap
(
context
.
getBean
(
"resourceHandlerMapping"
,
HandlerMapping
.
class
));
context
.
getBean
(
"resourceHandlerMapping"
,
HandlerMapping
.
class
));
assertThat
(
handlerMap
).
hasSize
(
2
);
assertThat
(
handlerMap
).
hasSize
(
2
);
for
(
Object
handler
:
handlerMap
.
keySet
())
{
for
(
Object
handler
:
handlerMap
.
values
())
{
if
(
handler
instanceof
ResourceHttpRequestHandler
)
{
if
(
handler
instanceof
ResourceHttpRequestHandler
)
{
assertThat
(((
ResourceHttpRequestHandler
)
handler
).
getCacheSeconds
())
assertThat
(((
ResourceHttpRequestHandler
)
handler
).
getCacheSeconds
())
.
isEqualTo
(
-
1
);
.
isEqualTo
(
5
);
assertThat
(((
ResourceHttpRequestHandler
)
handler
).
getCacheControl
())
assertThat
(((
ResourceHttpRequestHandler
)
handler
).
getCacheControl
())
.
isEqualToComparingFieldByField
(
.
isNull
();
CacheControl
.
maxAge
(
5
,
TimeUnit
.
SECONDS
));
}
}
}
}
}
}
...
...
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