INT-3217 Update Default Spring to 3.2.5
JIRA: https://jira.springsource.org/browse/INT-3217 INT-3217 Polishing PR Comments Also fixes some other warnings (mainly unused imports).
This commit is contained in:
committed by
Artem Bilan
parent
db32486d35
commit
4a3ba5abd0
@@ -40,10 +40,11 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
* An {@link HttpMessageConverter} implementation that delegates to an instance of
|
||||
* {@link XmlAwareFormHttpMessageConverter} while adding the capability to <i>read</i>
|
||||
* <code>multipart/form-data</code> content in an HTTP request.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class MultipartAwareFormHttpMessageConverter implements HttpMessageConverter<MultiValueMap<String, ?>> {
|
||||
|
||||
private volatile MultipartFileReader<?> multipartFileReader = new DefaultMultipartFileReader();
|
||||
@@ -66,10 +67,12 @@ public class MultipartAwareFormHttpMessageConverter implements HttpMessageConver
|
||||
this.multipartFileReader = multipartFileReader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MediaType> getSupportedMediaTypes() {
|
||||
return this.wrappedConverter.getSupportedMediaTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRead(Class<?> clazz, MediaType mediaType) {
|
||||
if (!(MultiValueMap.class.isAssignableFrom(clazz) || byte[].class.isAssignableFrom(clazz))) {
|
||||
return false;
|
||||
@@ -83,10 +86,12 @@ public class MultipartAwareFormHttpMessageConverter implements HttpMessageConver
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(Class<?> clazz, MediaType mediaType) {
|
||||
return this.wrappedConverter.canWrite(clazz, mediaType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiValueMap<String, ?> read(Class<? extends MultiValueMap<String, ?>> clazz,
|
||||
HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException {
|
||||
|
||||
@@ -118,6 +123,7 @@ public class MultipartAwareFormHttpMessageConverter implements HttpMessageConver
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(MultiValueMap<String, ?> map, MediaType contentType, HttpOutputMessage outputMessage)
|
||||
throws IOException, HttpMessageNotWritableException {
|
||||
this.wrappedConverter.write(map, contentType, outputMessage);
|
||||
|
||||
@@ -116,30 +116,37 @@ public final class IntegrationRequestMappingHandlerMapping extends RequestMappin
|
||||
|
||||
org.springframework.web.bind.annotation.RequestMapping requestMappingAnnotation =
|
||||
new org.springframework.web.bind.annotation.RequestMapping() {
|
||||
@Override
|
||||
public String[] value() {
|
||||
return requestMapping.getPathPatterns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestMethod[] method() {
|
||||
return requestMapping.getRequestMethods();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] params() {
|
||||
return requestMapping.getParams();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] headers() {
|
||||
return requestMapping.getHeaders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] consumes() {
|
||||
return requestMapping.getConsumes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] produces() {
|
||||
return requestMapping.getProduces();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Annotation> annotationType() {
|
||||
return org.springframework.web.bind.annotation.RequestMapping.class;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.net.URISyntaxException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.text.DateFormat;
|
||||
import java.text.MessageFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -30,9 +30,9 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -265,6 +265,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
|
||||
private volatile String userDefinedHeaderPrefix = "X-";
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
@@ -326,6 +327,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
* Depending on which type of adapter is using this mapper, the HttpHeaders might be
|
||||
* for an HTTP request (outbound adapter) or for an HTTP response (inbound adapter).
|
||||
*/
|
||||
@Override
|
||||
public void fromHeaders(MessageHeaders headers, HttpHeaders target) {
|
||||
if (logger.isDebugEnabled()){
|
||||
logger.debug(MessageFormat.format("outboundHeaderNames={0}", CollectionUtils.arrayToList(outboundHeaderNames)));
|
||||
@@ -356,6 +358,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
* Depending on which type of adapter is using this mapper, the HttpHeaders might be
|
||||
* from an HTTP request (inbound adapter) or from an HTTP response (outbound adapter).
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> toHeaders(HttpHeaders source) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(MessageFormat.format("inboundHeaderNames={0}", CollectionUtils.arrayToList(inboundHeaderNames)));
|
||||
@@ -389,6 +392,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (this.beanFactory != null){
|
||||
this.conversionService = IntegrationContextUtils.getConversionService(this.beanFactory);
|
||||
@@ -901,6 +905,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
return source.getIfNoneMatch();
|
||||
}
|
||||
else if (IF_MODIFIED_SINCE.equalsIgnoreCase(name)) {
|
||||
@SuppressWarnings("deprecation")
|
||||
long modifiedSince = source.getIfNotModifiedSince();
|
||||
return (modifiedSince > -1) ? modifiedSince : null;
|
||||
}
|
||||
|
||||
@@ -107,11 +107,12 @@ public class HttpProxyScenarioTests {
|
||||
RestTemplate template = Mockito.spy(new RestTemplate());
|
||||
|
||||
Mockito.doAnswer(new Answer<ResponseEntity<?>>() {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public ResponseEntity<?> answer(InvocationOnMock invocation) throws Throwable {
|
||||
URI uri = (URI) invocation.getArguments()[0];
|
||||
assertEquals(new URI("http://testServer/test?foo=bar&FOO=BAR"), uri);
|
||||
HttpEntity<?> httpEntity = (HttpEntity) invocation.getArguments()[2];
|
||||
HttpEntity<?> httpEntity = (HttpEntity<?>) invocation.getArguments()[2];
|
||||
HttpHeaders httpHeaders = httpEntity.getHeaders();
|
||||
assertEquals(ifModifiedSince, httpHeaders.getIfNotModifiedSince());
|
||||
assertEquals(ifUnmodifiedSinceValue, httpHeaders.getFirst("If-Unmodified-Since"));
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
package org.springframework.integration.http.config;
|
||||
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -28,6 +28,7 @@ import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -167,7 +168,6 @@ public class HttpOutboundChannelAdapterParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("uchecked")
|
||||
public void withUrlAndTemplate() {
|
||||
DirectFieldAccessor endpointAccessor = new DirectFieldAccessor(this.withUrlAndTemplate);
|
||||
RestTemplate restTemplate =
|
||||
@@ -257,10 +257,12 @@ public class HttpOutboundChannelAdapterParserTests {
|
||||
|
||||
public static class StubErrorHandler implements ResponseErrorHandler {
|
||||
|
||||
@Override
|
||||
public boolean hasError(ClientHttpResponse response) throws IOException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleError(ClientHttpResponse response) throws IOException {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.integration.http.support;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
import java.text.ParseException;
|
||||
@@ -33,10 +33,10 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -577,6 +577,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
|
||||
public static class TestClassConverter implements Converter<TestClass, String>{
|
||||
|
||||
@Override
|
||||
public String convert(TestClass source) {
|
||||
return "TestClass.class";
|
||||
}
|
||||
|
||||
@@ -386,6 +386,7 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests {
|
||||
|
||||
// If-Modified-Since tests
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void validateIfModifiedSinceAsNumber() throws ParseException{
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.outboundMapper();
|
||||
@@ -399,6 +400,7 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests {
|
||||
assertEquals(simpleDateFormat.parse("Thu, 01 Jan 1970 03:25:45 GMT").getTime(), headers.getIfNotModifiedSince());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void validateIfModifiedSinceAsString() throws ParseException{
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.outboundMapper();
|
||||
@@ -411,6 +413,7 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests {
|
||||
|
||||
assertEquals(simpleDateFormat.parse("Thu, 01 Jan 1970 03:25:45 GMT").getTime(), headers.getIfNotModifiedSince());
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void validateIfModifiedSinceAsDate() throws ParseException{
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.outboundMapper();
|
||||
@@ -673,6 +676,7 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests {
|
||||
assertEquals(0, messageHeaders.size());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testInt2995IfModifiedSince() throws Exception{
|
||||
Date ifModifiedSince = new Date();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy", Locale.US);
|
||||
|
||||
Reference in New Issue
Block a user