T
- the type of the response bodypublic final class WebEndpointResponse<T> extends Object
WebEndpointResponse
can be returned by an operation on a
WebEndpointExtension
to provide additional, web-specific information such as
the HTTP status code.Modifier and Type | Field and Description |
---|---|
static int |
STATUS_BAD_REQUEST
400 Bad Request . |
static int |
STATUS_INTERNAL_SERVER_ERROR
500 Internal Server Error . |
static int |
STATUS_NOT_FOUND
404 Not Found . |
static int |
STATUS_OK
200 OK . |
static int |
STATUS_SERVICE_UNAVAILABLE
503 Service Unavailable . |
static int |
STATUS_TOO_MANY_REQUESTS
429 Too Many Requests . |
Constructor and Description |
---|
WebEndpointResponse()
Creates a new
WebEndpointResponse with no body and a 200 (OK) status. |
WebEndpointResponse(int status)
Creates a new
WebEndpointResponse with no body and the given
status . |
WebEndpointResponse(T body)
Creates a new
WebEndpointResponse with then given body and a 200 (OK)
status. |
WebEndpointResponse(T body,
int status)
Creates a new
WebEndpointResponse with then given body and status. |
Modifier and Type | Method and Description |
---|---|
T |
getBody()
Returns the body for the response.
|
int |
getStatus()
Returns the status for the response.
|
public static final int STATUS_OK
200 OK
.public static final int STATUS_BAD_REQUEST
400 Bad Request
.public static final int STATUS_NOT_FOUND
404 Not Found
.public static final int STATUS_TOO_MANY_REQUESTS
429 Too Many Requests
.public static final int STATUS_INTERNAL_SERVER_ERROR
500 Internal Server Error
.public static final int STATUS_SERVICE_UNAVAILABLE
503 Service Unavailable
.public WebEndpointResponse()
WebEndpointResponse
with no body and a 200 (OK) status.public WebEndpointResponse(int status)
WebEndpointResponse
with no body and the given
status
.status
- the HTTP statuspublic WebEndpointResponse(T body)
WebEndpointResponse
with then given body and a 200 (OK)
status.body
- the bodypublic WebEndpointResponse(T body, int status)
WebEndpointResponse
with then given body and status.body
- the bodystatus
- the HTTP statuspublic T getBody()
public int getStatus()
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.