@API(status=STABLE) @Immutable public interface Problem
| Modifier and Type | Field and Description |
|---|---|
static URI |
DEFAULT_TYPE |
| Modifier and Type | Method and Description |
|---|---|
static ProblemBuilder |
builder() |
default String |
getDetail()
A human readable explanation specific to this occurrence of the problem.
|
default URI |
getInstance()
An absolute URI that identifies the specific occurrence of the problem.
|
default Map<String,Object> |
getParameters()
Optional, additional attributes of the problem.
|
default StatusType |
getStatus()
The HTTP status code generated by the origin server for this
occurrence of the problem.
|
default String |
getTitle()
A short, human-readable summary of the problem type.
|
default URI |
getType()
An absolute URI that identifies the problem type.
|
static String |
toString(Problem problem)
Specification by example:
|
static ThrowableProblem |
valueOf(StatusType status) |
static ThrowableProblem |
valueOf(StatusType status,
String detail) |
static ThrowableProblem |
valueOf(StatusType status,
String detail,
URI instance) |
static ThrowableProblem |
valueOf(StatusType status,
URI instance) |
static final URI DEFAULT_TYPE
default URI getType()
@Nullable default String getTitle()
@Nullable default StatusType getStatus()
@Nullable default String getDetail()
@Nullable default URI getInstance()
default Map<String,Object> getParameters()
static ProblemBuilder builder()
static ThrowableProblem valueOf(StatusType status)
static ThrowableProblem valueOf(StatusType status, String detail)
static ThrowableProblem valueOf(StatusType status, URI instance)
static ThrowableProblem valueOf(StatusType status, String detail, URI instance)
static String toString(Problem problem)
// Returns "about:blank{404, Not Found}"
Problem.valueOf(NOT_FOUND).toString();
// Returns "about:blank{404, Not Found, Order 123}"
Problem.valueOf(NOT_FOUND, "Order 123").toString();
// Returns "about:blank{404, Not Found, instance=https://example.org/}"
Problem.valueOf(NOT_FOUND, URI.create("https://example.org/")).toString();
// Returns "about:blank{404, Not Found, Order 123, instance=https://example.org/"}
Problem.valueOf(NOT_FOUND, "Order 123", URI.create("https://example.org/")).toString();
// Returns "https://example.org/problem{422, Oh, oh!, Crap., instance=https://example.org/problem/123}
Problem.builder()
.withType(URI.create("https://example.org/problem"))
.withTitle("Oh, oh!")
.withStatus(UNPROCESSABLE_ENTITY)
.withDetail("Crap.")
.withInstance(URI.create("https://example.org/problem/123"))
.build()
.toString();
problem - the problemvalueOf(StatusType),
valueOf(StatusType, String),
valueOf(StatusType, URI),
valueOf(StatusType, String, URI)Copyright © 2015–2018 Zalando SE. All rights reserved.