diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheResolver.java b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheResolver.java index 55534e888e1..4bf2fd02e6b 100644 --- a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheResolver.java +++ b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -23,7 +23,7 @@ import org.springframework.cache.Cache; /** * Determine the {@link Cache} instance(s) to use for an intercepted method invocation. * - *

Implementations MUST be thread-safe. + *

Implementations must be thread-safe. * * @author Stephane Nicoll * @since 4.1 @@ -32,9 +32,8 @@ public interface CacheResolver { /** * Return the cache(s) to use for the specified invocation. - * * @param context the context of the particular invocation - * @return the cache(s) to use (never null) + * @return the cache(s) to use (never {@code null}) */ Collection resolveCaches(CacheOperationInvocationContext context); diff --git a/spring-web/src/main/java/org/springframework/http/ResponseEntity.java b/spring-web/src/main/java/org/springframework/http/ResponseEntity.java index 1c8a9afb700..c751dcbd17d 100644 --- a/spring-web/src/main/java/org/springframework/http/ResponseEntity.java +++ b/spring-web/src/main/java/org/springframework/http/ResponseEntity.java @@ -322,10 +322,8 @@ public class ResponseEntity extends HttpEntity { /** * Set the caching directives for the resource, as specified by the * {@code Cache-Control} header. - * *

A {@code CacheControl} instance can be built like * {@code CacheControl.maxAge(3600).cachePublic().noTransform()}. - * * @param cacheControl the instance that builds cache related HTTP response headers * @return this builder * @see RFC-7234 Section 5.2 @@ -441,7 +439,7 @@ public class ResponseEntity extends HttpEntity { @Override public BodyBuilder cacheControl(CacheControl cacheControl) { String ccValue = cacheControl.getHeaderValue(); - if(ccValue != null) { + if (ccValue != null) { this.headers.setCacheControl(cacheControl.getHeaderValue()); } return this; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java index 90b7b059fc1..5841dcfe29c 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java @@ -49,6 +49,7 @@ import org.springframework.web.method.support.ModelAndViewContainer; * * @author Arjen Poutsma * @author Rossen Stoyanchev + * @author Brian Clozel * @since 3.1 */ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodProcessor { @@ -59,25 +60,27 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro public HttpEntityMethodProcessor(List> messageConverters, ContentNegotiationManager contentNegotiationManager) { + super(messageConverters, contentNegotiationManager); } public HttpEntityMethodProcessor(List> messageConverters, ContentNegotiationManager contentNegotiationManager, List responseBodyAdvice) { + super(messageConverters, contentNegotiationManager, responseBodyAdvice); } @Override public boolean supportsParameter(MethodParameter parameter) { - return HttpEntity.class.equals(parameter.getParameterType()) || - RequestEntity.class.equals(parameter.getParameterType()); + return (HttpEntity.class.equals(parameter.getParameterType()) || + RequestEntity.class.equals(parameter.getParameterType())); } @Override public boolean supportsReturnType(MethodParameter returnType) { - return HttpEntity.class.isAssignableFrom(returnType.getParameterType()) && - !RequestEntity.class.isAssignableFrom(returnType.getParameterType()); + return (HttpEntity.class.isAssignableFrom(returnType.getParameterType()) && + !RequestEntity.class.isAssignableFrom(returnType.getParameterType())); } @Override @@ -142,9 +145,9 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro Object body = responseEntity.getBody(); if (responseEntity instanceof ResponseEntity) { if (isResourceNotModified(webRequest, (ResponseEntity) responseEntity)) { - // Ensure headers are flushed, no body should be written + // Ensure headers are flushed, no body should be written. outputMessage.flush(); - // skip call to converters, as they may update the body + // Skip call to converters, as they may update the body. return; } } @@ -152,7 +155,7 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro // Try even with null body. ResponseBodyAdvice could get involved. writeWithMessageConverters(body, returnType, inputMessage, outputMessage); - // Ensure headers are flushed even if no body was written + // Ensure headers are flushed even if no body was written. outputMessage.flush(); }