-
Notifications
You must be signed in to change notification settings - Fork 12
Home
Łukasz Witkowski edited this page Jan 22, 2023
·
18 revisions
Here's a list of Exceptions for which this extension provides mappers, along with comparison between quarkus-resteasy-problem
and raw quarkus-resteasy-jackson
.
Thrown by Hibernate Validator (@Valid
)
Given:
@GET
@Path("/hello/{which_continent}")
@Produces(MediaType.APPLICATION_JSON)
public String hello(
@PathParam("which_continent") @Valid @Length(min = 5) @NotNull String whichContinent,
@QueryParam("message") @Valid @Length(min = 15) @NotNull String messageParameter
) {
return "Hello RESTEasy from " + whichContinent + " with message: " + messageParameter;
}
When
curl `http://localhost:8080/hello/asia?message=konnichiwa`
Then:
quarkus-resteasy-problem (all resteasy versions) | quarkus-resteasy-jackson/jsonb | quarkus-resteasy-reactive-jackson/jsonb |
---|---|---|
HTTP/1.1 400 Bad Request |
HTTP/1.1 400 Bad Request |
HTTP/1.1 400 Bad Request |
Thrown by RESTeasy.
quarkus-resteasy-problem | quarkus-resteasy-jackson |
---|---|
HTTP/1.1 404 Not Found |
HTTP/1.1 404 Not Found |
Thrown by Quarkus.
quarkus-resteasy-problem | quarkus-resteasy-jackson |
---|---|
HTTP/1.1 301 Moved Permanently |
HTTP/1.1 301 Moved Permanently |
Thrown by Quarkus/JaxRS.
quarkus-resteasy-problem | quarkus-resteasy-jackson |
---|---|
HTTP/1.1 409 Conflict |
HTTP/1.1 409 Conflict |
io.quarkus.security.AuthenticationFailedException
/ io.quarkus.security.AuthenticationCompletionExceptionMapper
/ io.quarkus.security.UnauthorizedException
Thrown by Quarkus if JWT token is missing or invalid.
quarkus-resteasy-problem | quarkus-resteasy-jackson |
---|---|
HTTP/1.1 401 Unauthorized |
HTTP/1.1 401 Unauthorized |
Thrown by Quarkus when @RolesAllowed
not satisfied.
quarkus-resteasy-problem | quarkus-resteasy-jackson |
---|---|
HTTP/1.1 403 Forbidden |
HTTP/1.1 403 Forbidden |
Example:
throw HttpProblem.builder()
.withType(URI.create("/business-problem"))
.withStatus(Status.CONFLICT)
.withTitle("Business Conflict")
.withDetail("Some business conflict has happened")
.withInstance(URI.create("/problem/special-case"))
.withHeader("X-Custom-Header", "rfc7807-by-example")
.with("custom_property", 123)
.build();
quarkus-resteasy-problem | quarkus-resteasy-jackson |
---|---|
HTTP/1.1 409 Conflict |
not supported, http 500 |
Example:
throw Problem.builder()
.withType(URI.create("/business-problem"))
.withStatus(Status.CONFLICT)
.withTitle("Business Conflict")
.withDetail("Some business conflict has happened")
.withInstance(URI.create("/problem/special-case"))
.with("custom_property", 123)
.build();
quarkus-resteasy-problem | quarkus-resteasy-jackson |
---|---|
HTTP/1.1 409 Conflict |
not supported, http 500 |
Finally top-level exception mapper for all other exceptions throw by user or Quarkus.
quarkus-resteasy-problem | quarkus-resteasy-jackson |
---|---|
HTTP/1.1 500 Internal Server Error |
HTTP/1.1 500 Internal Server Error |