Polishing
This commit is contained in:
parent
12978b8185
commit
c752ba5b38
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -22,7 +22,6 @@ import org.springframework.aop.Pointcut;
|
||||||
import org.springframework.aop.PointcutAdvisor;
|
import org.springframework.aop.PointcutAdvisor;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ObjectUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AspectJPointcutAdvisor that adapts an {@link AbstractAspectJAdvice}
|
* AspectJPointcutAdvisor that adapts an {@link AbstractAspectJAdvice}
|
||||||
|
|
@ -51,11 +50,11 @@ public class AspectJPointcutAdvisor implements PointcutAdvisor, Ordered {
|
||||||
this.pointcut = advice.buildSafePointcut();
|
this.pointcut = advice.buildSafePointcut();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setOrder(int order) {
|
public void setOrder(int order) {
|
||||||
this.order = order;
|
this.order = order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPerInstance() {
|
public boolean isPerInstance() {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -91,12 +90,12 @@ public class AspectJPointcutAdvisor implements PointcutAdvisor, Ordered {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AspectJPointcutAdvisor otherAdvisor = (AspectJPointcutAdvisor) other;
|
AspectJPointcutAdvisor otherAdvisor = (AspectJPointcutAdvisor) other;
|
||||||
return (ObjectUtils.nullSafeEquals(this.advice, otherAdvisor.advice));
|
return this.advice.equals(otherAdvisor.advice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return AspectJPointcutAdvisor.class.hashCode();
|
return AspectJPointcutAdvisor.class.hashCode() * 29 + this.advice.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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,8 +21,8 @@ import org.springframework.beans.factory.BeanFactory;
|
||||||
import org.springframework.beans.factory.BeanFactoryAware;
|
import org.springframework.beans.factory.BeanFactoryAware;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ClassUtils;
|
import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of {@link AspectInstanceFactory} that locates the aspect from the
|
* Implementation of {@link AspectInstanceFactory} that locates the aspect from the
|
||||||
|
|
@ -50,9 +50,7 @@ public class SimpleBeanFactoryAwareAspectInstanceFactory implements AspectInstan
|
||||||
@Override
|
@Override
|
||||||
public void setBeanFactory(BeanFactory beanFactory) {
|
public void setBeanFactory(BeanFactory beanFactory) {
|
||||||
this.beanFactory = beanFactory;
|
this.beanFactory = beanFactory;
|
||||||
if (!StringUtils.hasText(this.aspectBeanName)) {
|
Assert.notNull(this.aspectBeanName, "'aspectBeanName' is required");
|
||||||
throw new IllegalArgumentException("'aspectBeanName' is required");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -89,7 +89,7 @@ public abstract class ScopedProxyUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the bean name that is used within the scoped proxy to reference the target bean.
|
* Generate the bean name that is used within the scoped proxy to reference the target bean.
|
||||||
* @param originalBeanName the original name of bean
|
* @param originalBeanName the original name of bean
|
||||||
* @return the generated bean to be used to reference the target bean
|
* @return the generated bean to be used to reference the target bean
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -76,8 +76,7 @@ public class BeanComponentDefinition extends BeanDefinitionHolder implements Com
|
||||||
List<BeanDefinition> innerBeans = new ArrayList<BeanDefinition>();
|
List<BeanDefinition> innerBeans = new ArrayList<BeanDefinition>();
|
||||||
List<BeanReference> references = new ArrayList<BeanReference>();
|
List<BeanReference> references = new ArrayList<BeanReference>();
|
||||||
PropertyValues propertyValues = beanDefinition.getPropertyValues();
|
PropertyValues propertyValues = beanDefinition.getPropertyValues();
|
||||||
for (int i = 0; i < propertyValues.getPropertyValues().length; i++) {
|
for (PropertyValue propertyValue : propertyValues.getPropertyValues()) {
|
||||||
PropertyValue propertyValue = propertyValues.getPropertyValues()[i];
|
|
||||||
Object value = propertyValue.getValue();
|
Object value = propertyValue.getValue();
|
||||||
if (value instanceof BeanDefinitionHolder) {
|
if (value instanceof BeanDefinitionHolder) {
|
||||||
innerBeans.add(((BeanDefinitionHolder) value).getBeanDefinition());
|
innerBeans.add(((BeanDefinitionHolder) value).getBeanDefinition());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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,7 +54,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the {@link CacheManager} that this instance use.
|
* Return the {@link CacheManager} that this instance uses.
|
||||||
*/
|
*/
|
||||||
public CacheManager getCacheManager() {
|
public CacheManager getCacheManager() {
|
||||||
return this.cacheManager;
|
return this.cacheManager;
|
||||||
|
|
@ -62,7 +62,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.notNull(this.cacheManager, "CacheManager must not be null");
|
Assert.notNull(this.cacheManager, "CacheManager is required");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -75,7 +75,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
|
||||||
else {
|
else {
|
||||||
Collection<Cache> result = new ArrayList<Cache>();
|
Collection<Cache> result = new ArrayList<Cache>();
|
||||||
for (String cacheName : cacheNames) {
|
for (String cacheName : cacheNames) {
|
||||||
Cache cache = this.cacheManager.getCache(cacheName);
|
Cache cache = getCacheManager().getCache(cacheName);
|
||||||
if (cache == null) {
|
if (cache == null) {
|
||||||
throw new IllegalArgumentException("Cannot find cache named '" +
|
throw new IllegalArgumentException("Cannot find cache named '" +
|
||||||
cacheName + "' for " + context.getOperation());
|
cacheName + "' for " + context.getOperation());
|
||||||
|
|
@ -91,7 +91,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
|
||||||
* <p>It is acceptable to return {@code null} to indicate that no cache could
|
* <p>It is acceptable to return {@code null} to indicate that no cache could
|
||||||
* be resolved for this invocation.
|
* be resolved for this invocation.
|
||||||
* @param context the context of the particular invocation
|
* @param context the context of the particular invocation
|
||||||
* @return the cache name(s) to resolve or {@code null} if no cache should be resolved
|
* @return the cache name(s) to resolve, or {@code null} if no cache should be resolved
|
||||||
*/
|
*/
|
||||||
protected abstract Collection<String> getCacheNames(CacheOperationInvocationContext<?> context);
|
protected abstract Collection<String> getCacheNames(CacheOperationInvocationContext<?> context);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.cache.interceptor;
|
package org.springframework.cache.interceptor;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@ -34,13 +33,15 @@ public class NamedCacheResolver extends AbstractCacheResolver {
|
||||||
|
|
||||||
private Collection<String> cacheNames;
|
private Collection<String> cacheNames;
|
||||||
|
|
||||||
|
|
||||||
|
public NamedCacheResolver() {
|
||||||
|
}
|
||||||
|
|
||||||
public NamedCacheResolver(CacheManager cacheManager, String... cacheNames) {
|
public NamedCacheResolver(CacheManager cacheManager, String... cacheNames) {
|
||||||
super(cacheManager);
|
super(cacheManager);
|
||||||
this.cacheNames = new ArrayList<String>(Arrays.asList(cacheNames));
|
this.cacheNames = new ArrayList<String>(Arrays.asList(cacheNames));
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamedCacheResolver() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the cache name(s) that this resolver should use.
|
* Set the cache name(s) that this resolver should use.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2017 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.
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package org.springframework.cache.support;
|
package org.springframework.cache.support;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.springframework.cache.Cache;
|
import org.springframework.cache.Cache;
|
||||||
|
|
||||||
|
|
@ -29,7 +30,7 @@ import org.springframework.cache.Cache;
|
||||||
*/
|
*/
|
||||||
public class SimpleCacheManager extends AbstractCacheManager {
|
public class SimpleCacheManager extends AbstractCacheManager {
|
||||||
|
|
||||||
private Collection<? extends Cache> caches;
|
private Collection<? extends Cache> caches = Collections.emptySet();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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,7 +51,9 @@ public class TypeMismatchNamingException extends NamingException {
|
||||||
/**
|
/**
|
||||||
* Construct a new TypeMismatchNamingException.
|
* Construct a new TypeMismatchNamingException.
|
||||||
* @param explanation the explanation text
|
* @param explanation the explanation text
|
||||||
|
* @deprecated as of Spring Framework 4.3.10
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public TypeMismatchNamingException(String explanation) {
|
public TypeMismatchNamingException(String explanation) {
|
||||||
super(explanation);
|
super(explanation);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 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,8 +49,8 @@ public class ScopedProxyTests {
|
||||||
private static final ClassPathResource OVERRIDE_CONTEXT = new ClassPathResource(CLASSNAME + "-override.xml", CLASS);
|
private static final ClassPathResource OVERRIDE_CONTEXT = new ClassPathResource(CLASSNAME + "-override.xml", CLASS);
|
||||||
private static final ClassPathResource TESTBEAN_CONTEXT = new ClassPathResource(CLASSNAME + "-testbean.xml", CLASS);
|
private static final ClassPathResource TESTBEAN_CONTEXT = new ClassPathResource(CLASSNAME + "-testbean.xml", CLASS);
|
||||||
|
|
||||||
/* SPR-2108 */
|
|
||||||
@Test
|
@Test // SPR-2108
|
||||||
public void testProxyAssignable() throws Exception {
|
public void testProxyAssignable() throws Exception {
|
||||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(MAP_CONTEXT);
|
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(MAP_CONTEXT);
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,16 @@
|
||||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
|
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
|
||||||
|
|
||||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean" scope="request">
|
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean" scope="request">
|
||||||
<aop:scoped-proxy proxy-target-class="false"/>
|
<aop:scoped-proxy proxy-target-class="false"/>
|
||||||
<property name="age" value="99"/>
|
<property name="age" value="99"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean class="org.springframework.beans.factory.config.PropertyOverrideConfigurer">
|
<bean class="org.springframework.beans.factory.config.PropertyOverrideConfigurer">
|
||||||
<property name="properties">
|
<property name="properties">
|
||||||
<map>
|
<map>
|
||||||
<entry key="testBean.sex" value="male"/>
|
<entry key="testBean.sex" value="male"/>
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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,7 @@ public class PathResource extends AbstractResource implements WritableResource {
|
||||||
* Create a new PathResource from a Path handle.
|
* Create a new PathResource from a Path handle.
|
||||||
* <p>Note: Unlike {@link FileSystemResource}, when building relative resources
|
* <p>Note: Unlike {@link FileSystemResource}, when building relative resources
|
||||||
* via {@link #createRelative}, the relative path will be built <i>underneath</i>
|
* via {@link #createRelative}, the relative path will be built <i>underneath</i>
|
||||||
* the given root:
|
* the given root: e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"!
|
||||||
* e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"!
|
|
||||||
* @param path a Path handle
|
* @param path a Path handle
|
||||||
*/
|
*/
|
||||||
public PathResource(Path path) {
|
public PathResource(Path path) {
|
||||||
|
|
@ -64,8 +63,7 @@ public class PathResource extends AbstractResource implements WritableResource {
|
||||||
* Create a new PathResource from a Path handle.
|
* Create a new PathResource from a Path handle.
|
||||||
* <p>Note: Unlike {@link FileSystemResource}, when building relative resources
|
* <p>Note: Unlike {@link FileSystemResource}, when building relative resources
|
||||||
* via {@link #createRelative}, the relative path will be built <i>underneath</i>
|
* via {@link #createRelative}, the relative path will be built <i>underneath</i>
|
||||||
* the given root:
|
* the given root: e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"!
|
||||||
* e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"!
|
|
||||||
* @param path a path
|
* @param path a path
|
||||||
* @see java.nio.file.Paths#get(String, String...)
|
* @see java.nio.file.Paths#get(String, String...)
|
||||||
*/
|
*/
|
||||||
|
|
@ -78,8 +76,7 @@ public class PathResource extends AbstractResource implements WritableResource {
|
||||||
* Create a new PathResource from a Path handle.
|
* Create a new PathResource from a Path handle.
|
||||||
* <p>Note: Unlike {@link FileSystemResource}, when building relative resources
|
* <p>Note: Unlike {@link FileSystemResource}, when building relative resources
|
||||||
* via {@link #createRelative}, the relative path will be built <i>underneath</i>
|
* via {@link #createRelative}, the relative path will be built <i>underneath</i>
|
||||||
* the given root:
|
* the given root: e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"!
|
||||||
* e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"!
|
|
||||||
* @see java.nio.file.Paths#get(URI)
|
* @see java.nio.file.Paths#get(URI)
|
||||||
* @param uri a path URI
|
* @param uri a path URI
|
||||||
*/
|
*/
|
||||||
|
|
@ -184,7 +181,7 @@ public class PathResource extends AbstractResource implements WritableResource {
|
||||||
catch (UnsupportedOperationException ex) {
|
catch (UnsupportedOperationException ex) {
|
||||||
// Only paths on the default file system can be converted to a File:
|
// Only paths on the default file system can be converted to a File:
|
||||||
// Do exception translation for cases where conversion is not possible.
|
// Do exception translation for cases where conversion is not possible.
|
||||||
throw new FileNotFoundException(this.path + " cannot be resolved to " + "absolute file path");
|
throw new FileNotFoundException(this.path + " cannot be resolved to absolute file path");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,11 +201,11 @@ public class PathResource extends AbstractResource implements WritableResource {
|
||||||
public long lastModified() throws IOException {
|
public long lastModified() throws IOException {
|
||||||
// We can not use the superclass method since it uses conversion to a File and
|
// We can not use the superclass method since it uses conversion to a File and
|
||||||
// only a Path on the default file system can be converted to a File...
|
// only a Path on the default file system can be converted to a File...
|
||||||
return Files.getLastModifiedTime(path).toMillis();
|
return Files.getLastModifiedTime(this.path).toMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This implementation creates a FileResource, applying the given path
|
* This implementation creates a PathResource, applying the given path
|
||||||
* relative to the path of the underlying file of this resource descriptor.
|
* relative to the path of the underlying file of this resource descriptor.
|
||||||
* @see java.nio.file.Path#resolve(String)
|
* @see java.nio.file.Path#resolve(String)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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,17 +51,6 @@ class StaxResult extends SAXResult {
|
||||||
private XMLStreamWriter streamWriter;
|
private XMLStreamWriter streamWriter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct a new instance of the {@code StaxResult} with the specified {@code XMLStreamWriter}.
|
|
||||||
* @param streamWriter the {@code XMLStreamWriter} to write to
|
|
||||||
*/
|
|
||||||
public StaxResult(XMLStreamWriter streamWriter) {
|
|
||||||
StaxStreamHandler handler = new StaxStreamHandler(streamWriter);
|
|
||||||
super.setHandler(handler);
|
|
||||||
super.setLexicalHandler(handler);
|
|
||||||
this.streamWriter = streamWriter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new instance of the {@code StaxResult} with the specified {@code XMLEventWriter}.
|
* Construct a new instance of the {@code StaxResult} with the specified {@code XMLEventWriter}.
|
||||||
* @param eventWriter the {@code XMLEventWriter} to write to
|
* @param eventWriter the {@code XMLEventWriter} to write to
|
||||||
|
|
@ -73,10 +62,22 @@ class StaxResult extends SAXResult {
|
||||||
this.eventWriter = eventWriter;
|
this.eventWriter = eventWriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new instance of the {@code StaxResult} with the specified {@code XMLStreamWriter}.
|
||||||
|
* @param streamWriter the {@code XMLStreamWriter} to write to
|
||||||
|
*/
|
||||||
|
public StaxResult(XMLStreamWriter streamWriter) {
|
||||||
|
StaxStreamHandler handler = new StaxStreamHandler(streamWriter);
|
||||||
|
super.setHandler(handler);
|
||||||
|
super.setLexicalHandler(handler);
|
||||||
|
this.streamWriter = streamWriter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the {@code XMLEventWriter} used by this {@code StaxResult}. If this {@code StaxResult}
|
* Return the {@code XMLEventWriter} used by this {@code StaxResult}.
|
||||||
* was created with an {@code XMLStreamWriter}, the result will be {@code null}.
|
* <p>If this {@code StaxResult} was created with an {@code XMLStreamWriter},
|
||||||
|
* the result will be {@code null}.
|
||||||
* @return the StAX event writer used by this result
|
* @return the StAX event writer used by this result
|
||||||
* @see #StaxResult(javax.xml.stream.XMLEventWriter)
|
* @see #StaxResult(javax.xml.stream.XMLEventWriter)
|
||||||
*/
|
*/
|
||||||
|
|
@ -85,8 +86,9 @@ class StaxResult extends SAXResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the {@code XMLStreamWriter} used by this {@code StaxResult}. If this {@code StaxResult}
|
* Return the {@code XMLStreamWriter} used by this {@code StaxResult}.
|
||||||
* was created with an {@code XMLEventConsumer}, the result will be {@code null}.
|
* <p>If this {@code StaxResult} was created with an {@code XMLEventConsumer},
|
||||||
|
* the result will be {@code null}.
|
||||||
* @return the StAX stream writer used by this result
|
* @return the StAX stream writer used by this result
|
||||||
* @see #StaxResult(javax.xml.stream.XMLStreamWriter)
|
* @see #StaxResult(javax.xml.stream.XMLStreamWriter)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 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.
|
||||||
|
|
@ -50,18 +50,6 @@ class StaxSource extends SAXSource {
|
||||||
private XMLStreamReader streamReader;
|
private XMLStreamReader streamReader;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct a new instance of the {@code StaxSource} with the specified {@code XMLStreamReader}.
|
|
||||||
* The supplied stream reader must be in {@code XMLStreamConstants.START_DOCUMENT} or
|
|
||||||
* {@code XMLStreamConstants.START_ELEMENT} state.
|
|
||||||
* @param streamReader the {@code XMLStreamReader} to read from
|
|
||||||
* @throws IllegalStateException if the reader is not at the start of a document or element
|
|
||||||
*/
|
|
||||||
StaxSource(XMLStreamReader streamReader) {
|
|
||||||
super(new StaxStreamXMLReader(streamReader), new InputSource());
|
|
||||||
this.streamReader = streamReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new instance of the {@code StaxSource} with the specified {@code XMLEventReader}.
|
* Construct a new instance of the {@code StaxSource} with the specified {@code XMLEventReader}.
|
||||||
* The supplied event reader must be in {@code XMLStreamConstants.START_DOCUMENT} or
|
* The supplied event reader must be in {@code XMLStreamConstants.START_DOCUMENT} or
|
||||||
|
|
@ -74,10 +62,23 @@ class StaxSource extends SAXSource {
|
||||||
this.eventReader = eventReader;
|
this.eventReader = eventReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new instance of the {@code StaxSource} with the specified {@code XMLStreamReader}.
|
||||||
|
* The supplied stream reader must be in {@code XMLStreamConstants.START_DOCUMENT} or
|
||||||
|
* {@code XMLStreamConstants.START_ELEMENT} state.
|
||||||
|
* @param streamReader the {@code XMLStreamReader} to read from
|
||||||
|
* @throws IllegalStateException if the reader is not at the start of a document or element
|
||||||
|
*/
|
||||||
|
StaxSource(XMLStreamReader streamReader) {
|
||||||
|
super(new StaxStreamXMLReader(streamReader), new InputSource());
|
||||||
|
this.streamReader = streamReader;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the {@code XMLEventReader} used by this {@code StaxSource}. If this {@code StaxSource}
|
* Return the {@code XMLEventReader} used by this {@code StaxSource}.
|
||||||
* was created with an {@code XMLStreamReader}, the result will be {@code null}.
|
* <p>If this {@code StaxSource} was created with an {@code XMLStreamReader},
|
||||||
|
* the result will be {@code null}.
|
||||||
* @return the StAX event reader used by this source
|
* @return the StAX event reader used by this source
|
||||||
* @see StaxSource#StaxSource(javax.xml.stream.XMLEventReader)
|
* @see StaxSource#StaxSource(javax.xml.stream.XMLEventReader)
|
||||||
*/
|
*/
|
||||||
|
|
@ -86,8 +87,9 @@ class StaxSource extends SAXSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the {@code XMLStreamReader} used by this {@code StaxSource}. If this {@code StaxSource}
|
* Return the {@code XMLStreamReader} used by this {@code StaxSource}.
|
||||||
* was created with an {@code XMLEventReader}, the result will be {@code null}.
|
* <p>If this {@code StaxSource} was created with an {@code XMLEventReader},
|
||||||
|
* the result will be {@code null}.
|
||||||
* @return the StAX event reader used by this source
|
* @return the StAX event reader used by this source
|
||||||
* @see StaxSource#StaxSource(javax.xml.stream.XMLEventReader)
|
* @see StaxSource#StaxSource(javax.xml.stream.XMLEventReader)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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 org.springframework.expression.spel.SpelEvaluationException;
|
||||||
import org.springframework.expression.spel.SpelMessage;
|
import org.springframework.expression.spel.SpelMessage;
|
||||||
import org.springframework.expression.spel.support.BooleanTypedValue;
|
import org.springframework.expression.spel.support.BooleanTypedValue;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The operator 'instanceof' checks if an object is of the class specified in the right
|
* The operator 'instanceof' checks if an object is of the class specified in the right
|
||||||
* hand operand, in the same way that {@code instanceof} does in Java.
|
* hand operand, in the same way that {@code instanceof} does in Java.
|
||||||
|
|
@ -38,6 +37,7 @@ public class OperatorInstanceof extends Operator {
|
||||||
|
|
||||||
private Class<?> type;
|
private Class<?> type;
|
||||||
|
|
||||||
|
|
||||||
public OperatorInstanceof(int pos, SpelNodeImpl... operands) {
|
public OperatorInstanceof(int pos, SpelNodeImpl... operands) {
|
||||||
super("instanceof", pos, operands);
|
super("instanceof", pos, operands);
|
||||||
}
|
}
|
||||||
|
|
@ -47,8 +47,8 @@ public class OperatorInstanceof extends Operator {
|
||||||
* Compare the left operand to see it is an instance of the type specified as the
|
* Compare the left operand to see it is an instance of the type specified as the
|
||||||
* right operand. The right operand must be a class.
|
* right operand. The right operand must be a class.
|
||||||
* @param state the expression state
|
* @param state the expression state
|
||||||
* @return true if the left operand is an instanceof of the right operand, otherwise
|
* @return {@code true} if the left operand is an instanceof of the right operand,
|
||||||
* false
|
* otherwise {@code false}
|
||||||
* @throws EvaluationException if there is a problem evaluating the expression
|
* @throws EvaluationException if there is a problem evaluating the expression
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -58,7 +58,7 @@ public class OperatorInstanceof extends Operator {
|
||||||
TypedValue right = rightOperand.getValueInternal(state);
|
TypedValue right = rightOperand.getValueInternal(state);
|
||||||
Object leftValue = left.getValue();
|
Object leftValue = left.getValue();
|
||||||
Object rightValue = right.getValue();
|
Object rightValue = right.getValue();
|
||||||
BooleanTypedValue result = null;
|
BooleanTypedValue result;
|
||||||
if (rightValue == null || !(rightValue instanceof Class)) {
|
if (rightValue == null || !(rightValue instanceof Class)) {
|
||||||
throw new SpelEvaluationException(getRightOperand().getStartPosition(),
|
throw new SpelEvaluationException(getRightOperand().getStartPosition(),
|
||||||
SpelMessage.INSTANCEOF_OPERATOR_NEEDS_CLASS_OPERAND,
|
SpelMessage.INSTANCEOF_OPERATOR_NEEDS_CLASS_OPERAND,
|
||||||
|
|
@ -96,7 +96,7 @@ public class OperatorInstanceof extends Operator {
|
||||||
mv.visitInsn(ICONST_0); // value of false
|
mv.visitInsn(ICONST_0); // value of false
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mv.visitTypeInsn(INSTANCEOF,Type.getInternalName(this.type));
|
mv.visitTypeInsn(INSTANCEOF, Type.getInternalName(this.type));
|
||||||
}
|
}
|
||||||
cf.pushDescriptor(this.exitTypeDescriptor);
|
cf.pushDescriptor(this.exitTypeDescriptor);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -38,11 +38,11 @@ public class TypeReference extends SpelNodeImpl {
|
||||||
|
|
||||||
|
|
||||||
public TypeReference(int pos, SpelNodeImpl qualifiedId) {
|
public TypeReference(int pos, SpelNodeImpl qualifiedId) {
|
||||||
this(pos,qualifiedId,0);
|
this(pos, qualifiedId, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeReference(int pos, SpelNodeImpl qualifiedId, int dims) {
|
public TypeReference(int pos, SpelNodeImpl qualifiedId, int dims) {
|
||||||
super(pos,qualifiedId);
|
super(pos, qualifiedId);
|
||||||
this.dimensions = dims;
|
this.dimensions = dims;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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,21 +23,22 @@ import java.sql.SQLException;
|
||||||
import org.springframework.jdbc.support.JdbcUtils;
|
import org.springframework.jdbc.support.JdbcUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of RowCallbackHandler. Convenient superclass for callback handlers.
|
* Implementation of {@link RowCallbackHandler}. An instance can only be used once.
|
||||||
* An instance can only be used once.
|
|
||||||
*
|
*
|
||||||
* <p>We can either use this on its own (for example, in a test case, to ensure
|
* <p>We can either use this on its own (for example, in a test case, to ensure
|
||||||
* that our result sets have valid dimensions), or use it as a superclass
|
* that our result sets have valid dimensions), or use it as a superclass for
|
||||||
* for callback handlers that actually do something, and will benefit
|
* callback handlers that actually do something, and will benefit from the
|
||||||
* from the dimension information it provides.
|
* dimension information it provides.
|
||||||
*
|
*
|
||||||
* <p>A usage example with JdbcTemplate:
|
* <p>A usage example with {@link JdbcTemplate}:
|
||||||
*
|
*
|
||||||
* <pre class="code">JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); // reusable object
|
* <pre class="code">
|
||||||
|
* JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); // reusable object
|
||||||
*
|
*
|
||||||
* RowCountCallbackHandler countCallback = new RowCountCallbackHandler(); // not reusable
|
* RowCountCallbackHandler countCallback = new RowCountCallbackHandler(); // not reusable
|
||||||
* jdbcTemplate.query("select * from user", countCallback);
|
* jdbcTemplate.query("select * from user", countCallback);
|
||||||
* int rowCount = countCallback.getRowCount();</pre>
|
* int rowCount = countCallback.getRowCount();
|
||||||
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
* @since May 3, 2001
|
* @since May 3, 2001
|
||||||
|
|
@ -63,7 +64,6 @@ public class RowCountCallbackHandler implements RowCallbackHandler {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of ResultSetCallbackHandler.
|
|
||||||
* Work out column size if this is the first row, otherwise just count rows.
|
* Work out column size if this is the first row, otherwise just count rows.
|
||||||
* <p>Subclasses can perform custom extraction or processing
|
* <p>Subclasses can perform custom extraction or processing
|
||||||
* by overriding the {@code processRow(ResultSet, int)} method.
|
* by overriding the {@code processRow(ResultSet, int)} method.
|
||||||
|
|
@ -103,7 +103,7 @@ public class RowCountCallbackHandler implements RowCallbackHandler {
|
||||||
* <b>Indexed from 0 to n-1.</b>
|
* <b>Indexed from 0 to n-1.</b>
|
||||||
*/
|
*/
|
||||||
public final int[] getColumnTypes() {
|
public final int[] getColumnTypes() {
|
||||||
return columnTypes;
|
return this.columnTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -113,7 +113,7 @@ public class RowCountCallbackHandler implements RowCallbackHandler {
|
||||||
* <b>Indexed from 0 to n-1.</b>
|
* <b>Indexed from 0 to n-1.</b>
|
||||||
*/
|
*/
|
||||||
public final String[] getColumnNames() {
|
public final String[] getColumnNames() {
|
||||||
return columnNames;
|
return this.columnNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -122,7 +122,7 @@ public class RowCountCallbackHandler implements RowCallbackHandler {
|
||||||
* @return the number of rows in this ResultSet
|
* @return the number of rows in this ResultSet
|
||||||
*/
|
*/
|
||||||
public final int getRowCount() {
|
public final int getRowCount() {
|
||||||
return rowCount;
|
return this.rowCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -132,7 +132,7 @@ public class RowCountCallbackHandler implements RowCallbackHandler {
|
||||||
* @return the number of columns in this result set
|
* @return the number of columns in this result set
|
||||||
*/
|
*/
|
||||||
public final int getColumnCount() {
|
public final int getColumnCount() {
|
||||||
return columnCount;
|
return this.columnCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -47,13 +47,13 @@ public class TableMetaDataContext {
|
||||||
/** Logger available to subclasses */
|
/** Logger available to subclasses */
|
||||||
protected final Log logger = LogFactory.getLog(getClass());
|
protected final Log logger = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
/** name of table for this context **/
|
/** Name of table for this context */
|
||||||
private String tableName;
|
private String tableName;
|
||||||
|
|
||||||
/** name of catalog for this context **/
|
/** Name of catalog for this context */
|
||||||
private String catalogName;
|
private String catalogName;
|
||||||
|
|
||||||
/** name of schema for this context **/
|
/** Name of schema for this context */
|
||||||
private String schemaName;
|
private String schemaName;
|
||||||
|
|
||||||
/** List of columns objects to be used in this context */
|
/** List of columns objects to be used in this context */
|
||||||
|
|
@ -153,40 +153,6 @@ public class TableMetaDataContext {
|
||||||
return this.tableColumns;
|
return this.tableColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Does this database support the JDBC 3.0 feature of retrieving generated keys
|
|
||||||
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
|
|
||||||
*/
|
|
||||||
public boolean isGetGeneratedKeysSupported() {
|
|
||||||
return this.metaDataProvider.isGetGeneratedKeysSupported();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Does this database support simple query to retrieve generated keys
|
|
||||||
* when the JDBC 3.0 feature is not supported.
|
|
||||||
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
|
|
||||||
*/
|
|
||||||
public boolean isGetGeneratedKeysSimulated() {
|
|
||||||
return this.metaDataProvider.isGetGeneratedKeysSimulated();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Does this database support simple query to retrieve generated keys
|
|
||||||
* when the JDBC 3.0 feature is not supported.
|
|
||||||
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
|
|
||||||
*/
|
|
||||||
public String getSimulationQueryForGetGeneratedKey(String tableName, String keyColumnName) {
|
|
||||||
return this.metaDataProvider.getSimpleQueryForGetGeneratedKey(tableName, keyColumnName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is a column name String array for retrieving generated keys supported?
|
|
||||||
* {@link java.sql.Connection#createStruct(String, Object[])}?
|
|
||||||
*/
|
|
||||||
public boolean isGeneratedKeysColumnNameArraySupported() {
|
|
||||||
return this.metaDataProvider.isGeneratedKeysColumnNameArraySupported();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set {@link NativeJdbcExtractor} to be used to retrieve the native connection.
|
* Set {@link NativeJdbcExtractor} to be used to retrieve the native connection.
|
||||||
*/
|
*/
|
||||||
|
|
@ -224,7 +190,7 @@ public class TableMetaDataContext {
|
||||||
keys.add(key.toUpperCase());
|
keys.add(key.toUpperCase());
|
||||||
}
|
}
|
||||||
List<String> columns = new ArrayList<String>();
|
List<String> columns = new ArrayList<String>();
|
||||||
for (TableParameterMetaData meta : metaDataProvider.getTableParameterMetaData()) {
|
for (TableParameterMetaData meta : this.metaDataProvider.getTableParameterMetaData()) {
|
||||||
if (!keys.contains(meta.getParameterName().toUpperCase())) {
|
if (!keys.contains(meta.getParameterName().toUpperCase())) {
|
||||||
columns.add(meta.getParameterName());
|
columns.add(meta.getParameterName());
|
||||||
}
|
}
|
||||||
|
|
@ -368,4 +334,39 @@ public class TableMetaDataContext {
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does this database support the JDBC 3.0 feature of retrieving generated keys
|
||||||
|
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
|
||||||
|
*/
|
||||||
|
public boolean isGetGeneratedKeysSupported() {
|
||||||
|
return this.metaDataProvider.isGetGeneratedKeysSupported();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does this database support simple query to retrieve generated keys
|
||||||
|
* when the JDBC 3.0 feature is not supported.
|
||||||
|
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
|
||||||
|
*/
|
||||||
|
public boolean isGetGeneratedKeysSimulated() {
|
||||||
|
return this.metaDataProvider.isGetGeneratedKeysSimulated();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does this database support simple query to retrieve generated keys
|
||||||
|
* when the JDBC 3.0 feature is not supported.
|
||||||
|
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
|
||||||
|
*/
|
||||||
|
public String getSimulationQueryForGetGeneratedKey(String tableName, String keyColumnName) {
|
||||||
|
return this.metaDataProvider.getSimpleQueryForGetGeneratedKey(tableName, keyColumnName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a column name String array for retrieving generated keys supported?
|
||||||
|
* {@link java.sql.Connection#createStruct(String, Object[])}?
|
||||||
|
*/
|
||||||
|
public boolean isGeneratedKeysColumnNameArraySupported() {
|
||||||
|
return this.metaDataProvider.isGeneratedKeysColumnNameArraySupported();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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,12 +34,12 @@ import org.springframework.util.Assert;
|
||||||
* connection pool, implementing the same standard interface, but creating new
|
* connection pool, implementing the same standard interface, but creating new
|
||||||
* Connections on every call.
|
* Connections on every call.
|
||||||
*
|
*
|
||||||
* <p>In a J2EE container, it is recommended to use a JNDI DataSource provided by
|
* <p>In a Java EE container, it is recommended to use a JNDI DataSource provided by
|
||||||
* the container. Such a DataSource can be exposed as a DataSource bean in a Spring
|
* the container. Such a DataSource can be exposed as a DataSource bean in a Spring
|
||||||
* ApplicationContext via {@link org.springframework.jndi.JndiObjectFactoryBean},
|
* ApplicationContext via {@link org.springframework.jndi.JndiObjectFactoryBean},
|
||||||
* for seamless switching to and from a local DataSource bean like this class.
|
* for seamless switching to and from a local DataSource bean like this class.
|
||||||
*
|
*
|
||||||
* <p>If you need a "real" connection pool outside of a J2EE container, consider
|
* <p>If you need a "real" connection pool outside of a Java EE container, consider
|
||||||
* <a href="http://commons.apache.org/proper/commons-dbcp">Apache Commons DBCP</a>
|
* <a href="http://commons.apache.org/proper/commons-dbcp">Apache Commons DBCP</a>
|
||||||
* or <a href="http://sourceforge.net/projects/c3p0">C3P0</a>.
|
* or <a href="http://sourceforge.net/projects/c3p0">C3P0</a>.
|
||||||
* Commons DBCP's BasicDataSource and C3P0's ComboPooledDataSource are full
|
* Commons DBCP's BasicDataSource and C3P0's ComboPooledDataSource are full
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -77,10 +77,10 @@ import org.springframework.util.Assert;
|
||||||
public class TransactionAwareConnectionFactoryProxy
|
public class TransactionAwareConnectionFactoryProxy
|
||||||
implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory {
|
implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory {
|
||||||
|
|
||||||
private boolean synchedLocalTransactionAllowed = false;
|
|
||||||
|
|
||||||
private ConnectionFactory targetConnectionFactory;
|
private ConnectionFactory targetConnectionFactory;
|
||||||
|
|
||||||
|
private boolean synchedLocalTransactionAllowed = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new TransactionAwareConnectionFactoryProxy.
|
* Create a new TransactionAwareConnectionFactoryProxy.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -40,20 +40,12 @@ public class IdTimestampMessageHeaderInitializer implements MessageHeaderInitial
|
||||||
* instances with.
|
* instances with.
|
||||||
* <p>By default this property is set to {@code null} in which case the default
|
* <p>By default this property is set to {@code null} in which case the default
|
||||||
* IdGenerator of {@link org.springframework.messaging.MessageHeaders} is used.
|
* IdGenerator of {@link org.springframework.messaging.MessageHeaders} is used.
|
||||||
* <p>To have no id's generated at all, see {@link #setDisableIdGeneration()}.
|
* <p>To have no ids generated at all, see {@link #setDisableIdGeneration()}.
|
||||||
*/
|
*/
|
||||||
public void setIdGenerator(IdGenerator idGenerator) {
|
public void setIdGenerator(IdGenerator idGenerator) {
|
||||||
this.idGenerator = idGenerator;
|
this.idGenerator = idGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A shortcut for calling {@link #setIdGenerator(org.springframework.util.IdGenerator)}
|
|
||||||
* with an id generation strategy to disable id generation completely.
|
|
||||||
*/
|
|
||||||
public void setDisableIdGeneration() {
|
|
||||||
this.idGenerator = ID_VALUE_NONE_GENERATOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the configured {@code IdGenerator}, if any.
|
* Return the configured {@code IdGenerator}, if any.
|
||||||
*/
|
*/
|
||||||
|
|
@ -61,6 +53,14 @@ public class IdTimestampMessageHeaderInitializer implements MessageHeaderInitial
|
||||||
return this.idGenerator;
|
return this.idGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A shortcut for calling {@link #setIdGenerator} with an id generation strategy
|
||||||
|
* to disable id generation completely.
|
||||||
|
*/
|
||||||
|
public void setDisableIdGeneration() {
|
||||||
|
this.idGenerator = ID_VALUE_NONE_GENERATOR;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to enable the automatic addition of the
|
* Whether to enable the automatic addition of the
|
||||||
* {@link org.springframework.messaging.MessageHeaders#TIMESTAMP} header on
|
* {@link org.springframework.messaging.MessageHeaders#TIMESTAMP} header on
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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,22 +60,22 @@ public class CommAreaRecord implements Record, Streamable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecordName(String recordName) {
|
public void setRecordName(String recordName) {
|
||||||
this.recordName=recordName;
|
this.recordName = recordName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecordName() {
|
public String getRecordName() {
|
||||||
return recordName;
|
return this.recordName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecordShortDescription(String recordShortDescription) {
|
public void setRecordShortDescription(String recordShortDescription) {
|
||||||
this.recordShortDescription=recordShortDescription;
|
this.recordShortDescription = recordShortDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecordShortDescription() {
|
public String getRecordShortDescription() {
|
||||||
return recordShortDescription;
|
return this.recordShortDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 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,12 +46,13 @@ public class AsyncHttpAccessor {
|
||||||
|
|
||||||
private AsyncClientHttpRequestFactory asyncRequestFactory;
|
private AsyncClientHttpRequestFactory asyncRequestFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the request factory that this accessor uses for obtaining {@link
|
* Set the request factory that this accessor uses for obtaining {@link
|
||||||
* org.springframework.http.client.ClientHttpRequest HttpRequests}.
|
* org.springframework.http.client.ClientHttpRequest HttpRequests}.
|
||||||
*/
|
*/
|
||||||
public void setAsyncRequestFactory(AsyncClientHttpRequestFactory asyncRequestFactory) {
|
public void setAsyncRequestFactory(AsyncClientHttpRequestFactory asyncRequestFactory) {
|
||||||
Assert.notNull(asyncRequestFactory, "'asyncRequestFactory' must not be null");
|
Assert.notNull(asyncRequestFactory, "AsyncClientHttpRequestFactory must not be null");
|
||||||
this.asyncRequestFactory = asyncRequestFactory;
|
this.asyncRequestFactory = asyncRequestFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,15 +65,14 @@ public class AsyncHttpAccessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link AsyncClientHttpRequest} via this template's {@link
|
* Create a new {@link AsyncClientHttpRequest} via this template's
|
||||||
* AsyncClientHttpRequestFactory}.
|
* {@link AsyncClientHttpRequestFactory}.
|
||||||
* @param url the URL to connect to
|
* @param url the URL to connect to
|
||||||
* @param method the HTTP method to execute (GET, POST, etc.)
|
* @param method the HTTP method to execute (GET, POST, etc.)
|
||||||
* @return the created request
|
* @return the created request
|
||||||
* @throws IOException in case of I/O errors
|
* @throws IOException in case of I/O errors
|
||||||
*/
|
*/
|
||||||
protected AsyncClientHttpRequest createAsyncRequest(URI url, HttpMethod method)
|
protected AsyncClientHttpRequest createAsyncRequest(URI url, HttpMethod method) throws IOException {
|
||||||
throws IOException {
|
|
||||||
AsyncClientHttpRequest request = getAsyncRequestFactory().createAsyncRequest(url, method);
|
AsyncClientHttpRequest request = getAsyncRequestFactory().createAsyncRequest(url, method);
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Created asynchronous " + method.name() + " request for \"" + url + "\"");
|
logger.debug("Created asynchronous " + method.name() + " request for \"" + url + "\"");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -39,6 +39,7 @@ public class LiveBeansViewServlet extends HttpServlet {
|
||||||
|
|
||||||
private LiveBeansView liveBeansView;
|
private LiveBeansView liveBeansView;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws ServletException {
|
public void init() throws ServletException {
|
||||||
this.liveBeansView = buildLiveBeansView();
|
this.liveBeansView = buildLiveBeansView();
|
||||||
|
|
@ -49,7 +50,9 @@ public class LiveBeansViewServlet extends HttpServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws ServletException, IOException {
|
||||||
|
|
||||||
String content = this.liveBeansView.getSnapshotAsJson();
|
String content = this.liveBeansView.getSnapshotAsJson();
|
||||||
response.setContentType("application/json");
|
response.setContentType("application/json");
|
||||||
response.setContentLength(content.length());
|
response.setContentLength(content.length());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -65,16 +65,18 @@ public class ServletContextAttributeExporter implements ServletContextAware {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setServletContext(ServletContext servletContext) {
|
public void setServletContext(ServletContext servletContext) {
|
||||||
for (Map.Entry<String, Object> entry : attributes.entrySet()) {
|
if (this.attributes != null) {
|
||||||
String attributeName = entry.getKey();
|
for (Map.Entry<String, Object> entry : this.attributes.entrySet()) {
|
||||||
if (logger.isWarnEnabled()) {
|
String attributeName = entry.getKey();
|
||||||
if (servletContext.getAttribute(attributeName) != null) {
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("Replacing existing ServletContext attribute with name '" + attributeName + "'");
|
if (servletContext.getAttribute(attributeName) != null) {
|
||||||
|
logger.warn("Replacing existing ServletContext attribute with name '" + attributeName + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
servletContext.setAttribute(attributeName, entry.getValue());
|
||||||
|
if (logger.isInfoEnabled()) {
|
||||||
|
logger.info("Exported ServletContext attribute with name '" + attributeName + "'");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
servletContext.setAttribute(attributeName, entry.getValue());
|
|
||||||
if (logger.isInfoEnabled()) {
|
|
||||||
logger.info("Exported ServletContext attribute with name '" + attributeName + "'");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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,19 +85,17 @@ public class SessionAttributesHandler {
|
||||||
* session attributes through an {@link SessionAttributes} annotation.
|
* session attributes through an {@link SessionAttributes} annotation.
|
||||||
*/
|
*/
|
||||||
public boolean hasSessionAttributes() {
|
public boolean hasSessionAttributes() {
|
||||||
return (this.attributeNames.size() > 0 || this.attributeTypes.size() > 0);
|
return (!this.attributeNames.isEmpty() || !this.attributeTypes.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the attribute name or type match the names and types specified
|
* Whether the attribute name or type match the names and types specified
|
||||||
* via {@code @SessionAttributes} in underlying controller.
|
* via {@code @SessionAttributes} in underlying controller.
|
||||||
*
|
|
||||||
* <p>Attributes successfully resolved through this method are "remembered"
|
* <p>Attributes successfully resolved through this method are "remembered"
|
||||||
* and subsequently used in {@link #retrieveAttributes(WebRequest)} and
|
* and subsequently used in {@link #retrieveAttributes(WebRequest)} and
|
||||||
* {@link #cleanupAttributes(WebRequest)}.
|
* {@link #cleanupAttributes(WebRequest)}.
|
||||||
*
|
* @param attributeName the attribute name to check
|
||||||
* @param attributeName the attribute name to check, never {@code null}
|
* @param attributeType the type for the attribute
|
||||||
* @param attributeType the type for the attribute, possibly {@code null}
|
|
||||||
*/
|
*/
|
||||||
public boolean isHandlerSessionAttribute(String attributeName, Class<?> attributeType) {
|
public boolean isHandlerSessionAttribute(String attributeName, Class<?> attributeType) {
|
||||||
Assert.notNull(attributeName, "Attribute name must not be null");
|
Assert.notNull(attributeName, "Attribute name must not be null");
|
||||||
|
|
@ -120,7 +118,6 @@ public class SessionAttributesHandler {
|
||||||
for (String name : attributes.keySet()) {
|
for (String name : attributes.keySet()) {
|
||||||
Object value = attributes.get(name);
|
Object value = attributes.get(name);
|
||||||
Class<?> attrType = (value != null) ? value.getClass() : null;
|
Class<?> attrType = (value != null) ? value.getClass() : null;
|
||||||
|
|
||||||
if (isHandlerSessionAttribute(name, attrType)) {
|
if (isHandlerSessionAttribute(name, attrType)) {
|
||||||
this.sessionAttributeStore.storeAttribute(request, name, value);
|
this.sessionAttributeStore.storeAttribute(request, name, value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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 @@ public class RedirectViewControllerRegistration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the specific redirect 3xx status code to use.
|
* Set the specific redirect 3xx status code to use.
|
||||||
*
|
|
||||||
* <p>If not set, {@link org.springframework.web.servlet.view.RedirectView}
|
* <p>If not set, {@link org.springframework.web.servlet.view.RedirectView}
|
||||||
* will select {@code HttpStatus.MOVED_TEMPORARILY (302)} by default.
|
* will select {@code HttpStatus.MOVED_TEMPORARILY (302)} by default.
|
||||||
*/
|
*/
|
||||||
public RedirectViewControllerRegistration setStatusCode(HttpStatus statusCode) {
|
public RedirectViewControllerRegistration setStatusCode(HttpStatus statusCode) {
|
||||||
Assert.isTrue(statusCode.is3xxRedirection(), "Not a redirect status code.");
|
Assert.isTrue(statusCode.is3xxRedirection(), "Not a redirect status code");
|
||||||
this.redirectView.setStatusCode(statusCode);
|
this.redirectView.setStatusCode(statusCode);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +62,6 @@ public class RedirectViewControllerRegistration {
|
||||||
* Whether to interpret a given redirect URL that starts with a slash ("/")
|
* Whether to interpret a given redirect URL that starts with a slash ("/")
|
||||||
* as relative to the current ServletContext, i.e. as relative to the web
|
* as relative to the current ServletContext, i.e. as relative to the web
|
||||||
* application root.
|
* application root.
|
||||||
*
|
|
||||||
* <p>Default is {@code true}.
|
* <p>Default is {@code true}.
|
||||||
*/
|
*/
|
||||||
public RedirectViewControllerRegistration setContextRelative(boolean contextRelative) {
|
public RedirectViewControllerRegistration setContextRelative(boolean contextRelative) {
|
||||||
|
|
@ -74,7 +72,6 @@ public class RedirectViewControllerRegistration {
|
||||||
/**
|
/**
|
||||||
* Whether to propagate the query parameters of the current request through
|
* Whether to propagate the query parameters of the current request through
|
||||||
* to the target redirect URL.
|
* to the target redirect URL.
|
||||||
*
|
|
||||||
* <p>Default is {@code false}.
|
* <p>Default is {@code false}.
|
||||||
*/
|
*/
|
||||||
public RedirectViewControllerRegistration setKeepQueryParams(boolean propagate) {
|
public RedirectViewControllerRegistration setKeepQueryParams(boolean propagate) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -19,6 +19,7 @@ package org.springframework.web.servlet.handler;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.PathMatcher;
|
import org.springframework.util.PathMatcher;
|
||||||
import org.springframework.web.context.request.WebRequestInterceptor;
|
import org.springframework.web.context.request.WebRequestInterceptor;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
@ -99,15 +100,13 @@ public final class MappedInterceptor implements HandlerInterceptor {
|
||||||
* method. This is an advanced property that is only required when using custom
|
* method. This is an advanced property that is only required when using custom
|
||||||
* PathMatcher implementations that support mapping metadata other than the
|
* PathMatcher implementations that support mapping metadata other than the
|
||||||
* Ant-style path patterns supported by default.
|
* Ant-style path patterns supported by default.
|
||||||
*
|
|
||||||
* @param pathMatcher the path matcher to use
|
|
||||||
*/
|
*/
|
||||||
public void setPathMatcher(PathMatcher pathMatcher) {
|
public void setPathMatcher(PathMatcher pathMatcher) {
|
||||||
this.pathMatcher = pathMatcher;
|
this.pathMatcher = pathMatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configured PathMatcher, or {@code null}.
|
* The configured PathMatcher, or {@code null} if none.
|
||||||
*/
|
*/
|
||||||
public PathMatcher getPathMatcher() {
|
public PathMatcher getPathMatcher() {
|
||||||
return this.pathMatcher;
|
return this.pathMatcher;
|
||||||
|
|
@ -127,21 +126,6 @@ public final class MappedInterceptor implements HandlerInterceptor {
|
||||||
return this.interceptor;
|
return this.interceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
|
||||||
return this.interceptor.preHandle(request, response, handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
|
||||||
this.interceptor.postHandle(request, response, handler, modelAndView);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
|
||||||
this.interceptor.afterCompletion(request, response, handler, ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if the interceptor applies to the given request path.
|
* Returns {@code true} if the interceptor applies to the given request path.
|
||||||
* @param lookupPath the current request path
|
* @param lookupPath the current request path
|
||||||
|
|
@ -156,7 +140,7 @@ public final class MappedInterceptor implements HandlerInterceptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.includePatterns == null) {
|
if (ObjectUtils.isEmpty(this.includePatterns)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -168,4 +152,26 @@ public final class MappedInterceptor implements HandlerInterceptor {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
return this.interceptor.preHandle(request, response, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||||
|
ModelAndView modelAndView) throws Exception {
|
||||||
|
|
||||||
|
this.interceptor.postHandle(request, response, handler, modelAndView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||||
|
Exception ex) throws Exception {
|
||||||
|
|
||||||
|
this.interceptor.afterCompletion(request, response, handler, ex);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* 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.
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.springframework.web.socket.config.annotation;
|
|
||||||
|
|
||||||
|
package org.springframework.web.socket.config.annotation;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -44,16 +44,13 @@ public class WebSocketTransportRegistration {
|
||||||
* Configure the maximum size for an incoming sub-protocol message.
|
* Configure the maximum size for an incoming sub-protocol message.
|
||||||
* For example a STOMP message may be received as multiple WebSocket messages
|
* For example a STOMP message may be received as multiple WebSocket messages
|
||||||
* or multiple HTTP POST requests when SockJS fallback options are in use.
|
* or multiple HTTP POST requests when SockJS fallback options are in use.
|
||||||
*
|
|
||||||
* <p>In theory a WebSocket message can be almost unlimited in size.
|
* <p>In theory a WebSocket message can be almost unlimited in size.
|
||||||
* In practice WebSocket servers impose limits on incoming message size.
|
* In practice WebSocket servers impose limits on incoming message size.
|
||||||
* STOMP clients for example tend to split large messages around 16K
|
* STOMP clients for example tend to split large messages around 16K
|
||||||
* boundaries. Therefore a server must be able to buffer partial content
|
* boundaries. Therefore a server must be able to buffer partial content
|
||||||
* and decode when enough data is received. Use this property to configure
|
* and decode when enough data is received. Use this property to configure
|
||||||
* the max size of the buffer to use.
|
* the max size of the buffer to use.
|
||||||
*
|
|
||||||
* <p>The default value is 64K (i.e. 64 * 1024).
|
* <p>The default value is 64K (i.e. 64 * 1024).
|
||||||
*
|
|
||||||
* <p><strong>NOTE</strong> that the current version 1.2 of the STOMP spec
|
* <p><strong>NOTE</strong> that the current version 1.2 of the STOMP spec
|
||||||
* does not specifically discuss how to send STOMP messages over WebSocket.
|
* does not specifically discuss how to send STOMP messages over WebSocket.
|
||||||
* Version 2 of the spec will but in the mean time existing client libraries
|
* Version 2 of the spec will but in the mean time existing client libraries
|
||||||
|
|
@ -75,7 +72,6 @@ public class WebSocketTransportRegistration {
|
||||||
* Configure a time limit (in milliseconds) for the maximum amount of a time
|
* Configure a time limit (in milliseconds) for the maximum amount of a time
|
||||||
* allowed when sending messages to a WebSocket session or writing to an
|
* allowed when sending messages to a WebSocket session or writing to an
|
||||||
* HTTP response when SockJS fallback option are in use.
|
* HTTP response when SockJS fallback option are in use.
|
||||||
*
|
|
||||||
* <p>In general WebSocket servers expect that messages to a single WebSocket
|
* <p>In general WebSocket servers expect that messages to a single WebSocket
|
||||||
* session are sent from a single thread at a time. This is automatically
|
* session are sent from a single thread at a time. This is automatically
|
||||||
* guaranteed when using {@code @EnableWebSocketMessageBroker} configuration.
|
* guaranteed when using {@code @EnableWebSocketMessageBroker} configuration.
|
||||||
|
|
@ -83,14 +79,12 @@ public class WebSocketTransportRegistration {
|
||||||
* subsequent messages are buffered until either the {@code sendTimeLimit}
|
* subsequent messages are buffered until either the {@code sendTimeLimit}
|
||||||
* or the {@code sendBufferSizeLimit} are reached at which point the session
|
* or the {@code sendBufferSizeLimit} are reached at which point the session
|
||||||
* state is cleared and an attempt is made to close the session.
|
* state is cleared and an attempt is made to close the session.
|
||||||
*
|
|
||||||
* <p><strong>NOTE</strong> that the session time limit is checked only
|
* <p><strong>NOTE</strong> that the session time limit is checked only
|
||||||
* on attempts to send additional messages. So if only a single message is
|
* on attempts to send additional messages. So if only a single message is
|
||||||
* sent and it hangs, the session will not time out until another message is
|
* sent and it hangs, the session will not time out until another message is
|
||||||
* sent or the underlying physical socket times out. So this is not a
|
* sent or the underlying physical socket times out. So this is not a
|
||||||
* replacement for WebSocket server or HTTP connection timeout but is rather
|
* replacement for WebSocket server or HTTP connection timeout but is rather
|
||||||
* intended to control the extent of buffering of unsent messages.
|
* intended to control the extent of buffering of unsent messages.
|
||||||
*
|
|
||||||
* <p><strong>NOTE</strong> that closing the session may not succeed in
|
* <p><strong>NOTE</strong> that closing the session may not succeed in
|
||||||
* actually closing the physical socket and may also hang. This is true
|
* actually closing the physical socket and may also hang. This is true
|
||||||
* especially when using blocking IO such as the BIO connector in Tomcat
|
* especially when using blocking IO such as the BIO connector in Tomcat
|
||||||
|
|
@ -99,11 +93,9 @@ public class WebSocketTransportRegistration {
|
||||||
* is used by default on Tomcat 8. If you must use blocking IO consider
|
* is used by default on Tomcat 8. If you must use blocking IO consider
|
||||||
* customizing OS-level TCP settings, for example
|
* customizing OS-level TCP settings, for example
|
||||||
* {@code /proc/sys/net/ipv4/tcp_retries2} on Linux.
|
* {@code /proc/sys/net/ipv4/tcp_retries2} on Linux.
|
||||||
*
|
|
||||||
* <p>The default value is 10 seconds (i.e. 10 * 10000).
|
* <p>The default value is 10 seconds (i.e. 10 * 10000).
|
||||||
*
|
|
||||||
* @param timeLimit the timeout value in milliseconds; the value must be
|
* @param timeLimit the timeout value in milliseconds; the value must be
|
||||||
* greater than 0, otherwise it is ignored.
|
* greater than 0, otherwise it is ignored.
|
||||||
*/
|
*/
|
||||||
public WebSocketTransportRegistration setSendTimeLimit(int timeLimit) {
|
public WebSocketTransportRegistration setSendTimeLimit(int timeLimit) {
|
||||||
this.sendTimeLimit = timeLimit;
|
this.sendTimeLimit = timeLimit;
|
||||||
|
|
@ -121,7 +113,6 @@ public class WebSocketTransportRegistration {
|
||||||
* Configure the maximum amount of data to buffer when sending messages
|
* Configure the maximum amount of data to buffer when sending messages
|
||||||
* to a WebSocket session, or an HTTP response when SockJS fallback
|
* to a WebSocket session, or an HTTP response when SockJS fallback
|
||||||
* option are in use.
|
* option are in use.
|
||||||
*
|
|
||||||
* <p>In general WebSocket servers expect that messages to a single WebSocket
|
* <p>In general WebSocket servers expect that messages to a single WebSocket
|
||||||
* session are sent from a single thread at a time. This is automatically
|
* session are sent from a single thread at a time. This is automatically
|
||||||
* guaranteed when using {@code @EnableWebSocketMessageBroker} configuration.
|
* guaranteed when using {@code @EnableWebSocketMessageBroker} configuration.
|
||||||
|
|
@ -129,7 +120,6 @@ public class WebSocketTransportRegistration {
|
||||||
* subsequent messages are buffered until either the {@code sendTimeLimit}
|
* subsequent messages are buffered until either the {@code sendTimeLimit}
|
||||||
* or the {@code sendBufferSizeLimit} are reached at which point the session
|
* or the {@code sendBufferSizeLimit} are reached at which point the session
|
||||||
* state is cleared and an attempt is made to close the session.
|
* state is cleared and an attempt is made to close the session.
|
||||||
*
|
|
||||||
* <p><strong>NOTE</strong> that closing the session may not succeed in
|
* <p><strong>NOTE</strong> that closing the session may not succeed in
|
||||||
* actually closing the physical socket and may also hang. This is true
|
* actually closing the physical socket and may also hang. This is true
|
||||||
* especially when using blocking IO such as the BIO connector in Tomcat
|
* especially when using blocking IO such as the BIO connector in Tomcat
|
||||||
|
|
@ -138,12 +128,10 @@ public class WebSocketTransportRegistration {
|
||||||
* by default on Tomcat 8. If you must use blocking IO consider customizing
|
* by default on Tomcat 8. If you must use blocking IO consider customizing
|
||||||
* OS-level TCP settings, for example {@code /proc/sys/net/ipv4/tcp_retries2}
|
* OS-level TCP settings, for example {@code /proc/sys/net/ipv4/tcp_retries2}
|
||||||
* on Linux.
|
* on Linux.
|
||||||
*
|
|
||||||
* <p>The default value is 512K (i.e. 512 * 1024).
|
* <p>The default value is 512K (i.e. 512 * 1024).
|
||||||
*
|
|
||||||
* @param sendBufferSizeLimit the maximum number of bytes to buffer when
|
* @param sendBufferSizeLimit the maximum number of bytes to buffer when
|
||||||
* sending messages; if the value is less than or equal to 0 then buffering
|
* sending messages; if the value is less than or equal to 0 then buffering
|
||||||
* is effectively disabled.
|
* is effectively disabled.
|
||||||
*/
|
*/
|
||||||
public WebSocketTransportRegistration setSendBufferSizeLimit(int sendBufferSizeLimit) {
|
public WebSocketTransportRegistration setSendBufferSizeLimit(int sendBufferSizeLimit) {
|
||||||
this.sendBufferSizeLimit = sendBufferSizeLimit;
|
this.sendBufferSizeLimit = sendBufferSizeLimit;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue