From 042519043f774385b30591bf2e6476b7cbee9dfc Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Wed, 17 Jun 2015 17:23:31 -0400 Subject: [PATCH] Update Javadoc on @ResponseStatus Issue: SPR-11193 --- .../web/bind/annotation/ResponseStatus.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseStatus.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseStatus.java index 17869f83041..80f75893bf1 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseStatus.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseStatus.java @@ -60,11 +60,12 @@ public @interface ResponseStatus { /** * The reason to be used for the response. - *

If this attribute is not set, it will default to the standard status - * message for the status code. Note that due to the use of + *

Note: due to the use of * {@code HttpServletResponse.sendError(int, String)}, the response will be - * considered complete and should not be written to any further. - * + * considered complete and should not be written to any further. Furthermore + * servlet container will typically write an HTML error page therefore making + * the use of a reason unsuitable for REST APIs. For such cases prefer + * sending error details in the body of the response. * @see javax.servlet.http.HttpServletResponse#sendError(int, String) */ String reason() default "";