Polishing
This commit is contained in:
parent
65d52a4b97
commit
a9a1f783c5
|
|
@ -29,8 +29,8 @@ def customizePom(pom, gradleProject) {
|
|||
}
|
||||
licenses {
|
||||
license {
|
||||
name "The Apache Software License, Version 2.0"
|
||||
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
name "Apache License, Version 2.0"
|
||||
url "http://www.apache.org/licenses/LICENSE-2.0"
|
||||
distribution "repo"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -39,10 +39,11 @@ public class CacheNamespaceHandler extends NamespaceHandlerSupport {
|
|||
|
||||
static final String DEFAULT_CACHE_MANAGER_BEAN_NAME = "cacheManager";
|
||||
|
||||
|
||||
static String extractCacheManager(Element element) {
|
||||
return (element.hasAttribute(CacheNamespaceHandler.CACHE_MANAGER_ATTRIBUTE) ? element
|
||||
.getAttribute(CacheNamespaceHandler.CACHE_MANAGER_ATTRIBUTE)
|
||||
: CacheNamespaceHandler.DEFAULT_CACHE_MANAGER_BEAN_NAME);
|
||||
return (element.hasAttribute(CacheNamespaceHandler.CACHE_MANAGER_ATTRIBUTE) ?
|
||||
element.getAttribute(CacheNamespaceHandler.CACHE_MANAGER_ATTRIBUTE) :
|
||||
CacheNamespaceHandler.DEFAULT_CACHE_MANAGER_BEAN_NAME);
|
||||
}
|
||||
|
||||
static BeanDefinition parseKeyGenerator(Element element, BeanDefinition def) {
|
||||
|
|
@ -53,9 +54,11 @@ public class CacheNamespaceHandler extends NamespaceHandlerSupport {
|
|||
return def;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
registerBeanDefinitionParser("annotation-driven", new AnnotationDrivenCacheBeanDefinitionParser());
|
||||
registerBeanDefinitionParser("advice", new CacheAdviceParser());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ public @interface Configuration {
|
|||
|
||||
/**
|
||||
* Explicitly specify the name of the Spring bean definition associated
|
||||
* with this Configuration class. If left unspecified (the common case),
|
||||
* with this Configuration class. If left unspecified (the common case),
|
||||
* a bean name will be automatically generated.
|
||||
* <p>The custom name applies only if the Configuration class is picked up via
|
||||
* component scanning or supplied directly to a {@link AnnotationConfigApplicationContext}.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -256,8 +256,8 @@ public abstract class AbstractApplicationEventMulticaster
|
|||
* for the given event type
|
||||
*/
|
||||
protected boolean supportsEvent(Class<?> listenerType, ResolvableType eventType) {
|
||||
if (GenericApplicationListener.class.isAssignableFrom(listenerType)
|
||||
|| SmartApplicationListener.class.isAssignableFrom(listenerType)) {
|
||||
if (GenericApplicationListener.class.isAssignableFrom(listenerType) ||
|
||||
SmartApplicationListener.class.isAssignableFrom(listenerType)) {
|
||||
return true;
|
||||
}
|
||||
ResolvableType declaredEventType = GenericApplicationListenerAdapter.resolveDeclaredEventType(listenerType);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -79,6 +79,7 @@ public interface ApplicationEventMulticaster {
|
|||
* based on the {@code event} instance.
|
||||
* @param event the event to multicast
|
||||
* @param eventType the type of event (can be null)
|
||||
* @since 4.2
|
||||
*/
|
||||
void multicastEvent(ApplicationEvent event, ResolvableType eventType);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -145,7 +145,7 @@ public class EventListenerMethodProcessor implements SmartInitializingSingleton,
|
|||
if (CollectionUtils.isEmpty(annotatedMethods)) {
|
||||
this.nonAnnotatedClasses.add(targetType);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("No @EventListener annotations found on bean class: " + targetType);
|
||||
logger.trace("No @EventListener annotations found on bean class: " + targetType.getName());
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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,10 +23,10 @@ import java.lang.annotation.RetentionPolicy;
|
|||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Declares that a field should be formatted as a date time.
|
||||
* Declares that a field or method parameter should be formatted as a date or time.
|
||||
*
|
||||
* <p>Supports formatting by style pattern, ISO date time pattern, or custom format pattern string.
|
||||
* Can be applied to {@code java.util.Date}, {@code java.util.Calendar}, {@code java.long.Long},
|
||||
* Can be applied to {@code java.util.Date}, {@code java.util.Calendar}, {@code java.lang.Long},
|
||||
* Joda-Time value types; and as of Spring 4 and JDK 8, to JSR-310 <code>java.time</code> types too.
|
||||
*
|
||||
* <p>For style-based formatting, set the {@link #style} attribute to be the style pattern code.
|
||||
|
|
@ -35,7 +35,7 @@ import java.lang.annotation.Target;
|
|||
* A date or time may be omitted by specifying the style character '-'.
|
||||
*
|
||||
* <p>For ISO-based formatting, set the {@link #iso} attribute to be the desired {@link ISO} format,
|
||||
* such as {@link ISO#DATE}. For custom formatting, set the {@link #pattern()} attribute to be the
|
||||
* such as {@link ISO#DATE}. For custom formatting, set the {@link #pattern} attribute to be the
|
||||
* DateTime pattern, such as {@code yyyy/MM/dd hh:mm:ss a}.
|
||||
*
|
||||
* <p>Each attribute is mutually exclusive, so only set one attribute per annotation instance
|
||||
|
|
@ -64,7 +64,7 @@ public @interface DateTimeFormat {
|
|||
|
||||
/**
|
||||
* The ISO pattern to use to format the field.
|
||||
* The possible ISO patterns are defined in the {@link ISO} enum.
|
||||
* <p>The possible ISO patterns are defined in the {@link ISO} enum.
|
||||
* <p>Defaults to {@link ISO#NONE}, indicating this attribute should be ignored.
|
||||
* Set this attribute when you wish to format your field in accordance with an ISO format.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 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 java.lang.annotation.RetentionPolicy;
|
|||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Declares that a field should be formatted as a number.
|
||||
* Declares that a field or method parameter should be formatted as a number.
|
||||
*
|
||||
* <p>Supports formatting by style or custom pattern string.
|
||||
* Can be applied to any JDK {@code java.lang.Number} type.
|
||||
|
|
@ -37,7 +37,7 @@ import java.lang.annotation.Target;
|
|||
* When the {@link #pattern} attribute is specified, it takes precedence over
|
||||
* the {@link #style} attribute. When no annotation attributes are specified,
|
||||
* the default format applied is style-based for either number of currency,
|
||||
* depending on the annotated field type.
|
||||
* depending on the annotated field or method parameter type.
|
||||
*
|
||||
* @author Keith Donald
|
||||
* @author Juergen Hoeller
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* Spring's repackaging of
|
||||
* <a href="http://asm.ow2.org">org.objectweb.asm 5.0</a>
|
||||
* <a href="http://asm.ow2.org">ASM</a>
|
||||
* (for internal use only).
|
||||
*
|
||||
* <p>This repackaging technique avoids any potential conflicts with
|
||||
|
|
@ -8,8 +8,6 @@
|
|||
* libraries and frameworks.
|
||||
*
|
||||
* <p>As this repackaging happens at the class file level, sources
|
||||
* and javadocs are not available here. See the original ObjectWeb
|
||||
* <a href="http://asm.ow2.org/asm50/javadoc/user">ASM 5.0 javadocs</a>
|
||||
* for details when working with these classes.
|
||||
* and javadocs are not available here.
|
||||
*/
|
||||
package org.springframework.asm;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* Spring's repackaging of
|
||||
* <a href="http://cglib.sourceforge.net">net.sf.cglib 3.2</a>
|
||||
* <a href="http://cglib.sourceforge.net">CGLIB</a>
|
||||
* (for internal use only).
|
||||
*
|
||||
* <p>This repackaging technique avoids any potential conflicts with
|
||||
|
|
@ -8,8 +8,6 @@
|
|||
* libraries and frameworks.
|
||||
*
|
||||
* <p>As this repackaging happens at the class file level, sources
|
||||
* and javadocs are not available here. See the original
|
||||
* <a href="http://cglib.sourceforge.net/apidocs">CGLIB 3.2 javadocs</a>
|
||||
* for details when working with these classes.
|
||||
* and javadocs are not available here.
|
||||
*/
|
||||
package org.springframework.cglib;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2017 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 @@ final class CollectionToObjectConverter implements ConditionalGenericConverter {
|
|||
return source;
|
||||
}
|
||||
Collection<?> sourceCollection = (Collection<?>) source;
|
||||
if (sourceCollection.size() == 0) {
|
||||
if (sourceCollection.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Object firstElement = sourceCollection.iterator().next();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -154,7 +154,7 @@ public class PathMatchingResourcePatternResolverTests {
|
|||
private void assertFilenameIn(Resource resource, String... filenames) {
|
||||
String filename = resource.getFilename();
|
||||
assertTrue(resource + " does not have a filename that matches any of the specified names",
|
||||
Arrays.stream(filenames).anyMatch(filename::endsWith));
|
||||
Arrays.stream(filenames).anyMatch(filename::endsWith));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -168,11 +168,11 @@ public abstract class ScriptUtils {
|
|||
String blockCommentStartDelimiter, String blockCommentEndDelimiter, List<String> statements)
|
||||
throws ScriptException {
|
||||
|
||||
Assert.hasText(script, "script must not be null or empty");
|
||||
Assert.notNull(separator, "separator must not be null");
|
||||
Assert.hasText(commentPrefix, "commentPrefix must not be null or empty");
|
||||
Assert.hasText(blockCommentStartDelimiter, "blockCommentStartDelimiter must not be null or empty");
|
||||
Assert.hasText(blockCommentEndDelimiter, "blockCommentEndDelimiter must not be null or empty");
|
||||
Assert.hasText(script, "'script' must not be null or empty");
|
||||
Assert.notNull(separator, "'separator' must not be null");
|
||||
Assert.hasText(commentPrefix, "'commentPrefix' must not be null or empty");
|
||||
Assert.hasText(blockCommentStartDelimiter, "'blockCommentStartDelimiter' must not be null or empty");
|
||||
Assert.hasText(blockCommentEndDelimiter, "'blockCommentEndDelimiter' must not be null or empty");
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean inSingleQuote = false;
|
||||
|
|
@ -199,7 +199,7 @@ public abstract class ScriptUtils {
|
|||
}
|
||||
if (!inSingleQuote && !inDoubleQuote) {
|
||||
if (script.startsWith(separator, i)) {
|
||||
// we've reached the end of the current statement
|
||||
// We've reached the end of the current statement
|
||||
if (sb.length() > 0) {
|
||||
statements.add(sb.toString());
|
||||
sb = new StringBuilder();
|
||||
|
|
@ -208,32 +208,31 @@ public abstract class ScriptUtils {
|
|||
continue;
|
||||
}
|
||||
else if (script.startsWith(commentPrefix, i)) {
|
||||
// skip over any content from the start of the comment to the EOL
|
||||
// Skip over any content from the start of the comment to the EOL
|
||||
int indexOfNextNewline = script.indexOf("\n", i);
|
||||
if (indexOfNextNewline > i) {
|
||||
i = indexOfNextNewline;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
// if there's no EOL, we must be at the end
|
||||
// of the script, so stop here.
|
||||
// If there's no EOL, we must be at the end of the script, so stop here.
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (script.startsWith(blockCommentStartDelimiter, i)) {
|
||||
// skip over any block comments
|
||||
// Skip over any block comments
|
||||
int indexOfCommentEnd = script.indexOf(blockCommentEndDelimiter, i);
|
||||
if (indexOfCommentEnd > i) {
|
||||
i = indexOfCommentEnd + blockCommentEndDelimiter.length() - 1;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
throw new ScriptParseException(String.format("Missing block comment end delimiter [%s].",
|
||||
blockCommentEndDelimiter), resource);
|
||||
throw new ScriptParseException(
|
||||
"Missing block comment end delimiter: " + blockCommentEndDelimiter, resource);
|
||||
}
|
||||
}
|
||||
else if (c == ' ' || c == '\n' || c == '\t') {
|
||||
// avoid multiple adjacent whitespace characters
|
||||
// Avoid multiple adjacent whitespace characters
|
||||
if (sb.length() > 0 && sb.charAt(sb.length() - 1) != ' ') {
|
||||
c = ' ';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -395,12 +395,7 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
|
|||
* or a newly built {@link HttpEntity} wrapper for that part
|
||||
*/
|
||||
protected HttpEntity<?> getHttpEntity(Object part) {
|
||||
if (part instanceof HttpEntity) {
|
||||
return (HttpEntity<?>) part;
|
||||
}
|
||||
else {
|
||||
return new HttpEntity<Object>(part);
|
||||
}
|
||||
return (part instanceof HttpEntity ? (HttpEntity<?>) part : new HttpEntity<Object>(part));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -415,7 +410,7 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
|
|||
if (part instanceof Resource) {
|
||||
Resource resource = (Resource) part;
|
||||
String filename = resource.getFilename();
|
||||
if (this.multipartCharset != null) {
|
||||
if (filename != null && this.multipartCharset != null) {
|
||||
filename = MimeDelegate.encode(filename, this.multipartCharset.name());
|
||||
}
|
||||
return filename;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -67,14 +67,14 @@ public interface GenericHttpMessageConverter<T> extends HttpMessageConverter<T>
|
|||
|
||||
/**
|
||||
* Indicates whether the given class can be written by this converter.
|
||||
* This method should perform the same checks than
|
||||
* <p>This method should perform the same checks than
|
||||
* {@link HttpMessageConverter#canWrite(Class, MediaType)} with additional ones
|
||||
* related to the generic type.
|
||||
* @param type the (potentially generic) type to test for writability, can be
|
||||
* {@code null} if not specified.
|
||||
* @param type the (potentially generic) type to test for writability
|
||||
* (can be {@code null} if not specified)
|
||||
* @param clazz the source object class to test for writability
|
||||
* @param mediaType the media type to write, can be {@code null} if not specified.
|
||||
* Typically the value of an {@code Accept} header.
|
||||
* @param mediaType the media type to write (can be {@code null} if not specified);
|
||||
* typically the value of an {@code Accept} header.
|
||||
* @return {@code true} if writable; {@code false} otherwise
|
||||
* @since 4.2
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -35,8 +35,8 @@ public interface HttpMessageConverter<T> {
|
|||
/**
|
||||
* Indicates whether the given class can be read by this converter.
|
||||
* @param clazz the class to test for readability
|
||||
* @param mediaType the media type to read, can be {@code null} if not specified.
|
||||
* Typically the value of a {@code Content-Type} header.
|
||||
* @param mediaType the media type to read (can be {@code null} if not specified);
|
||||
* typically the value of a {@code Content-Type} header.
|
||||
* @return {@code true} if readable; {@code false} otherwise
|
||||
*/
|
||||
boolean canRead(Class<?> clazz, MediaType mediaType);
|
||||
|
|
@ -44,8 +44,8 @@ public interface HttpMessageConverter<T> {
|
|||
/**
|
||||
* Indicates whether the given class can be written by this converter.
|
||||
* @param clazz the class to test for writability
|
||||
* @param mediaType the media type to write, can be {@code null} if not specified.
|
||||
* Typically the value of an {@code Accept} header.
|
||||
* @param mediaType the media type to write (can be {@code null} if not specified);
|
||||
* typically the value of an {@code Accept} header.
|
||||
* @return {@code true} if writable; {@code false} otherwise
|
||||
*/
|
||||
boolean canWrite(Class<?> clazz, MediaType mediaType);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -24,7 +24,6 @@ import com.google.gson.GsonBuilder;
|
|||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
|
||||
/**
|
||||
* A {@link FactoryBean} for creating a Google Gson 2.x {@link Gson} instance.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -187,10 +187,9 @@ public class Jaxb2CollectionHttpMessageConverter<T extends Collection>
|
|||
try {
|
||||
return (T) collectionClass.newInstance();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
catch (Throwable ex) {
|
||||
throw new IllegalArgumentException(
|
||||
"Could not instantiate collection class [" +
|
||||
collectionClass.getName() + "]: " + ex.getMessage());
|
||||
"Could not instantiate collection class: " + collectionClass.getName(), ex);
|
||||
}
|
||||
}
|
||||
else if (List.class == collectionClass) {
|
||||
|
|
@ -230,6 +229,7 @@ public class Jaxb2CollectionHttpMessageConverter<T extends Collection>
|
|||
@Override
|
||||
public void write(T t, Type type, MediaType contentType, HttpOutputMessage outputMessage)
|
||||
throws IOException, HttpMessageNotWritableException {
|
||||
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -71,6 +71,7 @@ public class ForwardedHeaderFilter extends OncePerRequestFilter {
|
|||
|
||||
private final UrlPathHelper pathHelper;
|
||||
|
||||
|
||||
public ForwardedHeaderFilter() {
|
||||
this.pathHelper = new UrlPathHelper();
|
||||
this.pathHelper.setUrlDecode(false);
|
||||
|
|
@ -143,8 +144,7 @@ public class ForwardedHeaderFilter extends OncePerRequestFilter {
|
|||
String prefix = getForwardedPrefix(request);
|
||||
this.contextPath = (prefix != null ? prefix : request.getContextPath());
|
||||
this.requestUri = this.contextPath + pathHelper.getPathWithinApplication(request);
|
||||
this.requestUrl = this.scheme + "://" + this.host +
|
||||
(port == -1 ? "" : ":" + port) + this.requestUri;
|
||||
this.requestUrl = this.scheme + "://" + this.host + (port == -1 ? "" : ":" + port) + this.requestUri;
|
||||
this.headers = initHeaders(request);
|
||||
}
|
||||
|
||||
|
|
@ -235,13 +235,13 @@ public class ForwardedHeaderFilter extends OncePerRequestFilter {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private static class ForwardedHeaderResponseWrapper extends HttpServletResponseWrapper {
|
||||
|
||||
private static final String FOLDER_SEPARATOR = "/";
|
||||
|
||||
private final HttpServletRequest request;
|
||||
|
||||
|
||||
public ForwardedHeaderResponseWrapper(HttpServletResponse response, HttpServletRequest request) {
|
||||
super(response);
|
||||
this.request = request;
|
||||
|
|
@ -249,7 +249,6 @@ public class ForwardedHeaderFilter extends OncePerRequestFilter {
|
|||
|
||||
@Override
|
||||
public void sendRedirect(String location) throws IOException {
|
||||
|
||||
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(location);
|
||||
|
||||
// Absolute location
|
||||
|
|
@ -259,20 +258,15 @@ public class ForwardedHeaderFilter extends OncePerRequestFilter {
|
|||
}
|
||||
|
||||
// Network-path reference
|
||||
if(location.startsWith("//")) {
|
||||
if (location.startsWith("//")) {
|
||||
String scheme = this.request.getScheme();
|
||||
super.sendRedirect(builder.scheme(scheme).toUriString());
|
||||
return;
|
||||
}
|
||||
|
||||
// Relative to Servlet container root or to current request
|
||||
String path;
|
||||
if (location.startsWith(FOLDER_SEPARATOR)) {
|
||||
path = location;
|
||||
}
|
||||
else {
|
||||
path = StringUtils.applyRelativePath(this.request.getRequestURI(), location);
|
||||
}
|
||||
String path = (location.startsWith(FOLDER_SEPARATOR) ? location :
|
||||
StringUtils.applyRelativePath(this.request.getRequestURI(), location));
|
||||
|
||||
String result = UriComponentsBuilder
|
||||
.fromHttpRequest(new ServletServerHttpRequest(this.request))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -99,7 +99,7 @@ public class MappingJackson2HttpMessageConverterTests {
|
|||
assertEquals("Foo", result.get("string"));
|
||||
assertEquals(42, result.get("number"));
|
||||
assertEquals(42D, (Double) result.get("fraction"), 0D);
|
||||
List<String> array = new ArrayList<String>();
|
||||
List<String> array = new ArrayList<>();
|
||||
array.add("Foo");
|
||||
array.add("Bar");
|
||||
assertEquals(array, result.get("array"));
|
||||
|
|
@ -162,7 +162,6 @@ public class MappingJackson2HttpMessageConverterTests {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void readGenerics() throws IOException {
|
||||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter() {
|
||||
|
||||
@Override
|
||||
protected JavaType getJavaType(Type type, Class<?> contextClass) {
|
||||
if (type instanceof Class && List.class.isAssignableFrom((Class<?>)type)) {
|
||||
|
|
@ -451,9 +450,9 @@ public class MappingJackson2HttpMessageConverterTests {
|
|||
}
|
||||
|
||||
|
||||
private interface MyJacksonView1 {};
|
||||
private interface MyJacksonView1 {}
|
||||
|
||||
private interface MyJacksonView2 {};
|
||||
private interface MyJacksonView2 {}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -89,7 +89,7 @@ public class ModelAndView {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates new ModelAndView given a view name and a model.
|
||||
* Create a new ModelAndView given a view name and a model.
|
||||
* @param viewName name of the View to render, to be resolved
|
||||
* by the DispatcherServlet's ViewResolver
|
||||
* @param model Map of model names (Strings) to model objects
|
||||
|
|
@ -104,7 +104,7 @@ public class ModelAndView {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates new ModelAndView given a View object and a model.
|
||||
* Create a new ModelAndView given a View object and a model.
|
||||
* <emphasis>Note: the supplied model data is copied into the internal
|
||||
* storage of this class. You should not consider to modify the supplied
|
||||
* Map after supplying it to this class</emphasis>
|
||||
|
|
@ -121,14 +121,27 @@ public class ModelAndView {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates new ModelAndView given a view name, model, and status.
|
||||
* Create a new ModelAndView given a view name and HTTP status.
|
||||
* @param viewName name of the View to render, to be resolved
|
||||
* by the DispatcherServlet's ViewResolver
|
||||
* @param status an HTTP status code to use for the response
|
||||
* (to be set just prior to View rendering)
|
||||
* @since 4.3.8
|
||||
*/
|
||||
public ModelAndView(String viewName, HttpStatus status) {
|
||||
this.view = viewName;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ModelAndView given a view name, model, and HTTP status.
|
||||
* @param viewName name of the View to render, to be resolved
|
||||
* by the DispatcherServlet's ViewResolver
|
||||
* @param model Map of model names (Strings) to model objects
|
||||
* (Objects). Model entries may not be {@code null}, but the
|
||||
* model Map may be {@code null} if there is no model data.
|
||||
* @param status an alternative status code to use for the response;
|
||||
* The response status is set just prior to View rendering.
|
||||
* @param status an HTTP status code to use for the response
|
||||
* (to be set just prior to View rendering)
|
||||
* @since 4.3
|
||||
*/
|
||||
public ModelAndView(String viewName, Map<String, ?> model, HttpStatus status) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
|
@ -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.lang.reflect.Method;
|
||||
|
|
@ -34,13 +35,11 @@ import org.springframework.web.context.request.async.StandardServletAsyncWebRequ
|
|||
import org.springframework.web.context.request.async.WebAsyncUtils;
|
||||
import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link DeferredResultMethodReturnValueHandler}.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
*/
|
||||
public class DeferredResultReturnValueHandlerTests {
|
||||
|
|
@ -53,7 +52,7 @@ public class DeferredResultReturnValueHandlerTests {
|
|||
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setup() throws Exception {
|
||||
this.handler = new DeferredResultMethodReturnValueHandler();
|
||||
this.request = new MockHttpServletRequest();
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
|
|
|||
Loading…
Reference in New Issue