From 1d46b8d7e1dc94b14d2cd913906f5f99054d112d Mon Sep 17 00:00:00 2001 From: Sebastien Deleuze Date: Tue, 20 Sep 2016 14:28:12 +0200 Subject: [PATCH] Polish --- .../http/codec/AbstractServerHttpMessageReader.java | 10 +++++----- .../http/codec/AbstractServerHttpMessageWriter.java | 13 ++++++------- .../http/codec/Jackson2ServerHttpMessageWriter.java | 2 -- .../http/codec/ServerHttpMessageWriter.java | 4 ++-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/codec/AbstractServerHttpMessageReader.java b/spring-web/src/main/java/org/springframework/http/codec/AbstractServerHttpMessageReader.java index 38883331dc5..b65625a9e5f 100644 --- a/spring-web/src/main/java/org/springframework/http/codec/AbstractServerHttpMessageReader.java +++ b/spring-web/src/main/java/org/springframework/http/codec/AbstractServerHttpMessageReader.java @@ -32,7 +32,8 @@ import org.springframework.http.server.reactive.ServerHttpResponse; /** * {@link HttpMessageReader} wrapper that implements {@link ServerHttpMessageReader} in order - * to allow providing hints. + * to allow providing hints to the nested {@code reader} or setting the response status for + * example, by implementing {@link #beforeRead(ResolvableType, ResolvableType, ServerHttpRequest, ServerHttpResponse)}. * * @author Sebastien Deleuze * @since 5.0 @@ -92,14 +93,13 @@ public abstract class AbstractServerHttpMessageReader implements ServerHttpMe /** * Invoked before reading the request by - * {@link #read(ResolvableType, ResolvableType, ServerHttpRequest, ServerHttpResponse, Map)} + * {@link #read(ResolvableType, ResolvableType, ServerHttpRequest, ServerHttpResponse, Map)}. * * @param streamType the original type used for the method return value. For annotation * based controllers, the {@link MethodParameter} is available via {@link ResolvableType#getSource()}. - * Can be {@code null}. * @param elementType the stream element type to process - * @param request the current HTTP request, can be {@code null} - * @param response the current HTTP response, can be {@code null} + * @param request the current HTTP request + * @param response the current HTTP response * @return Additional information about how to write the body */ protected abstract Map beforeRead(ResolvableType streamType, diff --git a/spring-web/src/main/java/org/springframework/http/codec/AbstractServerHttpMessageWriter.java b/spring-web/src/main/java/org/springframework/http/codec/AbstractServerHttpMessageWriter.java index c76ca3a6bec..50cfbfb26a8 100644 --- a/spring-web/src/main/java/org/springframework/http/codec/AbstractServerHttpMessageWriter.java +++ b/spring-web/src/main/java/org/springframework/http/codec/AbstractServerHttpMessageWriter.java @@ -32,9 +32,8 @@ import org.springframework.http.server.reactive.ServerHttpResponse; /** * {@link HttpMessageWriter} wrapper that implements {@link ServerHttpMessageWriter} in order - * to allow providing hints to the nested {@code writer} or setting the response status, for - * example, by implementing {@link #beforeWrite(ResolvableType, ResolvableType, MediaType, ServerHttpRequest, ServerHttpResponse)} - * + * to allow providing hints to the nested {@code writer} or setting the response status for + * example, by implementing {@link #beforeWrite(ResolvableType, ResolvableType, MediaType, ServerHttpRequest, ServerHttpResponse)}. * * @author Sebastien Deleuze * @since 5.0 @@ -71,7 +70,8 @@ public abstract class AbstractServerHttpMessageWriter implements ServerHttpMe Map mergedHints = new HashMap<>(hints); mergedHints.putAll(beforeWrite(streamType, elementType, mediaType, request, response)); return (this.writer instanceof ServerHttpMessageWriter ? - ((ServerHttpMessageWriter)this.writer).write(inputStream, streamType, elementType, mediaType, request, response, mergedHints) : + ((ServerHttpMessageWriter)this.writer).write(inputStream, streamType, + elementType, mediaType, request, response, mergedHints) : this.writer.write(inputStream, elementType, mediaType, response, mergedHints)); } @@ -81,12 +81,11 @@ public abstract class AbstractServerHttpMessageWriter implements ServerHttpMe * * @param streamType the original type used for the method return value. For annotation * based controllers, the {@link MethodParameter} is available via {@link ResolvableType#getSource()}. - * Can be {@code null}. * @param elementType the stream element type to process * @param mediaType the content type to use when writing. May be {@code null} to * indicate that the default content type of the converter must be used. - * @param request the current HTTP request, can be {@code null} - * @param response the current HTTP response, can be {@code null} + * @param request the current HTTP request + * @param response the current HTTP response * @return Additional information about how to write the body */ protected abstract Map beforeWrite(ResolvableType streamType, ResolvableType elementType, diff --git a/spring-web/src/main/java/org/springframework/http/codec/Jackson2ServerHttpMessageWriter.java b/spring-web/src/main/java/org/springframework/http/codec/Jackson2ServerHttpMessageWriter.java index be9c7e92265..2d8833d0e1a 100644 --- a/spring-web/src/main/java/org/springframework/http/codec/Jackson2ServerHttpMessageWriter.java +++ b/spring-web/src/main/java/org/springframework/http/codec/Jackson2ServerHttpMessageWriter.java @@ -21,8 +21,6 @@ import java.util.HashMap; import java.util.Map; import com.fasterxml.jackson.annotation.JsonView; -import org.reactivestreams.Publisher; -import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter; import org.springframework.core.ResolvableType; diff --git a/spring-web/src/main/java/org/springframework/http/codec/ServerHttpMessageWriter.java b/spring-web/src/main/java/org/springframework/http/codec/ServerHttpMessageWriter.java index 1c6371bb31b..518e63b58ff 100644 --- a/spring-web/src/main/java/org/springframework/http/codec/ServerHttpMessageWriter.java +++ b/spring-web/src/main/java/org/springframework/http/codec/ServerHttpMessageWriter.java @@ -46,8 +46,8 @@ public interface ServerHttpMessageWriter extends HttpMessageWriter { * @param elementType the stream element type to process * @param mediaType the content type to use when writing. May be {@code null} to * indicate that the default content type of the converter must be used. - * @param request the current HTTP request, can be {@code null} - * @param response the current HTTP response, can be {@code null} + * @param request the current HTTP request + * @param response the current HTTP response * @return a {@link Mono} that indicates completion or error */ Mono write(Publisher inputStream, ResolvableType streamType,