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
f43aa944
Commit
f43aa944
authored
Sep 20, 2017
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Remove usage of `HttpStatus` in Web Endpoints"
Closes gh-10350
parent
6c6ce722
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
14 deletions
+19
-14
AuditEventsWebEndpointExtension.java
...k/boot/actuate/audit/AuditEventsWebEndpointExtension.java
+1
-1
WebEndpointResponse.java
...mework/boot/actuate/endpoint/web/WebEndpointResponse.java
+11
-6
HealthStatusHttpMapper.java
...framework/boot/actuate/health/HealthStatusHttpMapper.java
+4
-4
HeapDumpWebEndpoint.java
...ramework/boot/actuate/management/HeapDumpWebEndpoint.java
+3
-3
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEventsWebEndpointExtension.java
View file @
f43aa944
...
...
@@ -42,7 +42,7 @@ public class AuditEventsWebEndpointExtension {
public
WebEndpointResponse
<
AuditEventsDescriptor
>
eventsWithPrincipalDateAfterAndType
(
String
principal
,
Date
after
,
String
type
)
{
if
(
after
==
null
)
{
return
new
WebEndpointResponse
<>(
WebEndpointResponse
.
BAD_REQUEST_STATUS
);
return
new
WebEndpointResponse
<>(
WebEndpointResponse
.
STATUS_BAD_REQUEST
);
}
AuditEventsDescriptor
auditEvents
=
this
.
delegate
.
eventsWithPrincipalDateAfterAndType
(
principal
,
after
,
type
);
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/WebEndpointResponse.java
View file @
f43aa944
...
...
@@ -34,27 +34,32 @@ public final class WebEndpointResponse<T> {
/**
* {@code 200 OK}.
*/
public
static
final
int
OK_STATUS
=
200
;
public
static
final
int
STATUS_OK
=
200
;
/**
* {@code 400 Bad Request}.
*/
public
static
final
int
BAD_REQUEST_STATUS
=
400
;
public
static
final
int
STATUS_BAD_REQUEST
=
400
;
/**
* {@code 404 Not Found}.
*/
public
static
final
int
STATUS_NOT_FOUND
=
404
;
/**
* {@code 429 Too Many Requests}.
*/
public
static
final
int
TOO_MANY_REQUESTS_STATU
S
=
429
;
public
static
final
int
STATUS_TOO_MANY_REQUEST
S
=
429
;
/**
* {@code 500 Internal Server Error}.
*/
public
static
final
int
INTERNAL_SERVER_ERROR_STATUS
=
500
;
public
static
final
int
STATUS_INTERNAL_SERVER_ERROR
=
500
;
/**
* {@code 503 Service Unavailable}.
*/
public
static
final
int
S
ERVICE_UNAVAILABLE_STATUS
=
503
;
public
static
final
int
S
TATUS_SERVICE_UNAVAILABLE
=
503
;
private
final
T
body
;
...
...
@@ -82,7 +87,7 @@ public final class WebEndpointResponse<T> {
* @param body the body
*/
public
WebEndpointResponse
(
T
body
)
{
this
(
body
,
OK_STATUS
);
this
(
body
,
STATUS_OK
);
}
/**
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java
View file @
f43aa944
...
...
@@ -41,9 +41,9 @@ public class HealthStatusHttpMapper {
}
private
void
setupDefaultStatusMapping
()
{
addStatusMapping
(
Status
.
DOWN
,
WebEndpointResponse
.
S
ERVICE_UNAVAILABLE_STATUS
);
addStatusMapping
(
Status
.
DOWN
,
WebEndpointResponse
.
S
TATUS_SERVICE_UNAVAILABLE
);
addStatusMapping
(
Status
.
OUT_OF_SERVICE
,
WebEndpointResponse
.
S
ERVICE_UNAVAILABLE_STATUS
);
WebEndpointResponse
.
S
TATUS_SERVICE_UNAVAILABLE
);
}
/**
...
...
@@ -105,9 +105,9 @@ public class HealthStatusHttpMapper {
return
this
.
statusMapping
.
keySet
().
stream
()
.
filter
((
key
)
->
code
.
equals
(
getUniformValue
(
key
)))
.
map
(
this
.
statusMapping
::
get
).
findFirst
()
.
orElse
(
WebEndpointResponse
.
OK_STATUS
);
.
orElse
(
WebEndpointResponse
.
STATUS_OK
);
}
return
WebEndpointResponse
.
OK_STATUS
;
return
WebEndpointResponse
.
STATUS_OK
;
}
private
String
getUniformValue
(
String
code
)
{
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java
View file @
f43aa944
...
...
@@ -89,13 +89,13 @@ public class HeapDumpWebEndpoint {
}
catch
(
IOException
ex
)
{
return
new
WebEndpointResponse
<>(
WebEndpointResponse
.
INTERNAL_SERVER_ERROR_STATUS
);
WebEndpointResponse
.
STATUS_INTERNAL_SERVER_ERROR
);
}
catch
(
HeapDumperUnavailableException
ex
)
{
return
new
WebEndpointResponse
<>(
WebEndpointResponse
.
S
ERVICE_UNAVAILABLE_STATUS
);
WebEndpointResponse
.
S
TATUS_SERVICE_UNAVAILABLE
);
}
return
new
WebEndpointResponse
<>(
WebEndpointResponse
.
TOO_MANY_REQUESTS_STATU
S
);
return
new
WebEndpointResponse
<>(
WebEndpointResponse
.
STATUS_TOO_MANY_REQUEST
S
);
}
private
Resource
dumpHeap
(
boolean
live
)
throws
IOException
,
InterruptedException
{
...
...
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