Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Apr 12, 2021
1 parent 4b6b12b commit 29955a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -57,7 +57,7 @@ boolean supports(MethodParameter methodParameter, Type targetType,
* @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;
Expand All @@ -83,8 +83,8 @@ Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodParameter
* @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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,7 +29,7 @@
* {@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
Expand All @@ -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;
}
Expand All @@ -62,9 +62,8 @@ public Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodPa
*/
@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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -49,6 +50,7 @@

/**
* Integration tests for static resource handling.
*
* @author Rossen Stoyanchev
*/
public class ResourceHttpRequestHandlerIntegrationTests {
Expand Down Expand Up @@ -135,7 +137,7 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {

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) {
Expand Down

0 comments on commit 29955a2

Please sign in to comment.