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
c5561753
Commit
c5561753
authored
Aug 13, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.1.x'
parents
6634af6a
2fae4afe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
MetricFilterAutoConfiguration.java
.../actuate/autoconfigure/MetricFilterAutoConfiguration.java
+8
-1
ErrorPageFilter.java
...org/springframework/boot/context/web/ErrorPageFilter.java
+1
-0
ErrorPageFilterTests.java
...pringframework/boot/context/web/ErrorPageFilterTests.java
+15
-0
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.java
View file @
c5561753
...
...
@@ -93,10 +93,17 @@ public class MetricFilterAutoConfiguration {
int
status
=
getStatus
(
response
);
Object
bestMatchingPattern
=
request
.
getAttribute
(
HandlerMapping
.
BEST_MATCHING_PATTERN_ATTRIBUTE
);
HttpStatus
httpStatus
=
HttpStatus
.
OK
;
try
{
httpStatus
=
HttpStatus
.
valueOf
(
status
);
}
catch
(
Exception
e
)
{
// not convertible
}
if
(
bestMatchingPattern
!=
null
)
{
suffix
=
bestMatchingPattern
.
toString
().
replaceAll
(
"[{}]"
,
"-"
);
}
else
if
(
HttpStatus
.
valueOf
(
status
)
.
is4xxClientError
())
{
else
if
(
httpStatus
.
is4xxClientError
())
{
suffix
=
UNKNOWN_PATH_SUFFIX
;
}
String
gaugeKey
=
getKey
(
"response"
+
suffix
);
...
...
spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java
View file @
c5561753
...
...
@@ -239,6 +239,7 @@ class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContainer imple
public
ErrorWrapperResponse
(
HttpServletResponse
response
)
{
super
(
response
);
this
.
status
=
response
.
getStatus
();
}
@Override
...
...
spring-boot/src/test/java/org/springframework/boot/context/web/ErrorPageFilterTests.java
View file @
c5561753
...
...
@@ -205,6 +205,21 @@ public class ErrorPageFilterTests {
assertTrue
(
this
.
response
.
isCommitted
());
}
@Test
public
void
statusCode
()
throws
Exception
{
this
.
chain
=
new
MockFilterChain
()
{
@Override
public
void
doFilter
(
ServletRequest
request
,
ServletResponse
response
)
throws
IOException
,
ServletException
{
assertThat
(((
HttpServletResponse
)
response
).
getStatus
(),
equalTo
(
200
));
super
.
doFilter
(
request
,
response
);
}
};
this
.
filter
.
doFilter
(
this
.
request
,
this
.
response
,
this
.
chain
);
assertThat
(((
HttpServletResponseWrapper
)
this
.
chain
.
getResponse
()).
getStatus
(),
equalTo
(
200
));
}
@Test
public
void
subClassExceptionError
()
throws
Exception
{
this
.
filter
.
addErrorPages
(
new
ErrorPage
(
RuntimeException
.
class
,
"/500"
));
...
...
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