Polishing (backported from master)
This commit is contained in:
parent
16d5ba9b3a
commit
92d78c10a2
|
@ -879,10 +879,10 @@ project("spring-webmvc") {
|
||||||
testCompile("commons-io:commons-io:1.3")
|
testCompile("commons-io:commons-io:1.3")
|
||||||
testCompile("joda-time:joda-time:${jodaVersion}")
|
testCompile("joda-time:joda-time:${jodaVersion}")
|
||||||
testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
|
testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
|
||||||
testCompile("org.jruby:jruby:${jrubyVersion}")
|
|
||||||
testCompile("org.python:jython-standalone:2.5.3")
|
|
||||||
testCompile("org.mozilla:rhino:1.7.7.1")
|
testCompile("org.mozilla:rhino:1.7.7.1")
|
||||||
testCompile("org.webjars:underscorejs:1.8.3")
|
testRuntime("org.jruby:jruby:${jrubyVersion}")
|
||||||
|
testRuntime("org.python:jython-standalone:2.5.3")
|
||||||
|
testRuntime("org.webjars:underscorejs:1.8.3")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ public interface MethodInterceptor extends Interceptor {
|
||||||
* after the invocation. Polite implementations would certainly
|
* after the invocation. Polite implementations would certainly
|
||||||
* like to invoke {@link Joinpoint#proceed()}.
|
* like to invoke {@link Joinpoint#proceed()}.
|
||||||
* @param invocation the method invocation joinpoint
|
* @param invocation the method invocation joinpoint
|
||||||
* @return the result of the call to {@link Joinpoint#proceed();
|
* @return the result of the call to {@link Joinpoint#proceed()};
|
||||||
* might be intercepted by the interceptor
|
* might be intercepted by the interceptor
|
||||||
* @throws Throwable if the interceptors or the target object
|
* @throws Throwable if the interceptors or the target object
|
||||||
* throws an exception
|
* throws an exception
|
||||||
|
|
|
@ -269,7 +269,7 @@ class TypeConverterDelegate {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// convertedValue == null
|
// convertedValue == null
|
||||||
if (javaUtilOptionalEmpty != null && requiredType.equals(javaUtilOptionalEmpty.getClass())) {
|
if (javaUtilOptionalEmpty != null && requiredType == javaUtilOptionalEmpty.getClass()) {
|
||||||
convertedValue = javaUtilOptionalEmpty;
|
convertedValue = javaUtilOptionalEmpty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1002,7 +1002,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||||
Set<String> autowiredBeanNames, TypeConverter typeConverter) throws BeansException {
|
Set<String> autowiredBeanNames, TypeConverter typeConverter) throws BeansException {
|
||||||
|
|
||||||
descriptor.initParameterNameDiscovery(getParameterNameDiscoverer());
|
descriptor.initParameterNameDiscovery(getParameterNameDiscoverer());
|
||||||
if (descriptor.getDependencyType().equals(javaUtilOptionalClass)) {
|
if (javaUtilOptionalClass == descriptor.getDependencyType()) {
|
||||||
return new OptionalDependencyFactory().createOptionalDependency(descriptor, beanName);
|
return new OptionalDependencyFactory().createOptionalDependency(descriptor, beanName);
|
||||||
}
|
}
|
||||||
else if (ObjectFactory.class == descriptor.getDependencyType() ||
|
else if (ObjectFactory.class == descriptor.getDependencyType() ||
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -125,7 +125,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
||||||
setBeanClass(beanClass);
|
setBeanClass(beanClass);
|
||||||
setAutowireMode(autowireMode);
|
setAutowireMode(autowireMode);
|
||||||
if (dependencyCheck && getResolvedAutowireMode() != AUTOWIRE_CONSTRUCTOR) {
|
if (dependencyCheck && getResolvedAutowireMode() != AUTOWIRE_CONSTRUCTOR) {
|
||||||
setDependencyCheck(RootBeanDefinition.DEPENDENCY_CHECK_OBJECTS);
|
setDependencyCheck(DEPENDENCY_CHECK_OBJECTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
* <p>Note: EhCache 3.x lives in a different package namespace
|
* <p>Note: EhCache 3.x lives in a different package namespace
|
||||||
* and is not covered by the traditional support classes here.
|
* and is not covered by the traditional support classes here.
|
||||||
* Instead, consider using it through JCache (JSR-107), with
|
* Instead, consider using it through JCache (JSR-107), with
|
||||||
* Spring's support in {@link org.springframework.cache.jcache}.
|
* Spring's support in {@code org.springframework.cache.jcache}.
|
||||||
*/
|
*/
|
||||||
package org.springframework.cache.ehcache;
|
package org.springframework.cache.ehcache;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -52,7 +52,7 @@ public class CachingConfigurationSelector extends AdviceModeImportSelector<Enabl
|
||||||
private static final boolean jsr107Present = ClassUtils.isPresent(
|
private static final boolean jsr107Present = ClassUtils.isPresent(
|
||||||
"javax.cache.Cache", CachingConfigurationSelector.class.getClassLoader());
|
"javax.cache.Cache", CachingConfigurationSelector.class.getClassLoader());
|
||||||
|
|
||||||
private static final boolean jCacheImplPresent = ClassUtils.isPresent(
|
private static final boolean jcacheImplPresent = ClassUtils.isPresent(
|
||||||
PROXY_JCACHE_CONFIGURATION_CLASS, CachingConfigurationSelector.class.getClassLoader());
|
PROXY_JCACHE_CONFIGURATION_CLASS, CachingConfigurationSelector.class.getClassLoader());
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class CachingConfigurationSelector extends AdviceModeImportSelector<Enabl
|
||||||
List<String> result = new ArrayList<String>();
|
List<String> result = new ArrayList<String>();
|
||||||
result.add(AutoProxyRegistrar.class.getName());
|
result.add(AutoProxyRegistrar.class.getName());
|
||||||
result.add(ProxyCachingConfiguration.class.getName());
|
result.add(ProxyCachingConfiguration.class.getName());
|
||||||
if (jsr107Present && jCacheImplPresent) {
|
if (jsr107Present && jcacheImplPresent) {
|
||||||
result.add(PROXY_JCACHE_CONFIGURATION_CLASS);
|
result.add(PROXY_JCACHE_CONFIGURATION_CLASS);
|
||||||
}
|
}
|
||||||
return result.toArray(new String[result.size()]);
|
return result.toArray(new String[result.size()]);
|
||||||
|
@ -94,7 +94,7 @@ public class CachingConfigurationSelector extends AdviceModeImportSelector<Enabl
|
||||||
private String[] getAspectJImports() {
|
private String[] getAspectJImports() {
|
||||||
List<String> result = new ArrayList<String>();
|
List<String> result = new ArrayList<String>();
|
||||||
result.add(CACHE_ASPECT_CONFIGURATION_CLASS_NAME);
|
result.add(CACHE_ASPECT_CONFIGURATION_CLASS_NAME);
|
||||||
if (jsr107Present && jCacheImplPresent) {
|
if (jsr107Present && jcacheImplPresent) {
|
||||||
result.add(JCACHE_ASPECT_CONFIGURATION_CLASS_NAME);
|
result.add(JCACHE_ASPECT_CONFIGURATION_CLASS_NAME);
|
||||||
}
|
}
|
||||||
return result.toArray(new String[result.size()]);
|
return result.toArray(new String[result.size()]);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -60,11 +60,10 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
|
||||||
private static final String JCACHE_ASPECT_CLASS_NAME =
|
private static final String JCACHE_ASPECT_CLASS_NAME =
|
||||||
"org.springframework.cache.aspectj.JCacheCacheAspect";
|
"org.springframework.cache.aspectj.JCacheCacheAspect";
|
||||||
|
|
||||||
|
|
||||||
private static final boolean jsr107Present = ClassUtils.isPresent(
|
private static final boolean jsr107Present = ClassUtils.isPresent(
|
||||||
"javax.cache.Cache", AnnotationDrivenCacheBeanDefinitionParser.class.getClassLoader());
|
"javax.cache.Cache", AnnotationDrivenCacheBeanDefinitionParser.class.getClassLoader());
|
||||||
|
|
||||||
private static final boolean jCacheImplPresent = ClassUtils.isPresent(
|
private static final boolean jcacheImplPresent = ClassUtils.isPresent(
|
||||||
"org.springframework.cache.jcache.interceptor.DefaultJCacheOperationSource",
|
"org.springframework.cache.jcache.interceptor.DefaultJCacheOperationSource",
|
||||||
AnnotationDrivenCacheBeanDefinitionParser.class.getClassLoader());
|
AnnotationDrivenCacheBeanDefinitionParser.class.getClassLoader());
|
||||||
|
|
||||||
|
@ -91,7 +90,7 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
|
||||||
|
|
||||||
private void registerCacheAspect(Element element, ParserContext parserContext) {
|
private void registerCacheAspect(Element element, ParserContext parserContext) {
|
||||||
SpringCachingConfigurer.registerCacheAspect(element, parserContext);
|
SpringCachingConfigurer.registerCacheAspect(element, parserContext);
|
||||||
if (jsr107Present && jCacheImplPresent) { // Register JCache aspect
|
if (jsr107Present && jcacheImplPresent) {
|
||||||
JCacheCachingConfigurer.registerCacheAspect(element, parserContext);
|
JCacheCachingConfigurer.registerCacheAspect(element, parserContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +98,7 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
|
||||||
private void registerCacheAdvisor(Element element, ParserContext parserContext) {
|
private void registerCacheAdvisor(Element element, ParserContext parserContext) {
|
||||||
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
|
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
|
||||||
SpringCachingConfigurer.registerCacheAdvisor(element, parserContext);
|
SpringCachingConfigurer.registerCacheAdvisor(element, parserContext);
|
||||||
if (jsr107Present && jCacheImplPresent) { // Register JCache advisor
|
if (jsr107Present && jcacheImplPresent) {
|
||||||
JCacheCachingConfigurer.registerCacheAdvisor(element, parserContext);
|
JCacheCachingConfigurer.registerCacheAdvisor(element, parserContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,8 @@ package org.springframework.cache.interceptor;
|
||||||
public interface CacheOperationInvoker {
|
public interface CacheOperationInvoker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke the cache operation defined by this instance. Wraps any
|
* Invoke the cache operation defined by this instance. Wraps any exception
|
||||||
* exception that is thrown during the invocation in a
|
* that is thrown during the invocation in a {@link ThrowableWrapper}.
|
||||||
* {@link ThrowableWrapper}.
|
|
||||||
* @return the result of the operation
|
* @return the result of the operation
|
||||||
* @throws ThrowableWrapper if an error occurred while invoking the operation
|
* @throws ThrowableWrapper if an error occurred while invoking the operation
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -127,15 +127,13 @@ public class AnnotatedBeanDefinitionReader {
|
||||||
registerBean(annotatedClass, null, (Class<? extends Annotation>[]) null);
|
registerBean(annotatedClass, null, (Class<? extends Annotation>[]) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerBean(Class<?> annotatedClass,
|
@SuppressWarnings("unchecked")
|
||||||
@SuppressWarnings("unchecked") Class<? extends Annotation>... qualifiers) {
|
public void registerBean(Class<?> annotatedClass, Class<? extends Annotation>... qualifiers) {
|
||||||
|
|
||||||
registerBean(annotatedClass, null, qualifiers);
|
registerBean(annotatedClass, null, qualifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerBean(Class<?> annotatedClass, String name,
|
@SuppressWarnings("unchecked")
|
||||||
@SuppressWarnings("unchecked") Class<? extends Annotation>... qualifiers) {
|
public void registerBean(Class<?> annotatedClass, String name, Class<? extends Annotation>... qualifiers) {
|
||||||
|
|
||||||
AnnotatedGenericBeanDefinition abd = new AnnotatedGenericBeanDefinition(annotatedClass);
|
AnnotatedGenericBeanDefinition abd = new AnnotatedGenericBeanDefinition(annotatedClass);
|
||||||
if (this.conditionEvaluator.shouldSkip(abd.getMetadata())) {
|
if (this.conditionEvaluator.shouldSkip(abd.getMetadata())) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -466,7 +466,7 @@ public class GroovyScriptFactoryTests {
|
||||||
@Test // SPR-6268
|
@Test // SPR-6268
|
||||||
public void testProxyTargetClassNotAllowedIfNotGroovy() throws Exception {
|
public void testProxyTargetClassNotAllowedIfNotGroovy() throws Exception {
|
||||||
try {
|
try {
|
||||||
new ClassPathXmlApplicationContext("jruby-with-xsd-proxy-target-class.xml", getClass());
|
new ClassPathXmlApplicationContext("groovy-with-xsd-proxy-target-class.xml", getClass());
|
||||||
}
|
}
|
||||||
catch (BeanCreationException ex) {
|
catch (BeanCreationException ex) {
|
||||||
assertTrue(ex.getMessage().contains("Cannot use proxyTargetClass=true"));
|
assertTrue(ex.getMessage().contains("Cannot use proxyTargetClass=true"));
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
|
||||||
|
|
||||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.1.xsd">
|
|
||||||
|
|
||||||
<lang:defaults proxy-target-class="true"/>
|
|
||||||
|
|
||||||
<lang:jruby id="refreshableMessenger" refresh-check-delay="1000"
|
|
||||||
script-source="classpath:org/springframework/scripting/jruby/Messenger.rb"
|
|
||||||
script-interfaces="org.springframework.scripting.Messenger">
|
|
||||||
<lang:property name="message" value="Hello World!"/>
|
|
||||||
</lang:jruby>
|
|
||||||
|
|
||||||
</beans>
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -85,10 +85,9 @@ public abstract class MethodIntrospector {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select methods on the given target type based on a filter.
|
* Select methods on the given target type based on a filter.
|
||||||
* <p>Callers define methods of interest through the
|
* <p>Callers define methods of interest through the {@code MethodFilter} parameter.
|
||||||
* {@link ReflectionUtils.MethodFilter} parameter.
|
|
||||||
* @param targetType the target type to search methods on
|
* @param targetType the target type to search methods on
|
||||||
* @param methodFilter a {@link ReflectionUtils.MethodFilter} to help
|
* @param methodFilter a {@code MethodFilter} to help
|
||||||
* recognize handler methods of interest
|
* recognize handler methods of interest
|
||||||
* @return the selected methods, or an empty set in case of no match
|
* @return the selected methods, or an empty set in case of no match
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -343,7 +343,7 @@ public class TypeDescriptor implements Serializable {
|
||||||
if (streamAvailable && StreamDelegate.isStream(this.type)) {
|
if (streamAvailable && StreamDelegate.isStream(this.type)) {
|
||||||
return StreamDelegate.getStreamElementType(this);
|
return StreamDelegate.getStreamElementType(this);
|
||||||
}
|
}
|
||||||
return getRelatedIfResolvable(this, this.resolvableType.asCollection().getGeneric());
|
return getRelatedIfResolvable(this, this.resolvableType.asCollection().getGeneric(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -706,7 +706,7 @@ public class TypeDescriptor implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TypeDescriptor getStreamElementType(TypeDescriptor source) {
|
public static TypeDescriptor getStreamElementType(TypeDescriptor source) {
|
||||||
return getRelatedIfResolvable(source, source.resolvableType.as(Stream.class).getGeneric());
|
return getRelatedIfResolvable(source, source.resolvableType.as(Stream.class).getGeneric(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,11 @@ import org.springframework.lang.UsesJava8;
|
||||||
* Codec present, {@link #encode}/{@link #decode} calls will throw an IllegalStateException.
|
* Codec present, {@link #encode}/{@link #decode} calls will throw an IllegalStateException.
|
||||||
* However, as of Spring 4.2, {@link #encodeToString} and {@link #decodeFromString} will
|
* However, as of Spring 4.2, {@link #encodeToString} and {@link #decodeFromString} will
|
||||||
* nevertheless work since they can delegate to the JAXB DatatypeConverter as a fallback.
|
* nevertheless work since they can delegate to the JAXB DatatypeConverter as a fallback.
|
||||||
* However, this does not apply when using the ...UrlSafe... methods for RFC 4648 "URL and
|
* However, this does not apply when using the "UrlSafe" methods for RFC 4648 "URL and
|
||||||
* Filename Safe Alphabet"; a delegate is required.
|
* Filename Safe Alphabet"; a delegate is required.
|
||||||
* <p>
|
*
|
||||||
* <em>Note:</em> Apache Commons Codec does not add padding ({@code =}) when encoding with
|
* <p><em>Note:</em> Apache Commons Codec does not add padding ({@code =}) when encoding
|
||||||
* the URL and Filename Safe Alphabet.
|
* with the URL and Filename Safe Alphabet.
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Gary Russell
|
* @author Gary Russell
|
||||||
|
|
|
@ -24,13 +24,12 @@ import java.security.NoSuchAlgorithmException;
|
||||||
/**
|
/**
|
||||||
* Miscellaneous methods for calculating digests.
|
* Miscellaneous methods for calculating digests.
|
||||||
* <p>Mainly for internal use within the framework; consider
|
* <p>Mainly for internal use within the framework; consider
|
||||||
* <a href="http://commons.apache.org/codec/">Apache Commons Codec</a> for a
|
* <a href="http://commons.apache.org/codec/">Apache Commons Codec</a>
|
||||||
* more comprehensive suite of digest utilities.
|
* for a more comprehensive suite of digest utilities.
|
||||||
*
|
*
|
||||||
* @author Arjen Poutsma
|
* @author Arjen Poutsma
|
||||||
* @author Craig Andrews
|
* @author Craig Andrews
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
* @see org.apache.commons.codec.digest.DigestUtils
|
|
||||||
*/
|
*/
|
||||||
public abstract class DigestUtils {
|
public abstract class DigestUtils {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ abstract class UpdateMessageDigestInputStream extends InputStream {
|
||||||
* Update the message digest with the rest of the bytes in this stream.
|
* Update the message digest with the rest of the bytes in this stream.
|
||||||
* <p>Using this method is more optimized since it avoids creating new
|
* <p>Using this method is more optimized since it avoids creating new
|
||||||
* byte arrays for each call.
|
* byte arrays for each call.
|
||||||
* @param messageDigest The message digest to update
|
* @param messageDigest the message digest to update
|
||||||
* @throws IOException when propagated from {@link #read()}
|
* @throws IOException when propagated from {@link #read()}
|
||||||
*/
|
*/
|
||||||
public void updateMessageDigest(MessageDigest messageDigest) throws IOException {
|
public void updateMessageDigest(MessageDigest messageDigest) throws IOException {
|
||||||
|
@ -47,7 +47,7 @@ abstract class UpdateMessageDigestInputStream extends InputStream {
|
||||||
* Update the message digest with the next len bytes in this stream.
|
* Update the message digest with the next len bytes in this stream.
|
||||||
* <p>Using this method is more optimized since it avoids creating new
|
* <p>Using this method is more optimized since it avoids creating new
|
||||||
* byte arrays for each call.
|
* byte arrays for each call.
|
||||||
* @param messageDigest The message digest to update
|
* @param messageDigest the message digest to update
|
||||||
* @param len how many bytes to read from this stream and use to update the message digest
|
* @param len how many bytes to read from this stream and use to update the message digest
|
||||||
* @throws IOException when propagated from {@link #read()}
|
* @throws IOException when propagated from {@link #read()}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,7 +24,6 @@ import java.util.function.BiFunction;
|
||||||
|
|
||||||
import org.springframework.lang.UsesJava8;
|
import org.springframework.lang.UsesJava8;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapts a {@link CompletableFuture} into a {@link ListenableFuture}.
|
* Adapts a {@link CompletableFuture} into a {@link ListenableFuture}.
|
||||||
*
|
*
|
||||||
|
@ -38,6 +37,7 @@ public class CompletableToListenableFutureAdapter<T> implements ListenableFuture
|
||||||
|
|
||||||
private final ListenableFutureCallbackRegistry<T> callbacks = new ListenableFutureCallbackRegistry<T>();
|
private final ListenableFutureCallbackRegistry<T> callbacks = new ListenableFutureCallbackRegistry<T>();
|
||||||
|
|
||||||
|
|
||||||
public CompletableToListenableFutureAdapter(CompletableFuture<T> completableFuture) {
|
public CompletableToListenableFutureAdapter(CompletableFuture<T> completableFuture) {
|
||||||
this.completableFuture = completableFuture;
|
this.completableFuture = completableFuture;
|
||||||
this.completableFuture.handle(new BiFunction<T, Throwable, Object>() {
|
this.completableFuture.handle(new BiFunction<T, Throwable, Object>() {
|
||||||
|
@ -54,6 +54,7 @@ public class CompletableToListenableFutureAdapter<T> implements ListenableFuture
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCallback(ListenableFutureCallback<? super T> callback) {
|
public void addCallback(ListenableFutureCallback<? super T> callback) {
|
||||||
this.callbacks.addCallback(callback);
|
this.callbacks.addCallback(callback);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,10 +24,9 @@ import java.util.concurrent.TimeoutException;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class that adapts a {@link Future} parameterized over S into a {@code
|
* Abstract class that adapts a {@link Future} parameterized over S into a {@code Future}
|
||||||
* Future} parameterized over T. All methods are delegated to the adaptee, where {@link
|
* parameterized over T. All methods are delegated to the adaptee, where {@link #get()}
|
||||||
* #get()} and {@link #get(long, TimeUnit)} call {@link #adapt(Object)} on the adaptee's
|
* and {@link #get(long, TimeUnit)} call {@link #adapt(Object)} on the adaptee's result.
|
||||||
* result.
|
|
||||||
*
|
*
|
||||||
* @author Arjen Poutsma
|
* @author Arjen Poutsma
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -30,13 +30,15 @@ import static org.hamcrest.CoreMatchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for {@link AbstractPropertySource} implementations.
|
* Unit tests for {@link PropertySource} implementations.
|
||||||
*
|
*
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
*/
|
*/
|
||||||
public class PropertySourceTests {
|
public class PropertySourceTests {
|
||||||
@Test @SuppressWarnings("serial")
|
|
||||||
|
@Test
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public void equals() {
|
public void equals() {
|
||||||
Map<String, Object> map1 = new HashMap<String, Object>() {{ put("a", "b"); }};
|
Map<String, Object> map1 = new HashMap<String, Object>() {{ put("a", "b"); }};
|
||||||
Map<String, Object> map2 = new HashMap<String, Object>() {{ put("c", "d"); }};
|
Map<String, Object> map2 = new HashMap<String, Object>() {{ put("c", "d"); }};
|
||||||
|
@ -59,14 +61,15 @@ public class PropertySourceTests {
|
||||||
assertThat(new MapPropertySource("x", map1).equals(new PropertiesPropertySource("y", props2)), is(false));
|
assertThat(new MapPropertySource("x", map1).equals(new PropertiesPropertySource("y", props2)), is(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @SuppressWarnings("serial")
|
@Test
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public void collectionsOperations() {
|
public void collectionsOperations() {
|
||||||
Map<String, Object> map1 = new HashMap<String, Object>() {{ put("a", "b"); }};
|
Map<String, Object> map1 = new HashMap<String, Object>() {{ put("a", "b"); }};
|
||||||
Map<String, Object> map2 = new HashMap<String, Object>() {{ put("c", "d"); }};
|
Map<String, Object> map2 = new HashMap<String, Object>() {{ put("c", "d"); }};
|
||||||
|
|
||||||
PropertySource<?> ps1 = new MapPropertySource("ps1", map1);
|
PropertySource<?> ps1 = new MapPropertySource("ps1", map1);
|
||||||
ps1.getSource();
|
ps1.getSource();
|
||||||
List<PropertySource<?>> propertySources = new ArrayList<PropertySource<?>>();
|
List<PropertySource<?>> propertySources = new ArrayList<>();
|
||||||
assertThat(propertySources.add(ps1), equalTo(true));
|
assertThat(propertySources.add(ps1), equalTo(true));
|
||||||
assertThat(propertySources.contains(ps1), is(true));
|
assertThat(propertySources.contains(ps1), is(true));
|
||||||
assertThat(propertySources.contains(PropertySource.named("ps1")), is(true));
|
assertThat(propertySources.contains(PropertySource.named("ps1")), is(true));
|
||||||
|
@ -116,4 +119,5 @@ public class PropertySourceTests {
|
||||||
logger.setLevel(original);
|
logger.setLevel(original);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -147,6 +147,72 @@ public class CodeFlow implements Opcodes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after the main expression evaluation method has been generated, this
|
||||||
|
* method will callback any registered FieldAdders or ClinitAdders to add any
|
||||||
|
* extra information to the class representing the compiled expression.
|
||||||
|
*/
|
||||||
|
public void finish() {
|
||||||
|
if (this.fieldAdders != null) {
|
||||||
|
for (FieldAdder fieldAdder : this.fieldAdders) {
|
||||||
|
fieldAdder.generateField(cw,this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.clinitAdders != null) {
|
||||||
|
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "<clinit>", "()V", null, null);
|
||||||
|
mv.visitCode();
|
||||||
|
this.nextFreeVariableId = 0; // To 0 because there is no 'this' in a clinit
|
||||||
|
for (ClinitAdder clinitAdder : this.clinitAdders) {
|
||||||
|
clinitAdder.generateCode(mv, this);
|
||||||
|
}
|
||||||
|
mv.visitInsn(RETURN);
|
||||||
|
mv.visitMaxs(0,0); // not supplied due to COMPUTE_MAXS
|
||||||
|
mv.visitEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a FieldAdder which will add a new field to the generated
|
||||||
|
* class to support the code produced by an ast nodes primary
|
||||||
|
* generateCode() method.
|
||||||
|
*/
|
||||||
|
public void registerNewField(FieldAdder fieldAdder) {
|
||||||
|
if (this.fieldAdders == null) {
|
||||||
|
this.fieldAdders = new ArrayList<FieldAdder>();
|
||||||
|
}
|
||||||
|
this.fieldAdders.add(fieldAdder);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a ClinitAdder which will add code to the static
|
||||||
|
* initializer in the generated class to support the code
|
||||||
|
* produced by an ast nodes primary generateCode() method.
|
||||||
|
*/
|
||||||
|
public void registerNewClinit(ClinitAdder clinitAdder) {
|
||||||
|
if (this.clinitAdders == null) {
|
||||||
|
this.clinitAdders = new ArrayList<ClinitAdder>();
|
||||||
|
}
|
||||||
|
this.clinitAdders.add(clinitAdder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int nextFieldId() {
|
||||||
|
return this.nextFieldId++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int nextFreeVariableId() {
|
||||||
|
return this.nextFreeVariableId++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClassName() {
|
||||||
|
return this.clazzName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public String getClassname() {
|
||||||
|
return this.clazzName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert any necessary cast and value call to convert from a boxed type to a
|
* Insert any necessary cast and value call to convert from a boxed type to a
|
||||||
* primitive value
|
* primitive value
|
||||||
|
@ -778,74 +844,6 @@ public class CodeFlow implements Opcodes {
|
||||||
return descriptors;
|
return descriptors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called after the main expression evaluation method has been generated, this
|
|
||||||
* method will callback any registered FieldAdders or ClinitAdders to add any
|
|
||||||
* extra information to the class representing the compiled expression.
|
|
||||||
*/
|
|
||||||
public void finish() {
|
|
||||||
if (fieldAdders != null) {
|
|
||||||
for (FieldAdder fieldAdder: fieldAdders) {
|
|
||||||
fieldAdder.generateField(cw,this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (clinitAdders != null) {
|
|
||||||
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "<clinit>", "()V", null, null);
|
|
||||||
mv.visitCode();
|
|
||||||
nextFreeVariableId = 0; // To 0 because there is no 'this' in a clinit
|
|
||||||
for (ClinitAdder clinitAdder: clinitAdders) {
|
|
||||||
clinitAdder.generateCode(mv, this);
|
|
||||||
}
|
|
||||||
mv.visitInsn(RETURN);
|
|
||||||
mv.visitMaxs(0,0); // not supplied due to COMPUTE_MAXS
|
|
||||||
mv.visitEnd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a FieldAdder which will add a new field to the generated
|
|
||||||
* class to support the code produced by an ast nodes primary
|
|
||||||
* generateCode() method.
|
|
||||||
*/
|
|
||||||
public void registerNewField(FieldAdder fieldAdder) {
|
|
||||||
if (fieldAdders == null) {
|
|
||||||
fieldAdders = new ArrayList<FieldAdder>();
|
|
||||||
}
|
|
||||||
fieldAdders.add(fieldAdder);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a ClinitAdder which will add code to the static
|
|
||||||
* initializer in the generated class to support the code
|
|
||||||
* produced by an ast nodes primary generateCode() method.
|
|
||||||
*/
|
|
||||||
public void registerNewClinit(ClinitAdder clinitAdder) {
|
|
||||||
if (clinitAdders == null) {
|
|
||||||
clinitAdders = new ArrayList<ClinitAdder>();
|
|
||||||
}
|
|
||||||
clinitAdders.add(clinitAdder);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int nextFieldId() {
|
|
||||||
return nextFieldId++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int nextFreeVariableId() {
|
|
||||||
return nextFreeVariableId++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClassname() {
|
|
||||||
return clazzName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface FieldAdder {
|
|
||||||
public void generateField(ClassWriter cw, CodeFlow codeflow);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface ClinitAdder {
|
|
||||||
public void generateCode(MethodVisitor mv, CodeFlow codeflow);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the optimal instruction for loading a number on the stack.
|
* Create the optimal instruction for loading a number on the stack.
|
||||||
* @param mv where to insert the bytecode
|
* @param mv where to insert the bytecode
|
||||||
|
@ -977,4 +975,15 @@ public class CodeFlow implements Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface FieldAdder {
|
||||||
|
|
||||||
|
void generateField(ClassWriter cw, CodeFlow codeflow);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface ClinitAdder {
|
||||||
|
|
||||||
|
void generateCode(MethodVisitor mv, CodeFlow codeflow);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,8 +132,8 @@ public class InlineList extends SpelNodeImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateCode(MethodVisitor mv, CodeFlow codeflow) {
|
public void generateCode(MethodVisitor mv, CodeFlow codeflow) {
|
||||||
final String constantFieldName = "inlineList$"+codeflow.nextFieldId();
|
final String constantFieldName = "inlineList$" + codeflow.nextFieldId();
|
||||||
final String clazzname = codeflow.getClassname();
|
final String className = codeflow.getClassName();
|
||||||
|
|
||||||
codeflow.registerNewField(new CodeFlow.FieldAdder() {
|
codeflow.registerNewField(new CodeFlow.FieldAdder() {
|
||||||
public void generateField(ClassWriter cw, CodeFlow codeflow) {
|
public void generateField(ClassWriter cw, CodeFlow codeflow) {
|
||||||
|
@ -143,11 +143,11 @@ public class InlineList extends SpelNodeImpl {
|
||||||
|
|
||||||
codeflow.registerNewClinit(new CodeFlow.ClinitAdder() {
|
codeflow.registerNewClinit(new CodeFlow.ClinitAdder() {
|
||||||
public void generateCode(MethodVisitor mv, CodeFlow codeflow) {
|
public void generateCode(MethodVisitor mv, CodeFlow codeflow) {
|
||||||
generateClinitCode(clazzname,constantFieldName, mv,codeflow,false);
|
generateClinitCode(className, constantFieldName, mv, codeflow, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mv.visitFieldInsn(GETSTATIC, clazzname, constantFieldName, "Ljava/util/List;");
|
mv.visitFieldInsn(GETSTATIC, className, constantFieldName, "Ljava/util/List;");
|
||||||
codeflow.pushDescriptor("Ljava/util/List");
|
codeflow.pushDescriptor("Ljava/util/List");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +158,8 @@ public class InlineList extends SpelNodeImpl {
|
||||||
if (!nested) {
|
if (!nested) {
|
||||||
mv.visitFieldInsn(PUTSTATIC, clazzname, constantFieldName, "Ljava/util/List;");
|
mv.visitFieldInsn(PUTSTATIC, clazzname, constantFieldName, "Ljava/util/List;");
|
||||||
}
|
}
|
||||||
int childcount = getChildCount();
|
int childCount = getChildCount();
|
||||||
for (int c=0; c < childcount; c++) {
|
for (int c = 0; c < childCount; c++) {
|
||||||
if (!nested) {
|
if (!nested) {
|
||||||
mv.visitFieldInsn(GETSTATIC, clazzname, constantFieldName, "Ljava/util/List;");
|
mv.visitFieldInsn(GETSTATIC, clazzname, constantFieldName, "Ljava/util/List;");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -542,6 +542,7 @@ public abstract class AbstractJdbcInsert {
|
||||||
* @param batch array of Maps with parameter names and values to be used in batch insert
|
* @param batch array of Maps with parameter names and values to be used in batch insert
|
||||||
* @return array of number of rows affected
|
* @return array of number of rows affected
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected int[] doExecuteBatch(Map<String, ?>... batch) {
|
protected int[] doExecuteBatch(Map<String, ?>... batch) {
|
||||||
checkCompiled();
|
checkCompiled();
|
||||||
List<List<Object>> batchValues = new ArrayList<List<Object>>(batch.length);
|
List<List<Object>> batchValues = new ArrayList<List<Object>>(batch.length);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -148,6 +148,7 @@ public class SimpleJdbcInsert extends AbstractJdbcInsert implements SimpleJdbcIn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public int[] executeBatch(Map<String, ?>... batch) {
|
public int[] executeBatch(Map<String, ?>... batch) {
|
||||||
return doExecuteBatch(batch);
|
return doExecuteBatch(batch);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -152,6 +152,7 @@ public interface SimpleJdbcInsertOperations {
|
||||||
* @param batch an array of Maps containing a batch of column names and corresponding value
|
* @param batch an array of Maps containing a batch of column names and corresponding value
|
||||||
* @return the array of number of rows affected as returned by the JDBC driver
|
* @return the array of number of rows affected as returned by the JDBC driver
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
int[] executeBatch(Map<String, ?>... batch);
|
int[] executeBatch(Map<String, ?>... batch);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -101,7 +101,7 @@ public class TransactionAwareConnectionFactoryProxy
|
||||||
* Set the target ConnectionFactory that this ConnectionFactory should delegate to.
|
* Set the target ConnectionFactory that this ConnectionFactory should delegate to.
|
||||||
*/
|
*/
|
||||||
public final void setTargetConnectionFactory(ConnectionFactory targetConnectionFactory) {
|
public final void setTargetConnectionFactory(ConnectionFactory targetConnectionFactory) {
|
||||||
Assert.notNull(targetConnectionFactory, "targetConnectionFactory must not be nul");
|
Assert.notNull(targetConnectionFactory, "'targetConnectionFactory' must not be null");
|
||||||
this.targetConnectionFactory = targetConnectionFactory;
|
this.targetConnectionFactory = targetConnectionFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -61,7 +61,7 @@ public class JmsMessageEndpointFactory extends AbstractMessageEndpointFactory {
|
||||||
* Return the JMS MessageListener for this endpoint.
|
* Return the JMS MessageListener for this endpoint.
|
||||||
*/
|
*/
|
||||||
protected MessageListener getMessageListener() {
|
protected MessageListener getMessageListener() {
|
||||||
return messageListener;
|
return this.messageListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -196,6 +196,7 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B
|
||||||
@Override
|
@Override
|
||||||
public Message toMessage(Object object, Session session, Object conversionHint)
|
public Message toMessage(Object object, Session session, Object conversionHint)
|
||||||
throws JMSException, MessageConversionException {
|
throws JMSException, MessageConversionException {
|
||||||
|
|
||||||
return toMessage(object, session, getSerializationView(conversionHint));
|
return toMessage(object, session, getSerializationView(conversionHint));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,6 +235,7 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B
|
||||||
|
|
||||||
protected Message toMessage(Object object, Session session, ObjectWriter objectWriter)
|
protected Message toMessage(Object object, Session session, ObjectWriter objectWriter)
|
||||||
throws JMSException, MessageConversionException {
|
throws JMSException, MessageConversionException {
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
try {
|
try {
|
||||||
switch (this.targetType) {
|
switch (this.targetType) {
|
||||||
|
@ -319,8 +321,8 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B
|
||||||
* @return the resulting message
|
* @return the resulting message
|
||||||
* @throws JMSException if thrown by JMS methods
|
* @throws JMSException if thrown by JMS methods
|
||||||
* @throws IOException in case of I/O errors
|
* @throws IOException in case of I/O errors
|
||||||
* @see Session#createBytesMessage
|
|
||||||
* @since 4.3
|
* @since 4.3
|
||||||
|
* @see Session#createBytesMessage
|
||||||
*/
|
*/
|
||||||
protected BytesMessage mapToBytesMessage(Object object, Session session, ObjectWriter objectWriter)
|
protected BytesMessage mapToBytesMessage(Object object, Session session, ObjectWriter objectWriter)
|
||||||
throws JMSException, IOException {
|
throws JMSException, IOException {
|
||||||
|
@ -400,7 +402,6 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to dispatch to converters for individual message types.
|
* Convenience method to dispatch to converters for individual message types.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -152,7 +152,4 @@ public class MessagingMessageConverter implements MessageConverter, Initializing
|
||||||
return this.headerMapper.toHeaders(message);
|
return this.headerMapper.toHeaders(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
|
||||||
|
|
||||||
private static final String MVC_VALIDATOR_NAME = "mvcValidator";
|
private static final String MVC_VALIDATOR_NAME = "mvcValidator";
|
||||||
|
|
||||||
private static final boolean jackson2Present= ClassUtils.isPresent(
|
private static final boolean jackson2Present = ClassUtils.isPresent(
|
||||||
"com.fasterxml.jackson.databind.ObjectMapper", AbstractMessageBrokerConfiguration.class.getClassLoader());
|
"com.fasterxml.jackson.databind.ObjectMapper", AbstractMessageBrokerConfiguration.class.getClassLoader());
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,136 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2002-2013 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.messaging.converter;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import org.springframework.messaging.Message;
|
|
||||||
import org.springframework.messaging.MessageHeaders;
|
|
||||||
import org.springframework.messaging.support.MessageBuilder;
|
|
||||||
import org.springframework.util.MimeType;
|
|
||||||
import org.springframework.util.MimeTypeUtils;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test fixture for {@link org.springframework.messaging.converter.AbstractMessageConverter}.
|
|
||||||
*
|
|
||||||
* @author Rossen Stoyanchev
|
|
||||||
*/
|
|
||||||
public class AbstractMessageConverterTests {
|
|
||||||
|
|
||||||
private TestMessageConverter converter;
|
|
||||||
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setup() {
|
|
||||||
this.converter = new TestMessageConverter();
|
|
||||||
this.converter.setContentTypeResolver(new DefaultContentTypeResolver());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void supportsTargetClass() {
|
|
||||||
Message<String> message = MessageBuilder.withPayload("ABC").build();
|
|
||||||
|
|
||||||
assertEquals("success-from", this.converter.fromMessage(message, String.class));
|
|
||||||
assertNull(this.converter.fromMessage(message, Integer.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void supportsMimeType() {
|
|
||||||
Message<String> message = MessageBuilder.withPayload(
|
|
||||||
"ABC").setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.TEXT_PLAIN).build();
|
|
||||||
|
|
||||||
assertEquals("success-from", this.converter.fromMessage(message, String.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void supportsMimeTypeNotSupported() {
|
|
||||||
Message<String> message = MessageBuilder.withPayload(
|
|
||||||
"ABC").setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.APPLICATION_JSON).build();
|
|
||||||
|
|
||||||
assertNull(this.converter.fromMessage(message, String.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void supportsMimeTypeNotSpecified() {
|
|
||||||
Message<String> message = MessageBuilder.withPayload("ABC").build();
|
|
||||||
assertEquals("success-from", this.converter.fromMessage(message, String.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void supportsMimeTypeNoneConfigured() {
|
|
||||||
|
|
||||||
Message<String> message = MessageBuilder.withPayload(
|
|
||||||
"ABC").setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.APPLICATION_JSON).build();
|
|
||||||
|
|
||||||
this.converter = new TestMessageConverter(Collections.<MimeType>emptyList());
|
|
||||||
this.converter.setContentTypeResolver(new DefaultContentTypeResolver());
|
|
||||||
|
|
||||||
assertEquals("success-from", this.converter.fromMessage(message, String.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void toMessageHeadersCopied() {
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
|
||||||
map.put("foo", "bar");
|
|
||||||
MessageHeaders headers = new MessageHeaders(map );
|
|
||||||
Message<?> message = this.converter.toMessage("ABC", headers);
|
|
||||||
|
|
||||||
assertEquals("bar", message.getHeaders().get("foo"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void toMessageContentTypeHeader() {
|
|
||||||
Message<?> message = this.converter.toMessage("ABC", null);
|
|
||||||
assertEquals(MimeTypeUtils.TEXT_PLAIN, message.getHeaders().get(MessageHeaders.CONTENT_TYPE));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static class TestMessageConverter extends AbstractMessageConverter {
|
|
||||||
|
|
||||||
public TestMessageConverter() {
|
|
||||||
super(MimeTypeUtils.TEXT_PLAIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TestMessageConverter(Collection<MimeType> supportedMimeTypes) {
|
|
||||||
super(supportedMimeTypes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean supports(Class<?> clazz) {
|
|
||||||
return String.class.equals(clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object convertFromInternal(Message<?> message, Class<?> targetClass) {
|
|
||||||
return "success-from";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object convertToInternal(Object payload, MessageHeaders headers) {
|
|
||||||
return "success-to";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -44,6 +44,7 @@ public class MessageConverterTests {
|
||||||
|
|
||||||
private TestMessageConverter converter = new TestMessageConverter();
|
private TestMessageConverter converter = new TestMessageConverter();
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void supportsTargetClass() {
|
public void supportsTargetClass() {
|
||||||
Message<String> message = MessageBuilder.withPayload("ABC").build();
|
Message<String> message = MessageBuilder.withPayload("ABC").build();
|
||||||
|
@ -105,7 +106,7 @@ public class MessageConverterTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void toMessageWithHeaders() {
|
public void toMessageWithHeaders() {
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("foo", "bar");
|
map.put("foo", "bar");
|
||||||
MessageHeaders headers = new MessageHeaders(map);
|
MessageHeaders headers = new MessageHeaders(map);
|
||||||
Message<?> message = this.converter.toMessage("ABC", headers);
|
Message<?> message = this.converter.toMessage("ABC", headers);
|
||||||
|
|
|
@ -115,11 +115,11 @@ public abstract class SharedEntityManagerCreator {
|
||||||
*/
|
*/
|
||||||
public static EntityManager createSharedEntityManager(
|
public static EntityManager createSharedEntityManager(
|
||||||
EntityManagerFactory emf, Map<?, ?> properties, boolean synchronizedWithTransaction) {
|
EntityManagerFactory emf, Map<?, ?> properties, boolean synchronizedWithTransaction) {
|
||||||
Class<?> entityManagerInterface = (emf instanceof EntityManagerFactoryInfo ?
|
|
||||||
|
Class<?> emIfc = (emf instanceof EntityManagerFactoryInfo ?
|
||||||
((EntityManagerFactoryInfo) emf).getEntityManagerInterface() : EntityManager.class);
|
((EntityManagerFactoryInfo) emf).getEntityManagerInterface() : EntityManager.class);
|
||||||
return createSharedEntityManager(emf, properties, synchronizedWithTransaction,
|
return createSharedEntityManager(emf, properties, synchronizedWithTransaction,
|
||||||
(entityManagerInterface == null ? NO_ENTITY_MANAGER_INTERFACES :
|
(emIfc == null ? NO_ENTITY_MANAGER_INTERFACES : new Class<?>[] {emIfc}));
|
||||||
new Class<?>[] { entityManagerInterface }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<p>
|
<p>
|
||||||
Spring's O/R Mapping package: supporting Hibernate, JPA, JDO, and iBATIS SQL Maps.
|
Spring's O/R Mapping package: supporting Hibernate, JPA, and JDO.
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -37,8 +37,9 @@ import static org.junit.Assert.*;
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class OxmNamespaceHandlerTests {
|
public class OxmNamespaceHandlerTests {
|
||||||
|
|
||||||
private final ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
|
private final ApplicationContext applicationContext =
|
||||||
"oxmNamespaceHandlerTest.xml", getClass());
|
new ClassPathXmlApplicationContext("oxmNamespaceHandlerTest.xml", getClass());
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void xmlBeansMarshaller() throws Exception {
|
public void xmlBeansMarshaller() throws Exception {
|
||||||
|
@ -85,4 +86,5 @@ public class OxmNamespaceHandlerTests {
|
||||||
CastorMarshaller castorMarshaller = applicationContext.getBean("castorMappingLocationMarshaller", CastorMarshaller.class);
|
CastorMarshaller castorMarshaller = applicationContext.getBean("castorMappingLocationMarshaller", CastorMarshaller.class);
|
||||||
assertNotNull(castorMarshaller);
|
assertNotNull(castorMarshaller);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public abstract class TestPropertySourceUtils {
|
||||||
/**
|
/**
|
||||||
* The name of the {@link MapPropertySource} created from <em>inlined properties</em>.
|
* The name of the {@link MapPropertySource} created from <em>inlined properties</em>.
|
||||||
* @since 4.1.5
|
* @since 4.1.5
|
||||||
* @see {@link #addInlinedPropertiesToEnvironment(ConfigurableEnvironment, String[])}
|
* @see #addInlinedPropertiesToEnvironment
|
||||||
*/
|
*/
|
||||||
public static final String INLINED_PROPERTIES_PROPERTY_SOURCE_NAME = "Inlined Test Properties";
|
public static final String INLINED_PROPERTIES_PROPERTY_SOURCE_NAME = "Inlined Test Properties";
|
||||||
|
|
||||||
|
@ -224,8 +224,7 @@ public abstract class TestPropertySourceUtils {
|
||||||
* @see TestPropertySource#properties
|
* @see TestPropertySource#properties
|
||||||
* @see #addInlinedPropertiesToEnvironment(ConfigurableEnvironment, String[])
|
* @see #addInlinedPropertiesToEnvironment(ConfigurableEnvironment, String[])
|
||||||
*/
|
*/
|
||||||
public static void addInlinedPropertiesToEnvironment(ConfigurableApplicationContext context,
|
public static void addInlinedPropertiesToEnvironment(ConfigurableApplicationContext context, String... inlinedProperties) {
|
||||||
String... inlinedProperties) {
|
|
||||||
Assert.notNull(context, "context must not be null");
|
Assert.notNull(context, "context must not be null");
|
||||||
Assert.notNull(inlinedProperties, "inlinedProperties must not be null");
|
Assert.notNull(inlinedProperties, "inlinedProperties must not be null");
|
||||||
addInlinedPropertiesToEnvironment(context.getEnvironment(), inlinedProperties);
|
addInlinedPropertiesToEnvironment(context.getEnvironment(), inlinedProperties);
|
||||||
|
@ -252,13 +251,11 @@ public abstract class TestPropertySourceUtils {
|
||||||
Assert.notNull(inlinedProperties, "inlinedProperties must not be null");
|
Assert.notNull(inlinedProperties, "inlinedProperties must not be null");
|
||||||
if (!ObjectUtils.isEmpty(inlinedProperties)) {
|
if (!ObjectUtils.isEmpty(inlinedProperties)) {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Adding inlined properties to environment: "
|
logger.debug("Adding inlined properties to environment: " + ObjectUtils.nullSafeToString(inlinedProperties));
|
||||||
+ ObjectUtils.nullSafeToString(inlinedProperties));
|
|
||||||
}
|
}
|
||||||
MapPropertySource ps = (MapPropertySource) environment.getPropertySources().get(INLINED_PROPERTIES_PROPERTY_SOURCE_NAME);
|
MapPropertySource ps = (MapPropertySource) environment.getPropertySources().get(INLINED_PROPERTIES_PROPERTY_SOURCE_NAME);
|
||||||
if (ps == null) {
|
if (ps == null) {
|
||||||
ps = new MapPropertySource(INLINED_PROPERTIES_PROPERTY_SOURCE_NAME,
|
ps = new MapPropertySource(INLINED_PROPERTIES_PROPERTY_SOURCE_NAME, new LinkedHashMap<String, Object>());
|
||||||
new LinkedHashMap<String, Object>());
|
|
||||||
environment.getPropertySources().addFirst(ps);
|
environment.getPropertySources().addFirst(ps);
|
||||||
}
|
}
|
||||||
ps.getSource().putAll(convertInlinedPropertiesToMap(inlinedProperties));
|
ps.getSource().putAll(convertInlinedPropertiesToMap(inlinedProperties));
|
||||||
|
@ -285,21 +282,19 @@ public abstract class TestPropertySourceUtils {
|
||||||
public static Map<String, Object> convertInlinedPropertiesToMap(String... inlinedProperties) {
|
public static Map<String, Object> convertInlinedPropertiesToMap(String... inlinedProperties) {
|
||||||
Assert.notNull(inlinedProperties, "inlinedProperties must not be null");
|
Assert.notNull(inlinedProperties, "inlinedProperties must not be null");
|
||||||
Map<String, Object> map = new LinkedHashMap<String, Object>();
|
Map<String, Object> map = new LinkedHashMap<String, Object>();
|
||||||
|
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
|
|
||||||
for (String pair : inlinedProperties) {
|
for (String pair : inlinedProperties) {
|
||||||
if (!StringUtils.hasText(pair)) {
|
if (!StringUtils.hasText(pair)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
props.load(new StringReader(pair));
|
props.load(new StringReader(pair));
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception ex) {
|
||||||
throw new IllegalStateException("Failed to load test environment property from [" + pair + "].", e);
|
throw new IllegalStateException("Failed to load test environment property from [" + pair + "]", ex);
|
||||||
}
|
}
|
||||||
Assert.state(props.size() == 1, "Failed to load exactly one test environment property from [" + pair + "].");
|
Assert.state(props.size() == 1, "Failed to load exactly one test environment property from [" + pair + "]");
|
||||||
|
|
||||||
for (String name : props.stringPropertyNames()) {
|
for (String name : props.stringPropertyNames()) {
|
||||||
map.put(name, props.getProperty(name));
|
map.put(name, props.getProperty(name));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -124,6 +124,7 @@ public class JdbcTestUtils {
|
||||||
*/
|
*/
|
||||||
public static int deleteFromTableWhere(JdbcTemplate jdbcTemplate, String tableName, String whereClause,
|
public static int deleteFromTableWhere(JdbcTemplate jdbcTemplate, String tableName, String whereClause,
|
||||||
Object... args) {
|
Object... args) {
|
||||||
|
|
||||||
String sql = "DELETE FROM " + tableName;
|
String sql = "DELETE FROM " + tableName;
|
||||||
if (StringUtils.hasText(whereClause)) {
|
if (StringUtils.hasText(whereClause)) {
|
||||||
sql += " WHERE " + whereClause;
|
sql += " WHERE " + whereClause;
|
||||||
|
@ -170,6 +171,7 @@ public class JdbcTestUtils {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void executeSqlScript(JdbcTemplate jdbcTemplate, ResourceLoader resourceLoader,
|
public static void executeSqlScript(JdbcTemplate jdbcTemplate, ResourceLoader resourceLoader,
|
||||||
String sqlResourcePath, boolean continueOnError) throws DataAccessException {
|
String sqlResourcePath, boolean continueOnError) throws DataAccessException {
|
||||||
|
|
||||||
Resource resource = resourceLoader.getResource(sqlResourcePath);
|
Resource resource = resourceLoader.getResource(sqlResourcePath);
|
||||||
executeSqlScript(jdbcTemplate, resource, continueOnError);
|
executeSqlScript(jdbcTemplate, resource, continueOnError);
|
||||||
}
|
}
|
||||||
|
@ -197,6 +199,7 @@ public class JdbcTestUtils {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void executeSqlScript(JdbcTemplate jdbcTemplate, Resource resource, boolean continueOnError)
|
public static void executeSqlScript(JdbcTemplate jdbcTemplate, Resource resource, boolean continueOnError)
|
||||||
throws DataAccessException {
|
throws DataAccessException {
|
||||||
|
|
||||||
executeSqlScript(jdbcTemplate, new EncodedResource(resource), continueOnError);
|
executeSqlScript(jdbcTemplate, new EncodedResource(resource), continueOnError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,6 +223,7 @@ public class JdbcTestUtils {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void executeSqlScript(JdbcTemplate jdbcTemplate, EncodedResource resource, boolean continueOnError)
|
public static void executeSqlScript(JdbcTemplate jdbcTemplate, EncodedResource resource, boolean continueOnError)
|
||||||
throws DataAccessException {
|
throws DataAccessException {
|
||||||
|
|
||||||
new ResourceDatabasePopulator(continueOnError, false, resource.getEncoding(), resource.getResource()).execute(jdbcTemplate.getDataSource());
|
new ResourceDatabasePopulator(continueOnError, false, resource.getEncoding(), resource.getResource()).execute(jdbcTemplate.getDataSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,4 +292,5 @@ public class JdbcTestUtils {
|
||||||
public static void splitSqlScript(String script, char delim, List<String> statements) {
|
public static void splitSqlScript(String script, char delim, List<String> statements) {
|
||||||
ScriptUtils.splitSqlScript(script, delim, statements);
|
ScriptUtils.splitSqlScript(script, delim, statements);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,22 +23,23 @@ import org.springframework.http.HttpRequest;
|
||||||
/**
|
/**
|
||||||
* Represents the context of a client-side HTTP request execution.
|
* Represents the context of a client-side HTTP request execution.
|
||||||
*
|
*
|
||||||
* <p>Used to invoke the next interceptor in the interceptor chain, or - if the calling interceptor is last - execute
|
* <p>Used to invoke the next interceptor in the interceptor chain,
|
||||||
* the request itself.
|
* or - if the calling interceptor is last - execute the request itself.
|
||||||
*
|
*
|
||||||
* @author Arjen Poutsma
|
* @author Arjen Poutsma
|
||||||
* @see ClientHttpRequestInterceptor
|
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
|
* @see ClientHttpRequestInterceptor
|
||||||
*/
|
*/
|
||||||
public interface ClientHttpRequestExecution {
|
public interface ClientHttpRequestExecution {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the request with the given request attributes and body, and return the response.
|
* Execute the request with the given request attributes and body,
|
||||||
*
|
* and return the response.
|
||||||
* @param request the request, containing method, URI, and headers
|
* @param request the request, containing method, URI, and headers
|
||||||
* @param body the body of the request to execute
|
* @param body the body of the request to execute
|
||||||
* @return the response
|
* @return the response
|
||||||
* @throws IOException in case of I/O errors
|
* @throws IOException in case of I/O errors
|
||||||
*/
|
*/
|
||||||
ClientHttpResponse execute(HttpRequest request, byte[] body) throws IOException;
|
ClientHttpResponse execute(HttpRequest request, byte[] body) throws IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -812,7 +812,7 @@ public class Jackson2ObjectMapperBuilder {
|
||||||
return new XmlMapper(new XmlFactory(xmlInputFactory()), module);
|
return new XmlMapper(new XmlFactory(xmlInputFactory()), module);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final XMLInputFactory xmlInputFactory() {
|
private static XMLInputFactory xmlInputFactory() {
|
||||||
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
|
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
|
||||||
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
|
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
|
||||||
inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
|
inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2009 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -31,9 +31,9 @@ import javax.xml.ws.WebServiceProvider;
|
||||||
* <p>Note that this exporter will only work if the JAX-WS runtime actually
|
* <p>Note that this exporter will only work if the JAX-WS runtime actually
|
||||||
* supports publishing with an address argument, i.e. if the JAX-WS runtime
|
* supports publishing with an address argument, i.e. if the JAX-WS runtime
|
||||||
* ships an internal HTTP server. This is the case with the JAX-WS runtime
|
* ships an internal HTTP server. This is the case with the JAX-WS runtime
|
||||||
* that's inclued in Sun's JDK 1.6 but not with the standalone JAX-WS 2.1 RI.
|
* that's included in Sun's JDK 6 but not with the standalone JAX-WS 2.1 RI.
|
||||||
*
|
*
|
||||||
* <p>For explicit configuration of JAX-WS endpoints with Sun's JDK 1.6
|
* <p>For explicit configuration of JAX-WS endpoints with Sun's JDK 6
|
||||||
* HTTP server, consider using {@link SimpleHttpServerJaxWsServiceExporter}!
|
* HTTP server, consider using {@link SimpleHttpServerJaxWsServiceExporter}!
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -70,6 +70,9 @@ import org.springframework.web.multipart.MultipartRequest;
|
||||||
*/
|
*/
|
||||||
public class WebRequestDataBinder extends WebDataBinder {
|
public class WebRequestDataBinder extends WebDataBinder {
|
||||||
|
|
||||||
|
private static final boolean servlet3Parts = ClassUtils.hasMethod(HttpServletRequest.class, "getParts");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new WebRequestDataBinder instance, with default object name.
|
* Create a new WebRequestDataBinder instance, with default object name.
|
||||||
* @param target the target object to bind onto (or {@code null}
|
* @param target the target object to bind onto (or {@code null}
|
||||||
|
@ -116,7 +119,7 @@ public class WebRequestDataBinder extends WebDataBinder {
|
||||||
if (multipartRequest != null) {
|
if (multipartRequest != null) {
|
||||||
bindMultipart(multipartRequest.getMultiFileMap(), mpvs);
|
bindMultipart(multipartRequest.getMultiFileMap(), mpvs);
|
||||||
}
|
}
|
||||||
else if (ClassUtils.hasMethod(HttpServletRequest.class, "getParts")) {
|
else if (servlet3Parts) {
|
||||||
HttpServletRequest serlvetRequest = ((NativeWebRequest) request).getNativeRequest(HttpServletRequest.class);
|
HttpServletRequest serlvetRequest = ((NativeWebRequest) request).getNativeRequest(HttpServletRequest.class);
|
||||||
new Servlet3MultipartHelper(isBindEmptyMultipartFiles()).bindParts(serlvetRequest, mpvs);
|
new Servlet3MultipartHelper(isBindEmptyMultipartFiles()).bindParts(serlvetRequest, mpvs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
|
@ -122,7 +122,7 @@ public abstract class MultipartResolutionDelegate {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (parameter.getNestedParameterType() == servletPartClass) {
|
else if (servletPartClass == parameter.getNestedParameterType()) {
|
||||||
return (isMultipart ? RequestPartResolver.resolvePart(request, name) : null);
|
return (isMultipart ? RequestPartResolver.resolvePart(request, name) : null);
|
||||||
}
|
}
|
||||||
else if (isPartCollection(parameter)) {
|
else if (isPartCollection(parameter)) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ public interface HandlerInterceptor {
|
||||||
* @throws Exception in case of errors
|
* @throws Exception in case of errors
|
||||||
*/
|
*/
|
||||||
boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intercept the execution of a handler. Called after HandlerAdapter actually
|
* Intercept the execution of a handler. Called after HandlerAdapter actually
|
||||||
|
@ -114,7 +114,8 @@ public interface HandlerInterceptor {
|
||||||
* (can also be {@code null})
|
* (can also be {@code null})
|
||||||
* @throws Exception in case of errors
|
* @throws Exception in case of errors
|
||||||
*/
|
*/
|
||||||
void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView)
|
void postHandle(
|
||||||
|
HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,7 +137,8 @@ public interface HandlerInterceptor {
|
||||||
* @param ex exception thrown on handler execution, if any
|
* @param ex exception thrown on handler execution, if any
|
||||||
* @throws Exception in case of errors
|
* @throws Exception in case of errors
|
||||||
*/
|
*/
|
||||||
void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
|
void afterCompletion(
|
||||||
|
HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -51,8 +51,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
public interface LocaleResolver {
|
public interface LocaleResolver {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve the current locale via the given request. Can return a default locale as
|
* Resolve the current locale via the given request.
|
||||||
* fallback in any case.
|
* Can return a default locale as fallback in any case.
|
||||||
* @param request the request to resolve the locale for
|
* @param request the request to resolve the locale for
|
||||||
* @return the current locale (never {@code null})
|
* @return the current locale (never {@code null})
|
||||||
*/
|
*/
|
||||||
|
@ -63,8 +63,8 @@ public interface LocaleResolver {
|
||||||
* @param request the request to be used for locale modification
|
* @param request the request to be used for locale modification
|
||||||
* @param response the response to be used for locale modification
|
* @param response the response to be used for locale modification
|
||||||
* @param locale the new locale, or {@code null} to clear the locale
|
* @param locale the new locale, or {@code null} to clear the locale
|
||||||
* @throws UnsupportedOperationException if the LocaleResolver implementation does not
|
* @throws UnsupportedOperationException if the LocaleResolver
|
||||||
* support dynamic changing of the locale
|
* implementation does not support dynamic changing of the locale
|
||||||
*/
|
*/
|
||||||
void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale);
|
void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2010 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -28,9 +28,9 @@ import org.springframework.util.StringUtils;
|
||||||
*
|
*
|
||||||
* <p>This is the default implementation used by the
|
* <p>This is the default implementation used by the
|
||||||
* {@link org.springframework.web.servlet.DispatcherServlet}, along with
|
* {@link org.springframework.web.servlet.DispatcherServlet}, along with
|
||||||
* {@link org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping}
|
* {@link org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping}.
|
||||||
* (on Java 5 and higher). Alternatively, {@link SimpleUrlHandlerMapping} allows for
|
* Alternatively, {@link SimpleUrlHandlerMapping} allows for customizing a
|
||||||
* customizing a handler mapping declaratively.
|
* handler mapping declaratively.
|
||||||
*
|
*
|
||||||
* <p>The mapping is from URL to bean name. Thus an incoming URL "/foo" would map
|
* <p>The mapping is from URL to bean name. Thus an incoming URL "/foo" would map
|
||||||
* to a handler named "/foo", or to "/foo /foo2" in case of multiple mappings to
|
* to a handler named "/foo", or to "/foo /foo2" in case of multiple mappings to
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,7 +23,7 @@ import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract adapter class for the HandlerInterceptor interface,
|
* Abstract adapter class for the {@link AsyncHandlerInterceptor} interface,
|
||||||
* for simplified implementation of pre-only/post-only interceptors.
|
* for simplified implementation of pre-only/post-only interceptors.
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
|
@ -36,7 +36,8 @@ public abstract class HandlerInterceptorAdapter implements AsyncHandlerIntercept
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -34,7 +34,6 @@ import org.springframework.web.method.support.ModelAndViewContainer;
|
||||||
*
|
*
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*
|
|
||||||
* @deprecated as of 4.3 {@link DeferredResultMethodReturnValueHandler} supports
|
* @deprecated as of 4.3 {@link DeferredResultMethodReturnValueHandler} supports
|
||||||
* CompletionStage return values via an adapter mechanism.
|
* CompletionStage return values via an adapter mechanism.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -114,6 +114,7 @@ public class DeferredResultMethodReturnValueHandler implements AsyncHandlerMetho
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapter for {@code ListenableFuture} return values.
|
* Adapter for {@code ListenableFuture} return values.
|
||||||
*/
|
*/
|
||||||
|
@ -137,6 +138,7 @@ public class DeferredResultMethodReturnValueHandler implements AsyncHandlerMetho
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapter for {@code CompletionStage} return values.
|
* Adapter for {@code CompletionStage} return values.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.springframework.web.method.support.ModelAndViewContainer;
|
||||||
*
|
*
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*
|
|
||||||
* @deprecated as of 4.3 {@link DeferredResultMethodReturnValueHandler} supports
|
* @deprecated as of 4.3 {@link DeferredResultMethodReturnValueHandler} supports
|
||||||
* ListenableFuture return values via an adapter mechanism.
|
* ListenableFuture return values via an adapter mechanism.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -49,12 +49,11 @@ import org.springframework.util.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class CssLinkResourceTransformer extends ResourceTransformerSupport {
|
public class CssLinkResourceTransformer extends ResourceTransformerSupport {
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(CssLinkResourceTransformer.class);
|
|
||||||
|
|
||||||
private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.getLog(CssLinkResourceTransformer.class);
|
||||||
|
|
||||||
private final List<CssLinkParser> linkParsers = new ArrayList<CssLinkParser>();
|
private final List<CssLinkParser> linkParsers = new ArrayList<CssLinkParser>(2);
|
||||||
|
|
||||||
|
|
||||||
public CssLinkResourceTransformer() {
|
public CssLinkResourceTransformer() {
|
||||||
|
@ -81,7 +80,7 @@ public class CssLinkResourceTransformer extends ResourceTransformerSupport {
|
||||||
byte[] bytes = FileCopyUtils.copyToByteArray(resource.getInputStream());
|
byte[] bytes = FileCopyUtils.copyToByteArray(resource.getInputStream());
|
||||||
String content = new String(bytes, DEFAULT_CHARSET);
|
String content = new String(bytes, DEFAULT_CHARSET);
|
||||||
|
|
||||||
Set<CssLinkInfo> infos = new HashSet<CssLinkInfo>(5);
|
Set<CssLinkInfo> infos = new HashSet<CssLinkInfo>(8);
|
||||||
for (CssLinkParser parser : this.linkParsers) {
|
for (CssLinkParser parser : this.linkParsers) {
|
||||||
parser.parseLink(content, infos);
|
parser.parseLink(content, infos);
|
||||||
}
|
}
|
||||||
|
@ -123,17 +122,16 @@ public class CssLinkResourceTransformer extends ResourceTransformerSupport {
|
||||||
|
|
||||||
private boolean hasScheme(String link) {
|
private boolean hasScheme(String link) {
|
||||||
int schemeIndex = link.indexOf(":");
|
int schemeIndex = link.indexOf(":");
|
||||||
return (schemeIndex > 0 && !link.substring(0, schemeIndex).contains("/"))
|
return (schemeIndex > 0 && !link.substring(0, schemeIndex).contains("/")) || link.indexOf("//") == 0;
|
||||||
|| link.indexOf("//") == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected static interface CssLinkParser {
|
protected interface CssLinkParser {
|
||||||
|
|
||||||
void parseLink(String content, Set<CssLinkInfo> linkInfos);
|
void parseLink(String content, Set<CssLinkInfo> linkInfos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected static abstract class AbstractCssLinkParser implements CssLinkParser {
|
protected static abstract class AbstractCssLinkParser implements CssLinkParser {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -189,6 +187,7 @@ public class CssLinkResourceTransformer extends ResourceTransformerSupport {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class ImportStatementCssLinkParser extends AbstractCssLinkParser {
|
private static class ImportStatementCssLinkParser extends AbstractCssLinkParser {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -208,6 +207,7 @@ public class CssLinkResourceTransformer extends ResourceTransformerSupport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class UrlFunctionCssLinkParser extends AbstractCssLinkParser {
|
private static class UrlFunctionCssLinkParser extends AbstractCssLinkParser {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -229,8 +229,7 @@ public class CssLinkResourceTransformer extends ResourceTransformerSupport {
|
||||||
|
|
||||||
private final int end;
|
private final int end;
|
||||||
|
|
||||||
|
public CssLinkInfo(int start, int end) {
|
||||||
private CssLinkInfo(int start, int end) {
|
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -35,10 +35,10 @@ public interface ResourceTransformer {
|
||||||
* @param request the current request
|
* @param request the current request
|
||||||
* @param resource the resource to transform
|
* @param resource the resource to transform
|
||||||
* @param transformerChain the chain of remaining transformers to delegate to
|
* @param transformerChain the chain of remaining transformers to delegate to
|
||||||
* @return the transformed resource, never {@code null}
|
* @return the transformed resource (never {@code null})
|
||||||
* @throws IOException if the transformation fails
|
* @throws IOException if the transformation fails
|
||||||
*/
|
*/
|
||||||
Resource transform(HttpServletRequest request, Resource resource, ResourceTransformerChain transformerChain)
|
Resource transform(HttpServletRequest request, Resource resource, ResourceTransformerChain transformerChain)
|
||||||
throws IOException;
|
throws IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -54,6 +54,7 @@ public class UriTemplateServletAnnotationControllerTests {
|
||||||
|
|
||||||
private DispatcherServlet servlet;
|
private DispatcherServlet servlet;
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void simple() throws Exception {
|
public void simple() throws Exception {
|
||||||
initServlet(SimpleUriTemplateController.class);
|
initServlet(SimpleUriTemplateController.class);
|
||||||
|
@ -318,8 +319,7 @@ public class UriTemplateServletAnnotationControllerTests {
|
||||||
assertEquals("test-42", response.getContentAsString());
|
assertEquals("test-42", response.getContentAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPR-6640
|
@Test // SPR-6640
|
||||||
@Test
|
|
||||||
public void menuTree() throws Exception {
|
public void menuTree() throws Exception {
|
||||||
initServlet(MenuTreeController.class);
|
initServlet(MenuTreeController.class);
|
||||||
|
|
||||||
|
@ -329,8 +329,7 @@ public class UriTemplateServletAnnotationControllerTests {
|
||||||
assertEquals("M5", response.getContentAsString());
|
assertEquals("M5", response.getContentAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPR-6876
|
@Test // SPR-6876
|
||||||
@Test
|
|
||||||
public void variableNames() throws Exception {
|
public void variableNames() throws Exception {
|
||||||
initServlet(VariableNamesController.class);
|
initServlet(VariableNamesController.class);
|
||||||
|
|
||||||
|
@ -345,8 +344,7 @@ public class UriTemplateServletAnnotationControllerTests {
|
||||||
assertEquals("bar-bar", response.getContentAsString());
|
assertEquals("bar-bar", response.getContentAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPR-8543
|
@Test // SPR-8543
|
||||||
@Test
|
|
||||||
public void variableNamesWithUrlExtension() throws Exception {
|
public void variableNamesWithUrlExtension() throws Exception {
|
||||||
initServlet(VariableNamesController.class);
|
initServlet(VariableNamesController.class);
|
||||||
|
|
||||||
|
@ -356,8 +354,7 @@ public class UriTemplateServletAnnotationControllerTests {
|
||||||
assertEquals("foo-foo", response.getContentAsString());
|
assertEquals("foo-foo", response.getContentAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPR-9333
|
@Test // SPR-9333
|
||||||
@Test
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public void suppressDefaultSuffixPattern() throws Exception {
|
public void suppressDefaultSuffixPattern() throws Exception {
|
||||||
servlet = new DispatcherServlet() {
|
servlet = new DispatcherServlet() {
|
||||||
|
@ -381,8 +378,7 @@ public class UriTemplateServletAnnotationControllerTests {
|
||||||
assertEquals("foo-jsmith@mail.com", response.getContentAsString());
|
assertEquals("foo-jsmith@mail.com", response.getContentAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPR-6906
|
@Test // SPR-6906
|
||||||
@Test
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public void controllerClassName() throws Exception {
|
public void controllerClassName() throws Exception {
|
||||||
servlet = new DispatcherServlet() {
|
servlet = new DispatcherServlet() {
|
||||||
|
@ -416,8 +412,7 @@ public class UriTemplateServletAnnotationControllerTests {
|
||||||
assertEquals("plain-bar", response.getContentAsString());
|
assertEquals("plain-bar", response.getContentAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPR-6978
|
@Test // SPR-6978
|
||||||
@Test
|
|
||||||
public void doIt() throws Exception {
|
public void doIt() throws Exception {
|
||||||
initServlet(Spr6978Controller.class);
|
initServlet(Spr6978Controller.class);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -26,7 +26,6 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import javax.websocket.ClientEndpointConfig;
|
import javax.websocket.ClientEndpointConfig;
|
||||||
import javax.websocket.ClientEndpointConfig.Configurator;
|
import javax.websocket.ClientEndpointConfig.Configurator;
|
||||||
import javax.websocket.ContainerProvider;
|
import javax.websocket.ContainerProvider;
|
||||||
|
@ -51,7 +50,6 @@ import org.springframework.web.socket.adapter.standard.StandardWebSocketSession;
|
||||||
import org.springframework.web.socket.adapter.standard.WebSocketToStandardExtensionAdapter;
|
import org.springframework.web.socket.adapter.standard.WebSocketToStandardExtensionAdapter;
|
||||||
import org.springframework.web.socket.client.AbstractWebSocketClient;
|
import org.springframework.web.socket.client.AbstractWebSocketClient;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A WebSocketClient based on standard Java WebSocket API.
|
* A WebSocketClient based on standard Java WebSocket API.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -67,8 +67,8 @@ public class WebMvcStompEndpointRegistry implements StompEndpointRegistry {
|
||||||
org.springframework.messaging.simp.user.UserSessionRegistry userSessionRegistry,
|
org.springframework.messaging.simp.user.UserSessionRegistry userSessionRegistry,
|
||||||
TaskScheduler defaultSockJsTaskScheduler) {
|
TaskScheduler defaultSockJsTaskScheduler) {
|
||||||
|
|
||||||
Assert.notNull(webSocketHandler, "'webSocketHandler' is required ");
|
Assert.notNull(webSocketHandler, "WebSocketHandler is required ");
|
||||||
Assert.notNull(transportRegistration, "'transportRegistration' is required");
|
Assert.notNull(transportRegistration, "WebSocketTransportRegistration is required");
|
||||||
|
|
||||||
this.webSocketHandler = webSocketHandler;
|
this.webSocketHandler = webSocketHandler;
|
||||||
this.subProtocolWebSocketHandler = unwrapSubProtocolWebSocketHandler(webSocketHandler);
|
this.subProtocolWebSocketHandler = unwrapSubProtocolWebSocketHandler(webSocketHandler);
|
||||||
|
@ -87,19 +87,17 @@ public class WebMvcStompEndpointRegistry implements StompEndpointRegistry {
|
||||||
this.stompHandler.setMessageSizeLimit(transportRegistration.getMessageSizeLimit());
|
this.stompHandler.setMessageSizeLimit(transportRegistration.getMessageSizeLimit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.sockJsScheduler = defaultSockJsTaskScheduler;
|
this.sockJsScheduler = defaultSockJsTaskScheduler;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler(WebSocketHandler handler) {
|
private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler(WebSocketHandler handler) {
|
||||||
WebSocketHandler actual = WebSocketHandlerDecorator.unwrap(handler);
|
WebSocketHandler actual = WebSocketHandlerDecorator.unwrap(handler);
|
||||||
Assert.isInstanceOf(SubProtocolWebSocketHandler.class, actual, "No SubProtocolWebSocketHandler in " + handler);
|
if (!(actual instanceof SubProtocolWebSocketHandler)) {
|
||||||
|
throw new IllegalArgumentException("No SubProtocolWebSocketHandler in " + handler);
|
||||||
|
};
|
||||||
return (SubProtocolWebSocketHandler) actual;
|
return (SubProtocolWebSocketHandler) actual;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setApplicationContext(ApplicationContext applicationContext) {
|
|
||||||
this.stompHandler.setApplicationEventPublisher(applicationContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StompWebSocketEndpointRegistration addEndpoint(String... paths) {
|
public StompWebSocketEndpointRegistration addEndpoint(String... paths) {
|
||||||
|
@ -144,6 +142,11 @@ public class WebMvcStompEndpointRegistry implements StompEndpointRegistry {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setApplicationContext(ApplicationContext applicationContext) {
|
||||||
|
this.stompHandler.setApplicationEventPublisher(applicationContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a handler mapping with the mapped ViewControllers; or {@code null}
|
* Return a handler mapping with the mapped ViewControllers; or {@code null}
|
||||||
* in case of no registrations.
|
* in case of no registrations.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -193,7 +193,7 @@ public abstract class AbstractTyrusRequestUpgradeStrategy extends AbstractStanda
|
||||||
|
|
||||||
private static final Method registerMethod;
|
private static final Method registerMethod;
|
||||||
|
|
||||||
private static final Method unRegisterMethod;
|
private static final Method unregisterMethod;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
|
@ -204,7 +204,7 @@ public abstract class AbstractTyrusRequestUpgradeStrategy extends AbstractStanda
|
||||||
throw new IllegalStateException("Expected TyrusEndpointWrapper constructor with 9 or 10 arguments");
|
throw new IllegalStateException("Expected TyrusEndpointWrapper constructor with 9 or 10 arguments");
|
||||||
}
|
}
|
||||||
registerMethod = TyrusWebSocketEngine.class.getDeclaredMethod("register", TyrusEndpointWrapper.class);
|
registerMethod = TyrusWebSocketEngine.class.getDeclaredMethod("register", TyrusEndpointWrapper.class);
|
||||||
unRegisterMethod = TyrusWebSocketEngine.class.getDeclaredMethod("unregister", TyrusEndpointWrapper.class);
|
unregisterMethod = TyrusWebSocketEngine.class.getDeclaredMethod("unregister", TyrusEndpointWrapper.class);
|
||||||
ReflectionUtils.makeAccessible(registerMethod);
|
ReflectionUtils.makeAccessible(registerMethod);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
@ -259,7 +259,7 @@ public abstract class AbstractTyrusRequestUpgradeStrategy extends AbstractStanda
|
||||||
@Override
|
@Override
|
||||||
public void unregister(TyrusWebSocketEngine engine, Object endpoint) {
|
public void unregister(TyrusWebSocketEngine engine, Object endpoint) {
|
||||||
try {
|
try {
|
||||||
unRegisterMethod.invoke(engine, endpoint);
|
unregisterMethod.invoke(engine, endpoint);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw new HandshakeFailureException("Failed to unregister " + endpoint, ex);
|
throw new HandshakeFailureException("Failed to unregister " + endpoint, ex);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -60,7 +60,6 @@ public class WebLogicRequestUpgradeStrategy extends AbstractTyrusRequestUpgradeS
|
||||||
private static final WebLogicServletWriterHelper servletWriterHelper = new WebLogicServletWriterHelper();
|
private static final WebLogicServletWriterHelper servletWriterHelper = new WebLogicServletWriterHelper();
|
||||||
|
|
||||||
private static final Connection.CloseListener noOpCloseListener = new Connection.CloseListener() {
|
private static final Connection.CloseListener noOpCloseListener = new Connection.CloseListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close(CloseReason reason) {
|
public void close(CloseReason reason) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -54,6 +54,7 @@ public abstract class AbstractXhrTransport implements XhrTransport {
|
||||||
PRELUDE = new String(bytes, SockJsFrame.CHARSET);
|
PRELUDE = new String(bytes, SockJsFrame.CHARSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected Log logger = LogFactory.getLog(getClass());
|
protected Log logger = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
private boolean xhrStreamingDisabled;
|
private boolean xhrStreamingDisabled;
|
||||||
|
@ -137,6 +138,7 @@ public abstract class AbstractXhrTransport implements XhrTransport {
|
||||||
URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session,
|
URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session,
|
||||||
SettableListenableFuture<WebSocketSession> connectFuture);
|
SettableListenableFuture<WebSocketSession> connectFuture);
|
||||||
|
|
||||||
|
|
||||||
// InfoReceiver methods
|
// InfoReceiver methods
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -165,6 +167,7 @@ public abstract class AbstractXhrTransport implements XhrTransport {
|
||||||
|
|
||||||
protected abstract ResponseEntity<String> executeInfoRequestInternal(URI infoUrl, HttpHeaders headers);
|
protected abstract ResponseEntity<String> executeInfoRequestInternal(URI infoUrl, HttpHeaders headers);
|
||||||
|
|
||||||
|
|
||||||
// XhrTransport methods
|
// XhrTransport methods
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -184,8 +187,8 @@ public abstract class AbstractXhrTransport implements XhrTransport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract ResponseEntity<String> executeSendRequestInternal(URI url,
|
protected abstract ResponseEntity<String> executeSendRequestInternal(
|
||||||
HttpHeaders headers, TextMessage message);
|
URI url, HttpHeaders headers, TextMessage message);
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig;
|
||||||
*/
|
*/
|
||||||
public class PollingSockJsSession extends AbstractHttpSockJsSession {
|
public class PollingSockJsSession extends AbstractHttpSockJsSession {
|
||||||
|
|
||||||
|
|
||||||
public PollingSockJsSession(String sessionId, SockJsServiceConfig config,
|
public PollingSockJsSession(String sessionId, SockJsServiceConfig config,
|
||||||
WebSocketHandler wsHandler, Map<String, Object> attributes) {
|
WebSocketHandler wsHandler, Map<String, Object> attributes) {
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -21,7 +21,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
|
@ -48,9 +47,7 @@ import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractWebSocketIntegrationTests {
|
public abstract class AbstractWebSocketIntegrationTests {
|
||||||
|
|
||||||
protected Log logger = LogFactory.getLog(getClass());
|
private static Map<Class<?>, Class<?>> upgradeStrategyConfigTypes = new HashMap<>();
|
||||||
|
|
||||||
private static Map<Class<?>, Class<?>> upgradeStrategyConfigTypes = new HashMap<Class<?>, Class<?>>();
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
upgradeStrategyConfigTypes.put(JettyWebSocketTestServer.class, JettyUpgradeStrategyConfig.class);
|
upgradeStrategyConfigTypes.put(JettyWebSocketTestServer.class, JettyUpgradeStrategyConfig.class);
|
||||||
|
@ -58,6 +55,7 @@ public abstract class AbstractWebSocketIntegrationTests {
|
||||||
upgradeStrategyConfigTypes.put(UndertowTestServer.class, UndertowUpgradeStrategyConfig.class);
|
upgradeStrategyConfigTypes.put(UndertowTestServer.class, UndertowUpgradeStrategyConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public final TestName testName = new TestName();
|
public final TestName testName = new TestName();
|
||||||
|
|
||||||
|
@ -67,12 +65,13 @@ public abstract class AbstractWebSocketIntegrationTests {
|
||||||
@Parameter(1)
|
@Parameter(1)
|
||||||
public WebSocketClient webSocketClient;
|
public WebSocketClient webSocketClient;
|
||||||
|
|
||||||
|
protected final Log logger = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
protected AnnotationConfigWebApplicationContext wac;
|
protected AnnotationConfigWebApplicationContext wac;
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() throws Exception {
|
public void setup() throws Exception {
|
||||||
|
|
||||||
logger.debug("Setting up '" + this.testName.getMethodName() + "', client=" +
|
logger.debug("Setting up '" + this.testName.getMethodName() + "', client=" +
|
||||||
this.webSocketClient.getClass().getSimpleName() + ", server=" +
|
this.webSocketClient.getClass().getSimpleName() + ", server=" +
|
||||||
this.server.getClass().getSimpleName());
|
this.server.getClass().getSimpleName());
|
||||||
|
@ -155,6 +154,7 @@ public abstract class AbstractWebSocketIntegrationTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
static class TomcatUpgradeStrategyConfig extends AbstractRequestUpgradeStrategyConfig {
|
static class TomcatUpgradeStrategyConfig extends AbstractRequestUpgradeStrategyConfig {
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ public abstract class AbstractWebSocketIntegrationTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
static class UndertowUpgradeStrategyConfig extends AbstractRequestUpgradeStrategyConfig {
|
static class UndertowUpgradeStrategyConfig extends AbstractRequestUpgradeStrategyConfig {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -46,9 +46,10 @@ import static org.junit.Assert.*;
|
||||||
* Client and server-side WebSocket integration tests.
|
* Client and server-side WebSocket integration tests.
|
||||||
*
|
*
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
|
* @author Juergen Hoeller
|
||||||
*/
|
*/
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests {
|
public class WebSocketHandshakeTests extends AbstractWebSocketIntegrationTests {
|
||||||
|
|
||||||
@Parameters(name = "server [{0}], client [{1}]")
|
@Parameters(name = "server [{0}], client [{1}]")
|
||||||
public static Iterable<Object[]> arguments() {
|
public static Iterable<Object[]> arguments() {
|
||||||
|
@ -62,7 +63,7 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTest
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<?>[] getAnnotatedConfigClasses() {
|
protected Class<?>[] getAnnotatedConfigClasses() {
|
||||||
return new Class<?>[] { TestConfig.class };
|
return new Class<?>[] {TestConfig.class};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -75,11 +76,8 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTest
|
||||||
session.close();
|
session.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPR-12727
|
@Test // SPR-12727
|
||||||
|
|
||||||
@Test
|
|
||||||
public void unsolicitedPongWithEmptyPayload() throws Exception {
|
public void unsolicitedPongWithEmptyPayload() throws Exception {
|
||||||
|
|
||||||
String url = getWsBaseUrl() + "/ws";
|
String url = getWsBaseUrl() + "/ws";
|
||||||
WebSocketSession session = this.webSocketClient.doHandshake(new AbstractWebSocketHandler() {}, url).get();
|
WebSocketSession session = this.webSocketClient.doHandshake(new AbstractWebSocketHandler() {}, url).get();
|
||||||
|
|
||||||
|
@ -126,7 +124,6 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTest
|
||||||
|
|
||||||
private Throwable transportError;
|
private Throwable transportError;
|
||||||
|
|
||||||
|
|
||||||
public void setWaitMessageCount(int waitMessageCount) {
|
public void setWaitMessageCount(int waitMessageCount) {
|
||||||
this.waitMessageCount = waitMessageCount;
|
this.waitMessageCount = waitMessageCount;
|
||||||
}
|
}
|
Loading…
Reference in New Issue