Polishing (backported from master)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@ public interface RequestBodyAdvice {
|
||||
* @param targetType the target type, not necessarily the same as the method
|
||||
* parameter type, e.g. for {@code HttpEntity<String>}.
|
||||
* @param converterType the converter used to deserialize the body
|
||||
* @return the input request or a new instance, never {@code null}
|
||||
* @return the input request or a new instance (never {@code null})
|
||||
*/
|
||||
HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter,
|
||||
Type targetType, Class<? extends HttpMessageConverter<?>> converterType) throws IOException;
|
||||
@@ -83,8 +83,8 @@ public interface RequestBodyAdvice {
|
||||
* @param targetType the target type, not necessarily the same as the method
|
||||
* parameter type, e.g. for {@code HttpEntity<String>}.
|
||||
* @param converterType the selected converter type
|
||||
* @return the value to use or {@code null} which may then raise an
|
||||
* {@code HttpMessageNotReadableException} if the argument is required.
|
||||
* @return the value to use, or {@code null} which may then raise an
|
||||
* {@code HttpMessageNotReadableException} if the argument is required
|
||||
*/
|
||||
@Nullable
|
||||
Object handleEmptyBody(@Nullable Object body, HttpInputMessage inputMessage, MethodParameter parameter,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.mvc.method.annotation;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -25,10 +26,10 @@ import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A convenient starting point for implementing
|
||||
* {@link org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice
|
||||
* ResponseBodyAdvice} with default method implementations.
|
||||
* {@link org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
|
||||
* RequestBodyAdvice} with default method implementations.
|
||||
*
|
||||
* <p>Sub-classes are required to implement {@link #supports} to return true
|
||||
* <p>Subclasses are required to implement {@link #supports} to return true
|
||||
* depending on when the advice applies.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
@@ -41,8 +42,7 @@ public abstract class RequestBodyAdviceAdapter implements RequestBodyAdvice {
|
||||
*/
|
||||
@Override
|
||||
public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter,
|
||||
Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
|
||||
throws IOException {
|
||||
Type targetType, Class<? extends HttpMessageConverter<?>> converterType) throws IOException {
|
||||
|
||||
return inputMessage;
|
||||
}
|
||||
@@ -62,9 +62,8 @@ public abstract class RequestBodyAdviceAdapter implements RequestBodyAdvice {
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object handleEmptyBody(@Nullable Object body, HttpInputMessage inputMessage,
|
||||
MethodParameter parameter, Type targetType,
|
||||
Class<? extends HttpMessageConverter<?>> converterType) {
|
||||
public Object handleEmptyBody(@Nullable Object body, HttpInputMessage inputMessage, MethodParameter parameter,
|
||||
Type targetType, Class<? extends HttpMessageConverter<?>> converterType) {
|
||||
|
||||
return body;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user