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
1d2d76b0
Commit
1d2d76b0
authored
May 25, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.2.x'
Closes gh-21560
parents
18e0db63
afcb5d54
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
0 deletions
+22
-0
WebFluxTags.java
...boot/actuate/metrics/web/reactive/server/WebFluxTags.java
+3
-0
WebMvcTags.java
...ramework/boot/actuate/metrics/web/servlet/WebMvcTags.java
+3
-0
WebMvcTagsTests.java
...rk/boot/actuate/endpoint/web/servlet/WebMvcTagsTests.java
+8
-0
WebFluxTagsTests.java
...actuate/metrics/web/reactive/server/WebFluxTagsTests.java
+8
-0
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java
View file @
1d2d76b0
...
...
@@ -110,6 +110,9 @@ public final class WebFluxTags {
if
(
ignoreTrailingSlash
&&
patternString
.
length
()
>
1
)
{
patternString
=
TRAILING_SLASH_PATTERN
.
matcher
(
patternString
).
replaceAll
(
""
);
}
if
(
patternString
.
isEmpty
())
{
return
URI_ROOT
;
}
return
Tag
.
of
(
"uri"
,
patternString
);
}
HttpStatus
status
=
exchange
.
getResponse
().
getStatusCode
();
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java
View file @
1d2d76b0
...
...
@@ -115,6 +115,9 @@ public final class WebMvcTags {
if
(
ignoreTrailingSlash
&&
pattern
.
length
()
>
1
)
{
pattern
=
TRAILING_SLASH_PATTERN
.
matcher
(
pattern
).
replaceAll
(
""
);
}
if
(
pattern
.
isEmpty
())
{
return
URI_ROOT
;
}
return
Tag
.
of
(
"uri"
,
pattern
);
}
if
(
response
!=
null
)
{
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/WebMvcTagsTests.java
View file @
1d2d76b0
...
...
@@ -58,6 +58,14 @@ class WebMvcTagsTests {
assertThat
(
tag
.
getValue
()).
isEqualTo
(
"/spring/"
);
}
@Test
void
uriTagValueIsRootWhenBestMatchingPatternIsEmpty
()
{
this
.
request
.
setAttribute
(
HandlerMapping
.
BEST_MATCHING_PATTERN_ATTRIBUTE
,
""
);
this
.
response
.
setStatus
(
301
);
Tag
tag
=
WebMvcTags
.
uri
(
this
.
request
,
this
.
response
);
assertThat
(
tag
.
getValue
()).
isEqualTo
(
"root"
);
}
@Test
void
uriTagValueWithBestMatchingPatternAndIgnoreTrailingSlashRemoveTrailingSlash
()
{
this
.
request
.
setAttribute
(
HandlerMapping
.
BEST_MATCHING_PATTERN_ATTRIBUTE
,
"/spring/"
);
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTagsTests.java
View file @
1d2d76b0
...
...
@@ -61,6 +61,14 @@ class WebFluxTagsTests {
assertThat
(
tag
.
getValue
()).
isEqualTo
(
"/spring/"
);
}
@Test
void
uriTagValueIsRootWhenBestMatchingPatternIsEmpty
()
{
this
.
exchange
.
getAttributes
().
put
(
HandlerMapping
.
BEST_MATCHING_PATTERN_ATTRIBUTE
,
this
.
parser
.
parse
(
""
));
this
.
exchange
.
getResponse
().
setStatusCode
(
HttpStatus
.
MOVED_PERMANENTLY
);
Tag
tag
=
WebFluxTags
.
uri
(
this
.
exchange
);
assertThat
(
tag
.
getValue
()).
isEqualTo
(
"root"
);
}
@Test
void
uriTagValueWithBestMatchingPatternAndIgnoreTrailingSlashRemoveTrailingSlash
()
{
this
.
exchange
.
getAttributes
().
put
(
HandlerMapping
.
BEST_MATCHING_PATTERN_ATTRIBUTE
,
...
...
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