Fix overridden methods nullability
Issue: SPR-15869
This commit is contained in:
@@ -1391,6 +1391,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
||||
* @return the first header value, or {@code null} if none
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public String getFirst(String headerName) {
|
||||
List<String> headerValues = this.headers.get(headerName);
|
||||
return (headerValues != null ? headerValues.get(0) : null);
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.net.URI;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
/**
|
||||
@@ -40,6 +41,7 @@ final class BufferingClientHttpRequestWrapper extends AbstractBufferingClientHtt
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public HttpMethod getMethod() {
|
||||
return this.request.getMethod();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.net.URI;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpRequest;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -58,6 +59,7 @@ public class HttpRequestWrapper implements HttpRequest {
|
||||
* Return the method of the wrapped request.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public HttpMethod getMethod() {
|
||||
return this.request.getMethod();
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ public class ProxyFactoryBean implements FactoryBean<Proxy>, InitializingBean {
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Proxy getObject() {
|
||||
return this.proxy;
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ public class ResourceHttpMessageConverter extends AbstractHttpMessageConverter<R
|
||||
byte[] body = StreamUtils.copyToByteArray(inputMessage.getBody());
|
||||
return new ByteArrayResource(body) {
|
||||
@Override
|
||||
@Nullable
|
||||
public String getFilename() {
|
||||
return inputMessage.getHeaders().getContentDisposition().getFilename();
|
||||
}
|
||||
|
||||
@@ -343,6 +343,7 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected MediaType getDefaultContentType(Object object) throws IOException {
|
||||
if (object instanceof MappingJacksonValue) {
|
||||
object = ((MappingJacksonValue) object).getValue();
|
||||
|
||||
@@ -132,6 +132,7 @@ public class GsonFactoryBean implements FactoryBean<Gson>, InitializingBean {
|
||||
* Return the created Gson instance.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Gson getObject() {
|
||||
return this.gson;
|
||||
}
|
||||
|
||||
@@ -466,6 +466,7 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
|
||||
* Return the singleton ObjectMapper.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public ObjectMapper getObject() {
|
||||
return this.objectMapper;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@@ -138,6 +139,7 @@ public class ServletServerHttpResponse implements ServerHttpResponse {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getFirst(String headerName) {
|
||||
String value = servletResponse.getHeader(headerName);
|
||||
if (value != null) {
|
||||
|
||||
@@ -162,6 +162,7 @@ class DefaultServerHttpRequestBuilder implements ServerHttpRequest.Builder {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public HttpMethod getMethod() {
|
||||
return (this.httpMethod != null ? this.httpMethod : super.getMethod());
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.http.HttpCookie;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.server.RequestPath;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
@@ -55,6 +56,7 @@ public class ServerHttpRequestDecorator implements ServerHttpRequest {
|
||||
// ServerHttpRequest delegation methods...
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public HttpMethod getMethod() {
|
||||
return getDelegate().getMethod();
|
||||
}
|
||||
|
||||
@@ -246,6 +246,7 @@ public class ServletServerHttpRequest extends AbstractServerHttpRequest {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected DataBuffer read() throws IOException {
|
||||
if (this.inputStream.isReady()) {
|
||||
return readFromInputStream();
|
||||
|
||||
@@ -143,6 +143,7 @@ public class UndertowServerHttpRequest extends AbstractServerHttpRequest {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected DataBuffer read() throws IOException {
|
||||
if (this.pooledByteBuffer == null) {
|
||||
this.pooledByteBuffer = this.byteBufferPool.allocate();
|
||||
|
||||
@@ -239,6 +239,7 @@ public class HessianClientInterceptor extends UrlBasedRemoteAccessor implements
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
if (this.hessianProxy == null) {
|
||||
throw new IllegalStateException("HessianClientInterceptor is not properly initialized - " +
|
||||
|
||||
@@ -55,6 +55,7 @@ public class HessianProxyFactoryBean extends HessianClientInterceptor implements
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getObject() {
|
||||
return this.serviceProxy;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ public class HttpInvokerProxyFactoryBean extends HttpInvokerClientInterceptor im
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getObject() {
|
||||
return this.serviceProxy;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class JaxWsPortProxyFactoryBean extends JaxWsPortClientInterceptor implem
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getObject() {
|
||||
return this.serviceProxy;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ public class LocalJaxWsServiceFactoryBean extends LocalJaxWsServiceFactory
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Service getObject() {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
@@ -344,6 +344,7 @@ public class ContentNegotiationManagerFactoryBean
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ContentNegotiationManager getObject() {
|
||||
return this.contentNegotiationManager;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.web.accept;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
|
||||
@@ -62,6 +63,7 @@ public class ParameterContentNegotiationStrategy extends AbstractMappingContentN
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected String getMediaTypeKey(NativeWebRequest request) {
|
||||
return request.getParameter(getParameterName());
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ public class PathExtensionContentNegotiationStrategy extends AbstractMappingCont
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected String getMediaTypeKey(NativeWebRequest webRequest) {
|
||||
HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
|
||||
if (request == null) {
|
||||
|
||||
@@ -67,6 +67,7 @@ public class ServletPathExtensionContentNegotiationStrategy extends PathExtensio
|
||||
* {@link org.springframework.http.MediaTypeFactory} lookup.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
protected MediaType handleNoMatch(NativeWebRequest webRequest, String extension)
|
||||
throws HttpMediaTypeNotAcceptableException {
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@ public class EscapedErrors implements Errors {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ObjectError getGlobalError() {
|
||||
return escapeObjectError(this.source.getGlobalError());
|
||||
}
|
||||
@@ -171,6 +172,7 @@ public class EscapedErrors implements Errors {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FieldError getFieldError() {
|
||||
return this.source.getFieldError();
|
||||
}
|
||||
@@ -191,17 +193,20 @@ public class EscapedErrors implements Errors {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FieldError getFieldError(String field) {
|
||||
return escapeObjectError(this.source.getFieldError(field));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getFieldValue(String field) {
|
||||
Object value = this.source.getFieldValue(field);
|
||||
return (value instanceof String ? HtmlUtils.htmlEscape((String) value) : value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getFieldType(String field) {
|
||||
return this.source.getFieldType(field);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public class DefaultSessionAttributeStore implements SessionAttributeStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object retrieveAttribute(WebRequest request, String attributeName) {
|
||||
Assert.notNull(request, "WebRequest must not be null");
|
||||
Assert.notNull(attributeName, "Attribute name must not be null");
|
||||
|
||||
@@ -157,6 +157,7 @@ public class WebExchangeBindException extends ServerWebInputException implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ObjectError getGlobalError() {
|
||||
return this.bindingResult.getGlobalError();
|
||||
}
|
||||
@@ -177,6 +178,7 @@ public class WebExchangeBindException extends ServerWebInputException implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FieldError getFieldError() {
|
||||
return this.bindingResult.getFieldError();
|
||||
}
|
||||
@@ -197,16 +199,19 @@ public class WebExchangeBindException extends ServerWebInputException implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FieldError getFieldError(String field) {
|
||||
return this.bindingResult.getFieldError(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getFieldValue(String field) {
|
||||
return this.bindingResult.getFieldValue(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getFieldType(String field) {
|
||||
return this.bindingResult.getFieldType(field);
|
||||
}
|
||||
@@ -222,17 +227,20 @@ public class WebExchangeBindException extends ServerWebInputException implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getRawFieldValue(String field) {
|
||||
return this.bindingResult.getRawFieldValue(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Nullable
|
||||
public PropertyEditor findEditor(@Nullable String field, @Nullable Class valueType) {
|
||||
return this.bindingResult.findEditor(field, valueType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PropertyEditorRegistry getPropertyEditorRegistry() {
|
||||
return this.bindingResult.getPropertyEditorRegistry();
|
||||
}
|
||||
|
||||
@@ -297,6 +297,7 @@ public class AsyncRestTemplate extends org.springframework.http.client.support.I
|
||||
private static ListenableFuture<URI> adaptToLocationHeader(ListenableFuture<HttpHeaders> future) {
|
||||
return new ListenableFutureAdapter<URI, HttpHeaders>(future) {
|
||||
@Override
|
||||
@Nullable
|
||||
protected URI adapt(HttpHeaders headers) throws ExecutionException {
|
||||
return headers.getLocation();
|
||||
}
|
||||
@@ -607,6 +608,7 @@ public class AsyncRestTemplate extends org.springframework.http.client.support.I
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected final T adapt(ClientHttpResponse response) throws ExecutionException {
|
||||
try {
|
||||
if (!getErrorHandler().hasError(response)) {
|
||||
@@ -660,6 +662,7 @@ public class AsyncRestTemplate extends org.springframework.http.client.support.I
|
||||
return request.getBody();
|
||||
}
|
||||
@Override
|
||||
@Nullable
|
||||
public HttpMethod getMethod() {
|
||||
return request.getMethod();
|
||||
}
|
||||
|
||||
@@ -311,6 +311,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
// GET
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T getForObject(String url, Class<T> responseType, Object... uriVariables) throws RestClientException {
|
||||
RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
||||
HttpMessageConverterExtractor<T> responseExtractor =
|
||||
@@ -319,6 +320,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T getForObject(String url, Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
|
||||
RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
||||
HttpMessageConverterExtractor<T> responseExtractor =
|
||||
@@ -327,6 +329,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T getForObject(URI url, Class<T> responseType) throws RestClientException {
|
||||
RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
||||
HttpMessageConverterExtractor<T> responseExtractor =
|
||||
@@ -381,6 +384,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
// POST
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public URI postForLocation(String url, @Nullable Object request, Object... uriVariables) throws RestClientException {
|
||||
RequestCallback requestCallback = httpEntityCallback(request);
|
||||
HttpHeaders headers = execute(url, HttpMethod.POST, requestCallback, headersExtractor(), uriVariables);
|
||||
@@ -388,6 +392,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public URI postForLocation(String url, @Nullable Object request, Map<String, ?> uriVariables) throws RestClientException {
|
||||
RequestCallback requestCallback = httpEntityCallback(request);
|
||||
HttpHeaders headers = execute(url, HttpMethod.POST, requestCallback, headersExtractor(), uriVariables);
|
||||
@@ -395,6 +400,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public URI postForLocation(URI url, @Nullable Object request) throws RestClientException {
|
||||
RequestCallback requestCallback = httpEntityCallback(request);
|
||||
HttpHeaders headers = execute(url, HttpMethod.POST, requestCallback, headersExtractor());
|
||||
@@ -402,6 +408,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T postForObject(String url, @Nullable Object request, Class<T> responseType, Object... uriVariables)
|
||||
throws RestClientException {
|
||||
|
||||
@@ -412,6 +419,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T postForObject(String url, @Nullable Object request, Class<T> responseType, Map<String, ?> uriVariables)
|
||||
throws RestClientException {
|
||||
|
||||
@@ -422,6 +430,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T postForObject(URI url, @Nullable Object request, Class<T> responseType) throws RestClientException {
|
||||
RequestCallback requestCallback = httpEntityCallback(request, responseType);
|
||||
HttpMessageConverterExtractor<T> responseExtractor =
|
||||
@@ -479,6 +488,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
// PATCH
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T patchForObject(String url, @Nullable Object request, Class<T> responseType,
|
||||
Object... uriVariables) throws RestClientException {
|
||||
|
||||
@@ -489,6 +499,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T patchForObject(String url, @Nullable Object request, Class<T> responseType,
|
||||
Map<String, ?> uriVariables) throws RestClientException {
|
||||
|
||||
@@ -499,6 +510,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T patchForObject(URI url, @Nullable Object request, Class<T> responseType)
|
||||
throws RestClientException {
|
||||
|
||||
@@ -637,6 +649,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
// general execution
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T execute(String url, HttpMethod method, @Nullable RequestCallback requestCallback,
|
||||
@Nullable ResponseExtractor<T> responseExtractor, Object... uriVariables) throws RestClientException {
|
||||
|
||||
@@ -645,6 +658,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T execute(String url, HttpMethod method, @Nullable RequestCallback requestCallback,
|
||||
@Nullable ResponseExtractor<T> responseExtractor, Map<String, ?> uriVariables) throws RestClientException {
|
||||
|
||||
@@ -653,6 +667,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T execute(URI url, @Nullable HttpMethod method, @Nullable RequestCallback requestCallback,
|
||||
@Nullable ResponseExtractor<T> responseExtractor) throws RestClientException {
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.web.context.request;
|
||||
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
import org.springframework.beans.factory.config.Scope;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -58,6 +59,7 @@ public abstract class AbstractRequestAttributesScope implements Scope {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object remove(String name) {
|
||||
RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
|
||||
Object scopedObject = attributes.getAttribute(name, getScope());
|
||||
@@ -77,6 +79,7 @@ public abstract class AbstractRequestAttributesScope implements Scope {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object resolveContextualObject(String key) {
|
||||
RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
|
||||
return attributes.resolveReference(key);
|
||||
|
||||
@@ -82,11 +82,13 @@ public class FacesWebRequest extends FacesRequestAttributes implements NativeWeb
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getHeader(String headerName) {
|
||||
return getExternalContext().getRequestHeaderMap().get(headerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String[] getHeaderValues(String headerName) {
|
||||
return getExternalContext().getRequestHeaderValuesMap().get(headerName);
|
||||
}
|
||||
@@ -97,6 +99,7 @@ public class FacesWebRequest extends FacesRequestAttributes implements NativeWeb
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getParameter(String paramName) {
|
||||
return getExternalContext().getRequestParameterMap().get(paramName);
|
||||
}
|
||||
@@ -107,6 +110,7 @@ public class FacesWebRequest extends FacesRequestAttributes implements NativeWeb
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String[] getParameterValues(String paramName) {
|
||||
return getExternalContext().getRequestParameterValuesMap().get(paramName);
|
||||
}
|
||||
@@ -127,11 +131,13 @@ public class FacesWebRequest extends FacesRequestAttributes implements NativeWeb
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getRemoteUser() {
|
||||
return getFacesContext().getExternalContext().getRemoteUser();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Principal getUserPrincipal() {
|
||||
return getFacesContext().getExternalContext().getUserPrincipal();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.web.context.request;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Request-backed {@link org.springframework.beans.factory.config.Scope}
|
||||
* implementation.
|
||||
@@ -47,6 +49,7 @@ public class RequestScope extends AbstractRequestAttributesScope {
|
||||
* returns {@code null}.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public String getConversationId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -132,11 +132,13 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getHeader(String headerName) {
|
||||
return getRequest().getHeader(headerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String[] getHeaderValues(String headerName) {
|
||||
String[] headerValues = StringUtils.toStringArray(getRequest().getHeaders(headerName));
|
||||
return (!ObjectUtils.isEmpty(headerValues) ? headerValues : null);
|
||||
@@ -148,11 +150,13 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getParameter(String paramName) {
|
||||
return getRequest().getParameter(paramName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String[] getParameterValues(String paramName) {
|
||||
return getRequest().getParameterValues(paramName);
|
||||
}
|
||||
@@ -178,11 +182,13 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getRemoteUser() {
|
||||
return getRequest().getRemoteUser();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Principal getUserPrincipal() {
|
||||
return getRequest().getUserPrincipal();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.web.context.request;
|
||||
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Session-backed {@link org.springframework.beans.factory.config.Scope}
|
||||
@@ -58,6 +59,7 @@ public class SessionScope extends AbstractRequestAttributesScope {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object remove(String name) {
|
||||
Object mutex = RequestContextHolder.currentRequestAttributes().getSessionMutex();
|
||||
synchronized (mutex) {
|
||||
|
||||
@@ -56,6 +56,7 @@ public class DeferredResult<T> {
|
||||
private static final Log logger = LogFactory.getLog(DeferredResult.class);
|
||||
|
||||
|
||||
@Nullable
|
||||
private final Long timeout;
|
||||
|
||||
private final Object timeoutResult;
|
||||
@@ -138,6 +139,7 @@ public class DeferredResult<T> {
|
||||
/**
|
||||
* Return the configured timeout value in milliseconds.
|
||||
*/
|
||||
@Nullable
|
||||
final Long getTimeoutValue() {
|
||||
return this.timeout;
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ public abstract class AbstractRefreshableWebApplicationContext extends AbstractR
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Theme getTheme(String themeName) {
|
||||
Assert.state(this.themeSource != null, "No ThemeSource available");
|
||||
return this.themeSource.getTheme(themeName);
|
||||
|
||||
@@ -80,6 +80,7 @@ public class ContextExposingHttpServletRequest extends HttpServletRequestWrapper
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getAttribute(String name) {
|
||||
if ((this.explicitAttributes == null || !this.explicitAttributes.contains(name)) &&
|
||||
(this.exposedContextBeanNames == null || this.exposedContextBeanNames.contains(name)) &&
|
||||
|
||||
@@ -197,6 +197,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Theme getTheme(String themeName) {
|
||||
Assert.state(this.themeSource != null, "No ThemeSource available");
|
||||
return this.themeSource.getTheme(themeName);
|
||||
@@ -213,6 +214,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ServletConfig getServletConfig() {
|
||||
throw new UnsupportedOperationException(
|
||||
"GenericWebApplicationContext does not support getServletConfig()");
|
||||
@@ -224,6 +226,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getNamespace() {
|
||||
throw new UnsupportedOperationException(
|
||||
"GenericWebApplicationContext does not support getNamespace()");
|
||||
|
||||
@@ -20,6 +20,7 @@ import javax.servlet.ServletConfig;
|
||||
|
||||
import org.springframework.core.env.EnumerablePropertySource;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -41,6 +42,7 @@ public class ServletConfigPropertySource extends EnumerablePropertySource<Servle
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getProperty(String name) {
|
||||
return this.source.getInitParameter(name);
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ public class ServletContextAttributeFactoryBean implements FactoryBean<Object>,
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getObject() throws Exception {
|
||||
return this.attribute;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ public class ServletContextParameterFactoryBean implements FactoryBean<String>,
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getObject() {
|
||||
return this.paramValue;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import javax.servlet.ServletContext;
|
||||
|
||||
import org.springframework.core.env.EnumerablePropertySource;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -41,6 +42,7 @@ public class ServletContextPropertySource extends EnumerablePropertySource<Servl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getProperty(String name) {
|
||||
return this.source.getInitParameter(name);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import javax.servlet.ServletContext;
|
||||
import org.springframework.core.io.AbstractFileResolvingResource;
|
||||
import org.springframework.core.io.ContextResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -212,6 +213,7 @@ public class ServletContextResource extends AbstractFileResolvingResource implem
|
||||
* @see org.springframework.util.StringUtils#getFilename(String)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public String getFilename() {
|
||||
return StringUtils.getFilename(this.path);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import javax.servlet.ServletContext;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
import org.springframework.beans.factory.config.Scope;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -74,6 +75,7 @@ public class ServletContextScope implements Scope, DisposableBean {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object remove(String name) {
|
||||
Object scopedObject = this.servletContext.getAttribute(name);
|
||||
if (scopedObject != null) {
|
||||
@@ -92,11 +94,13 @@ public class ServletContextScope implements Scope, DisposableBean {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object resolveContextualObject(String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getConversationId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ public class StaticWebApplicationContext extends StaticApplicationContext
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Theme getTheme(String themeName) {
|
||||
Assert.state(this.themeSource != null, "No ThemeSource available");
|
||||
return this.themeSource.getTheme(themeName);
|
||||
|
||||
@@ -115,6 +115,7 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public CorsConfiguration getCorsConfiguration(HttpServletRequest request) {
|
||||
String lookupPath = this.urlPathHelper.getLookupPathForRequest(request);
|
||||
for (Map.Entry<String, CorsConfiguration> entry : this.corsConfigurations.entrySet()) {
|
||||
|
||||
@@ -66,6 +66,7 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public CorsConfiguration getCorsConfiguration(ServerWebExchange exchange) {
|
||||
PathContainer lookupPath = exchange.getRequest().getPath().pathWithinApplication();
|
||||
return this.corsConfigurations.entrySet().stream()
|
||||
|
||||
@@ -90,6 +90,7 @@ public abstract class AbstractNamedValueMethodArgumentResolver implements Handle
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception {
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ public abstract class AbstractWebArgumentResolverAdapter implements HandlerMetho
|
||||
* to the method parameter.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception {
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ErrorsMethodArgumentResolver implements HandlerMethodArgumentResolv
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception {
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ public class ExpressionValueMethodArgumentResolver extends AbstractNamedValueMet
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Object resolveName(String name, MethodParameter parameter, NativeWebRequest webRequest) throws Exception {
|
||||
// No name to resolve
|
||||
return null;
|
||||
|
||||
@@ -46,6 +46,7 @@ public class MapMethodProcessor implements HandlerMethodArgumentResolver, Handle
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception {
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ public class ModelAttributeMethodProcessor implements HandlerMethodArgumentResol
|
||||
* @throws Exception if WebDataBinder initialization fails
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public final Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception {
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ public class ModelMethodProcessor implements HandlerMethodArgumentResolver, Hand
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception {
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ public class RequestHeaderMethodArgumentResolver extends AbstractNamedValueMetho
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Object resolveName(String name, MethodParameter parameter, NativeWebRequest request) throws Exception {
|
||||
String[] headerValues = request.getHeaderValues(name);
|
||||
if (headerValues != null) {
|
||||
|
||||
@@ -156,6 +156,7 @@ public class RequestParamMethodArgumentResolver extends AbstractNamedValueMethod
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Object resolveName(String name, MethodParameter parameter, NativeWebRequest request) throws Exception {
|
||||
HttpServletRequest servletRequest = request.getNativeRequest(HttpServletRequest.class);
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu
|
||||
* @throws IllegalStateException if no suitable {@link HandlerMethodArgumentResolver} is found.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception {
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ public class ResponseStatusException extends NestedRuntimeException {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getMessage() {
|
||||
String msg = "Response status " + this.status + (this.reason != null ? " with reason \"" + reason + "\"" : "");
|
||||
return NestedExceptionUtils.buildMessage(msg, getCause());
|
||||
|
||||
@@ -79,6 +79,7 @@ public class FixedLocaleContextResolver implements LocaleContextResolver {
|
||||
return locale;
|
||||
}
|
||||
@Override
|
||||
@Nullable
|
||||
public TimeZone getTimeZone() {
|
||||
return timeZone;
|
||||
}
|
||||
|
||||
@@ -105,6 +105,7 @@ final class HierarchicalUriComponents extends UriComponents {
|
||||
// Component getters
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getSchemeSpecificPart() {
|
||||
return null;
|
||||
}
|
||||
@@ -144,6 +145,7 @@ final class HierarchicalUriComponents extends UriComponents {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getQuery() {
|
||||
if (!this.queryParams.isEmpty()) {
|
||||
StringBuilder queryBuilder = new StringBuilder();
|
||||
|
||||
@@ -51,16 +51,19 @@ final class OpaqueUriComponents extends UriComponents {
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getSchemeSpecificPart() {
|
||||
return this.ssp;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getUserInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getHost() {
|
||||
return null;
|
||||
}
|
||||
@@ -71,6 +74,7 @@ final class OpaqueUriComponents extends UriComponents {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getPath() {
|
||||
return null;
|
||||
}
|
||||
@@ -81,6 +85,7 @@ final class OpaqueUriComponents extends UriComponents {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getQuery() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.springframework.web.util;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.PropertyPlaceholderHelper;
|
||||
import org.springframework.util.SystemPropertyUtils;
|
||||
|
||||
@@ -90,6 +91,7 @@ public abstract class ServletContextPropertyUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String resolvePlaceholder(String placeholderName) {
|
||||
try {
|
||||
String propVal = this.servletContext.getInitParameter(placeholderName);
|
||||
|
||||
Reference in New Issue
Block a user