提交 29955a28 编写于 作者: J Juergen Hoeller

Polishing

上级 4b6b12bf
/*
* 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,
......
......@@ -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;
......@@ -28,7 +29,7 @@ import org.springframework.lang.Nullable;
* {@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;
}
......
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.servlet.resource;
import java.io.IOException;
......@@ -49,6 +50,7 @@ import static org.junit.jupiter.params.provider.Arguments.arguments;
/**
* Integration tests for static resource handling.
*
* @author Rossen Stoyanchev
*/
public class ResourceHttpRequestHandlerIntegrationTests {
......@@ -135,7 +137,7 @@ public class ResourceHttpRequestHandlerIntegrationTests {
registerClasspathLocation("/cp/**", classPathLocation, registry);
registerFileSystemLocation("/fs/**", path, registry);
registerUrlLocation("/url/**", "file://" + path, registry);
registerUrlLocation("/url/**", "file://" + path.replace('\\', '/'), registry);
}
protected void registerClasspathLocation(String pattern, ClassPathResource resource, ResourceHandlerRegistry registry) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册