From 89ce63f1f36c2e526ea5270fb7a5b969043d7554 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Mon, 13 May 2024 10:42:35 +0200 Subject: [PATCH] Replace RFC7807 by RFC9457 in documentation This commit updates all references to RFC7807 by RFC9457 since the former is now obsolete. Closes gh-32806 --- .../ROOT/pages/web/webflux/ann-rest-exceptions.adoc | 12 ++++++------ .../webflux/controller/ann-methods/return-types.adoc | 4 ++-- .../pages/web/webmvc/mvc-ann-rest-exceptions.adoc | 12 ++++++------ .../webmvc/mvc-controller/ann-exceptionhandler.adoc | 4 ++-- .../mvc-controller/ann-methods/return-types.adoc | 4 ++-- .../java/org/springframework/http/MediaType.java | 6 +++--- .../java/org/springframework/http/ProblemDetail.java | 4 ++-- .../java/org/springframework/web/ErrorResponse.java | 6 +++--- .../springframework/web/ErrorResponseException.java | 2 +- .../support/MissingServletRequestPartException.java | 2 +- .../AbstractMessageWriterResultHandler.java | 2 +- .../annotation/ResponseEntityExceptionHandler.java | 2 +- .../AbstractMessageConverterMethodProcessor.java | 2 +- .../annotation/ResponseEntityExceptionHandler.java | 2 +- 14 files changed, 32 insertions(+), 32 deletions(-) diff --git a/framework-docs/modules/ROOT/pages/web/webflux/ann-rest-exceptions.adoc b/framework-docs/modules/ROOT/pages/web/webflux/ann-rest-exceptions.adoc index f775e28e2ad..39c5ac92357 100644 --- a/framework-docs/modules/ROOT/pages/web/webflux/ann-rest-exceptions.adoc +++ b/framework-docs/modules/ROOT/pages/web/webflux/ann-rest-exceptions.adoc @@ -5,14 +5,14 @@ A common requirement for REST services is to include details in the body of error responses. The Spring Framework supports the "Problem Details for HTTP APIs" -specification, {rfc-site}/rfc7807.html[RFC 7807]. +specification, {rfc-site}/rfc9457.html[RFC 9457]. The following are the main abstractions for this support: -- `ProblemDetail` -- representation for an RFC 7807 problem detail; a simple container +- `ProblemDetail` -- representation for an RFC 9457 problem detail; a simple container for both standard fields defined in the spec, and for non-standard ones. - `ErrorResponse` -- contract to expose HTTP error response details including HTTP -status, response headers, and a body in the format of RFC 7807; this allows exceptions to +status, response headers, and a body in the format of RFC 9457; this allows exceptions to encapsulate and expose the details of how they map to an HTTP response. All Spring WebFlux exceptions implement this. - `ErrorResponseException` -- basic `ErrorResponse` implementation that others @@ -28,7 +28,7 @@ and any `ErrorResponseException`, and renders an error response with a body. [.small]#xref:web/webmvc/mvc-ann-rest-exceptions.adoc#mvc-ann-rest-exceptions-render[See equivalent in the Servlet stack]# You can return `ProblemDetail` or `ErrorResponse` from any `@ExceptionHandler` or from -any `@RequestMapping` method to render an RFC 7807 response. This is processed as follows: +any `@RequestMapping` method to render an RFC 9457 response. This is processed as follows: - The `status` property of `ProblemDetail` determines the HTTP status. - The `instance` property of `ProblemDetail` is set from the current URL path, if not @@ -37,7 +37,7 @@ already set. "application/problem+json" over "application/json" when rendering a `ProblemDetail`, and also falls back on it if no compatible media type is found. -To enable RFC 7807 responses for Spring WebFlux exceptions and for any +To enable RFC 9457 responses for Spring WebFlux exceptions and for any `ErrorResponseException`, extend `ResponseEntityExceptionHandler` and declare it as an xref:web/webflux/controller/ann-advice.adoc[@ControllerAdvice] in Spring configuration. The handler has an `@ExceptionHandler` method that handles any `ErrorResponse` exception, which @@ -50,7 +50,7 @@ use a protected method to map any exception to a `ProblemDetail`. == Non-Standard Fields [.small]#xref:web/webmvc/mvc-ann-rest-exceptions.adoc#mvc-ann-rest-exceptions-non-standard[See equivalent in the Servlet stack]# -You can extend an RFC 7807 response with non-standard fields in one of two ways. +You can extend an RFC 9457 response with non-standard fields in one of two ways. One, insert into the "properties" `Map` of `ProblemDetail`. When using the Jackson library, the Spring Framework registers `ProblemDetailJacksonMixin` that ensures this diff --git a/framework-docs/modules/ROOT/pages/web/webflux/controller/ann-methods/return-types.adoc b/framework-docs/modules/ROOT/pages/web/webflux/controller/ann-methods/return-types.adoc index 750cdf44366..bd7219f86ab 100644 --- a/framework-docs/modules/ROOT/pages/web/webflux/controller/ann-methods/return-types.adoc +++ b/framework-docs/modules/ROOT/pages/web/webflux/controller/ann-methods/return-types.adoc @@ -24,11 +24,11 @@ generally supported for all return values. | For returning a response with headers and no body. | `ErrorResponse` -| To render an RFC 7807 error response with details in the body, +| To render an RFC 9457 error response with details in the body, see xref:web/webflux/ann-rest-exceptions.adoc[Error Responses] | `ProblemDetail` -| To render an RFC 7807 error response with details in the body, +| To render an RFC 9457 error response with details in the body, see xref:web/webflux/ann-rest-exceptions.adoc[Error Responses] | `String` diff --git a/framework-docs/modules/ROOT/pages/web/webmvc/mvc-ann-rest-exceptions.adoc b/framework-docs/modules/ROOT/pages/web/webmvc/mvc-ann-rest-exceptions.adoc index 813932a632c..89d62147be1 100644 --- a/framework-docs/modules/ROOT/pages/web/webmvc/mvc-ann-rest-exceptions.adoc +++ b/framework-docs/modules/ROOT/pages/web/webmvc/mvc-ann-rest-exceptions.adoc @@ -5,14 +5,14 @@ A common requirement for REST services is to include details in the body of error responses. The Spring Framework supports the "Problem Details for HTTP APIs" -specification, {rfc-site}/rfc7807[RFC 7807]. +specification, {rfc-site}/rfc9457[RFC 9457]. The following are the main abstractions for this support: -- `ProblemDetail` -- representation for an RFC 7807 problem detail; a simple container +- `ProblemDetail` -- representation for an RFC 9457 problem detail; a simple container for both standard fields defined in the spec, and for non-standard ones. - `ErrorResponse` -- contract to expose HTTP error response details including HTTP -status, response headers, and a body in the format of RFC 7807; this allows exceptions to +status, response headers, and a body in the format of RFC 9457; this allows exceptions to encapsulate and expose the details of how they map to an HTTP response. All Spring MVC exceptions implement this. - `ErrorResponseException` -- basic `ErrorResponse` implementation that others @@ -28,7 +28,7 @@ and any `ErrorResponseException`, and renders an error response with a body. [.small]#xref:web/webflux/ann-rest-exceptions.adoc#webflux-ann-rest-exceptions-render[See equivalent in the Reactive stack]# You can return `ProblemDetail` or `ErrorResponse` from any `@ExceptionHandler` or from -any `@RequestMapping` method to render an RFC 7807 response. This is processed as follows: +any `@RequestMapping` method to render an RFC 9457 response. This is processed as follows: - The `status` property of `ProblemDetail` determines the HTTP status. - The `instance` property of `ProblemDetail` is set from the current URL path, if not @@ -37,7 +37,7 @@ already set. "application/problem+json" over "application/json" when rendering a `ProblemDetail`, and also falls back on it if no compatible media type is found. -To enable RFC 7807 responses for Spring WebFlux exceptions and for any +To enable RFC 9457 responses for Spring WebFlux exceptions and for any `ErrorResponseException`, extend `ResponseEntityExceptionHandler` and declare it as an xref:web/webmvc/mvc-controller/ann-advice.adoc[@ControllerAdvice] in Spring configuration. The handler has an `@ExceptionHandler` method that handles any `ErrorResponse` exception, which @@ -50,7 +50,7 @@ use a protected method to map any exception to a `ProblemDetail`. == Non-Standard Fields [.small]#xref:web/webflux/ann-rest-exceptions.adoc#webflux-ann-rest-exceptions-non-standard[See equivalent in the Reactive stack]# -You can extend an RFC 7807 response with non-standard fields in one of two ways. +You can extend an RFC 9457 response with non-standard fields in one of two ways. One, insert into the "properties" `Map` of `ProblemDetail`. When using the Jackson library, the Spring Framework registers `ProblemDetailJacksonMixin` that ensures this diff --git a/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-exceptionhandler.adoc b/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-exceptionhandler.adoc index 1e0fa2173b7..f3fe7f2be8d 100644 --- a/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-exceptionhandler.adoc +++ b/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-exceptionhandler.adoc @@ -228,11 +228,11 @@ level, xref:web/webmvc/mvc-servlet/exceptionhandlers.adoc[HandlerExceptionResolv See xref:web/webmvc/mvc-controller/ann-methods/responseentity.adoc[ResponseEntity]. | `ErrorResponse` -| To render an RFC 7807 error response with details in the body, +| To render an RFC 9457 error response with details in the body, see xref:web/webmvc/mvc-ann-rest-exceptions.adoc[Error Responses] | `ProblemDetail` -| To render an RFC 7807 error response with details in the body, +| To render an RFC 9457 error response with details in the body, see xref:web/webmvc/mvc-ann-rest-exceptions.adoc[Error Responses] | `String` diff --git a/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-methods/return-types.adoc b/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-methods/return-types.adoc index 79f4588dbed..00d9f862428 100644 --- a/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-methods/return-types.adoc +++ b/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-methods/return-types.adoc @@ -23,11 +23,11 @@ supported for all return values. | For returning a response with headers and no body. | `ErrorResponse` -| To render an RFC 7807 error response with details in the body, +| To render an RFC 9457 error response with details in the body, see xref:web/webmvc/mvc-ann-rest-exceptions.adoc[Error Responses] | `ProblemDetail` -| To render an RFC 7807 error response with details in the body, +| To render an RFC 9457 error response with details in the body, see xref:web/webmvc/mvc-ann-rest-exceptions.adoc[Error Responses] | `String` diff --git a/spring-web/src/main/java/org/springframework/http/MediaType.java b/spring-web/src/main/java/org/springframework/http/MediaType.java index 4760864b24f..f89063d8df0 100644 --- a/spring-web/src/main/java/org/springframework/http/MediaType.java +++ b/spring-web/src/main/java/org/springframework/http/MediaType.java @@ -184,7 +184,7 @@ public class MediaType extends MimeType implements Serializable { /** * Public constant media type for {@code application/problem+json}. * @since 5.0 - * @see + * @see * Problem Details for HTTP APIs, 6.1. application/problem+json */ public static final MediaType APPLICATION_PROBLEM_JSON; @@ -198,7 +198,7 @@ public class MediaType extends MimeType implements Serializable { /** * Public constant media type for {@code application/problem+json}. * @since 5.0 - * @see + * @see * Problem Details for HTTP APIs, 6.1. application/problem+json * @deprecated as of 5.2 in favor of {@link #APPLICATION_PROBLEM_JSON} * since major browsers like Chrome @@ -224,7 +224,7 @@ public class MediaType extends MimeType implements Serializable { /** * Public constant media type for {@code application/problem+xml}. * @since 5.0 - * @see + * @see * Problem Details for HTTP APIs, 6.2. application/problem+xml */ public static final MediaType APPLICATION_PROBLEM_XML; diff --git a/spring-web/src/main/java/org/springframework/http/ProblemDetail.java b/spring-web/src/main/java/org/springframework/http/ProblemDetail.java index 2ab996f9ade..4b38fd55ca9 100644 --- a/spring-web/src/main/java/org/springframework/http/ProblemDetail.java +++ b/spring-web/src/main/java/org/springframework/http/ProblemDetail.java @@ -26,7 +26,7 @@ import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; /** - * Representation for an RFC 7807 problem detail. Includes spec-defined + * Representation for an RFC 9457 problem detail. Includes spec-defined * properties, and a {@link #getProperties() properties} map for additional, * non-standard properties. * @@ -45,7 +45,7 @@ import org.springframework.util.ObjectUtils; * @author Rossen Stoyanchev * @author Juergen Hoeller * @since 6.0 - * @see RFC 7807 + * @see RFC 9457 * @see org.springframework.web.ErrorResponse * @see org.springframework.web.ErrorResponseException */ diff --git a/spring-web/src/main/java/org/springframework/web/ErrorResponse.java b/spring-web/src/main/java/org/springframework/web/ErrorResponse.java index c83bcdb1c4b..f5e859729d3 100644 --- a/spring-web/src/main/java/org/springframework/web/ErrorResponse.java +++ b/spring-web/src/main/java/org/springframework/web/ErrorResponse.java @@ -27,8 +27,8 @@ import org.springframework.http.ProblemDetail; import org.springframework.lang.Nullable; /** - * Representation of a complete RFC 7807 error response including status, - * headers, and an RFC 7807 formatted {@link ProblemDetail} body. Allows any + * Representation of a complete RFC 9457 error response including status, + * headers, and an RFC 9457 formatted {@link ProblemDetail} body. Allows any * exception to expose HTTP error response information. * *

{@link ErrorResponseException} is a default implementation of this @@ -58,7 +58,7 @@ public interface ErrorResponse { } /** - * Return the body for the response, formatted as an RFC 7807 + * Return the body for the response, formatted as an RFC 9457 * {@link ProblemDetail} whose {@link ProblemDetail#getStatus() status} * should match the response status. */ diff --git a/spring-web/src/main/java/org/springframework/web/ErrorResponseException.java b/spring-web/src/main/java/org/springframework/web/ErrorResponseException.java index 714abbb8b55..53f3fccb49a 100644 --- a/spring-web/src/main/java/org/springframework/web/ErrorResponseException.java +++ b/spring-web/src/main/java/org/springframework/web/ErrorResponseException.java @@ -26,7 +26,7 @@ import org.springframework.lang.Nullable; /** * {@link RuntimeException} that implements {@link ErrorResponse} to expose - * an HTTP status, response headers, and a body formatted as an RFC 7807 + * an HTTP status, response headers, and a body formatted as an RFC 9457 * {@link ProblemDetail}. * *

The exception can be used as is, or it can be extended as a more specific diff --git a/spring-web/src/main/java/org/springframework/web/multipart/support/MissingServletRequestPartException.java b/spring-web/src/main/java/org/springframework/web/multipart/support/MissingServletRequestPartException.java index 1dd4f5806fc..acb7cfb9444 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/support/MissingServletRequestPartException.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/support/MissingServletRequestPartException.java @@ -75,7 +75,7 @@ public class MissingServletRequestPartException extends ServletException impleme } /** - * Return the body for the response, formatted as an RFC 7807 + * Return the body for the response, formatted as an RFC 9457 * {@link ProblemDetail} whose {@link ProblemDetail#getStatus() status} * should match the response status. */ diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageWriterResultHandler.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageWriterResultHandler.java index 25556ee76c1..d8c428d2066 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageWriterResultHandler.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageWriterResultHandler.java @@ -175,7 +175,7 @@ public abstract class AbstractMessageWriterResultHandler extends HandlerResultHa throw ex; } - // For ProblemDetail, fall back on RFC 7807 format + // For ProblemDetail, fall back on RFC 9457 format if (bestMediaType == null && ProblemDetail.class.isAssignableFrom(elementType.toClass())) { bestMediaType = selectMediaType(exchange, () -> getMediaTypesFor(elementType), this.problemMediaTypes); } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandler.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandler.java index 4bcdd58fe46..f4c1063964a 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandler.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandler.java @@ -50,7 +50,7 @@ import org.springframework.web.server.UnsupportedMediaTypeStatusException; /** * A class with an {@code @ExceptionHandler} method that handles all Spring * WebFlux raised exceptions by returning a {@link ResponseEntity} with - * RFC 7807 formatted error details in the body. + * RFC 9457 formatted error details in the body. * *

Convenient as a base class of an {@link ControllerAdvice @ControllerAdvice} * for global exception handling in an application. Subclasses can override diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodProcessor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodProcessor.java index 3bf4dafbb20..e801951bb55 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodProcessor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodProcessor.java @@ -243,7 +243,7 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe List compatibleMediaTypes = new ArrayList<>(); determineCompatibleMediaTypes(acceptableTypes, producibleTypes, compatibleMediaTypes); - // For ProblemDetail, fall back on RFC 7807 format + // For ProblemDetail, fall back on RFC 9457 format if (compatibleMediaTypes.isEmpty() && ProblemDetail.class.isAssignableFrom(valueType)) { determineCompatibleMediaTypes(this.problemMediaTypes, producibleTypes, compatibleMediaTypes); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java index 365c23e58c2..06aedac0a11 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java @@ -58,7 +58,7 @@ import org.springframework.web.util.WebUtils; /** * A class with an {@code @ExceptionHandler} method that handles all Spring MVC - * raised exceptions by returning a {@link ResponseEntity} with RFC 7807 + * raised exceptions by returning a {@link ResponseEntity} with RFC 9457 * formatted error details in the body. * *

Convenient as a base class of an {@link ControllerAdvice @ControllerAdvice}