Polishing
This commit is contained in:
parent
be187babf9
commit
3726c6f18d
|
@ -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.
|
||||||
|
@ -71,7 +71,7 @@ public abstract class AbstractInterceptorDrivenBeanDefinitionDecorator implement
|
||||||
BeanDefinition interceptorDefinition = createInterceptorDefinition(node);
|
BeanDefinition interceptorDefinition = createInterceptorDefinition(node);
|
||||||
|
|
||||||
// generate name and register the interceptor
|
// generate name and register the interceptor
|
||||||
String interceptorName = existingBeanName + "." + getInterceptorNameSuffix(interceptorDefinition);
|
String interceptorName = existingBeanName + '.' + getInterceptorNameSuffix(interceptorDefinition);
|
||||||
BeanDefinitionReaderUtils.registerBeanDefinition(
|
BeanDefinitionReaderUtils.registerBeanDefinition(
|
||||||
new BeanDefinitionHolder(interceptorDefinition, interceptorName), registry);
|
new BeanDefinitionHolder(interceptorDefinition, interceptorName), registry);
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -246,7 +246,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
|
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
|
||||||
String name = invocation.getMethod().getDeclaringClass().getName() + "." + invocation.getMethod().getName();
|
String name = ClassUtils.getQualifiedMethodName(invocation.getMethod());
|
||||||
StopWatch stopWatch = new StopWatch(name);
|
StopWatch stopWatch = new StopWatch(name);
|
||||||
Object returnValue = null;
|
Object returnValue = null;
|
||||||
boolean exitThroughException = false;
|
boolean exitThroughException = false;
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -21,6 +21,7 @@ import java.lang.reflect.Method;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
@ -129,8 +130,8 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(Method method, Class<?> targetClass) {
|
public boolean matches(Method method, Class<?> targetClass) {
|
||||||
return ((targetClass != null && matchesPattern(targetClass.getName() + "." + method.getName())) ||
|
return ((targetClass != null && matchesPattern(ClassUtils.getQualifiedMethodName(method, targetClass))) ||
|
||||||
matchesPattern(method.getDeclaringClass().getName() + "." + method.getName()));
|
matchesPattern(ClassUtils.getQualifiedMethodName(method)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.springframework.beans.factory.support.MergedBeanDefinitionPostProcess
|
||||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.core.PriorityOrdered;
|
import org.springframework.core.PriorityOrdered;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -349,7 +350,7 @@ public class InitDestroyAnnotationBeanPostProcessor
|
||||||
}
|
}
|
||||||
this.method = method;
|
this.method = method;
|
||||||
this.identifier = (Modifier.isPrivate(method.getModifiers()) ?
|
this.identifier = (Modifier.isPrivate(method.getModifiers()) ?
|
||||||
method.getDeclaringClass() + "." + method.getName() : method.getName());
|
ClassUtils.getQualifiedMethodName(method) : method.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
|
|
|
@ -280,7 +280,7 @@ public abstract class YamlProcessor {
|
||||||
key = path + key;
|
key = path + key;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
key = path + "." + key;
|
key = path + '.' + key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -98,7 +98,7 @@ public class EhCacheCache implements Cache {
|
||||||
try {
|
try {
|
||||||
value = valueLoader.call();
|
value = valueLoader.call();
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Throwable ex) {
|
||||||
throw new ValueRetrievalException(key, valueLoader, ex);
|
throw new ValueRetrievalException(key, valueLoader, ex);
|
||||||
}
|
}
|
||||||
put(key, value);
|
put(key, value);
|
||||||
|
|
|
@ -652,6 +652,8 @@ public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBe
|
||||||
logger.info("Will start Quartz Scheduler [" + scheduler.getSchedulerName() +
|
logger.info("Will start Quartz Scheduler [" + scheduler.getSchedulerName() +
|
||||||
"] in " + startupDelay + " seconds");
|
"] in " + startupDelay + " seconds");
|
||||||
}
|
}
|
||||||
|
// Not using the Quartz startDelayed method since we explicitly want a daemon
|
||||||
|
// thread here, not keeping the JVM alive in case of all other threads ending.
|
||||||
Thread schedulerThread = new Thread() {
|
Thread schedulerThread = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache {
|
||||||
try {
|
try {
|
||||||
return toStoreValue(valueLoader.call());
|
return toStoreValue(valueLoader.call());
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Throwable ex) {
|
||||||
throw new ValueRetrievalException(key, valueLoader, ex);
|
throw new ValueRetrievalException(key, valueLoader, ex);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -335,7 +335,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
|
||||||
Set<BeanDefinition> candidates = new LinkedHashSet<>();
|
Set<BeanDefinition> candidates = new LinkedHashSet<>();
|
||||||
try {
|
try {
|
||||||
String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX +
|
String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX +
|
||||||
resolveBasePackage(basePackage) + "/" + this.resourcePattern;
|
resolveBasePackage(basePackage) + '/' + this.resourcePattern;
|
||||||
Resource[] resources = this.resourcePatternResolver.getResources(packageSearchPath);
|
Resource[] resources = this.resourcePatternResolver.getResources(packageSearchPath);
|
||||||
boolean traceEnabled = logger.isTraceEnabled();
|
boolean traceEnabled = logger.isTraceEnabled();
|
||||||
boolean debugEnabled = logger.isDebugEnabled();
|
boolean debugEnabled = logger.isDebugEnabled();
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
|
||||||
group.add(entry.getKey(), bean);
|
group.add(entry.getKey(), bean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (phases.size() > 0) {
|
if (!phases.isEmpty()) {
|
||||||
List<Integer> keys = new ArrayList<>(phases.keySet());
|
List<Integer> keys = new ArrayList<>(phases.keySet());
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
for (Integer key : keys) {
|
for (Integer key : keys) {
|
||||||
|
@ -195,7 +195,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
|
||||||
}
|
}
|
||||||
group.add(entry.getKey(), bean);
|
group.add(entry.getKey(), bean);
|
||||||
}
|
}
|
||||||
if (phases.size() > 0) {
|
if (!phases.isEmpty()) {
|
||||||
List<Integer> keys = new ArrayList<>(phases.keySet());
|
List<Integer> keys = new ArrayList<>(phases.keySet());
|
||||||
Collections.sort(keys, Collections.reverseOrder());
|
Collections.sort(keys, Collections.reverseOrder());
|
||||||
for (Integer key : keys) {
|
for (Integer key : keys) {
|
||||||
|
|
|
@ -43,12 +43,12 @@ public class StaticMessageSource extends AbstractMessageSource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String resolveCodeWithoutArguments(String code, Locale locale) {
|
protected String resolveCodeWithoutArguments(String code, Locale locale) {
|
||||||
return this.messages.get(code + "_" + locale.toString());
|
return this.messages.get(code + '_' + locale.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MessageFormat resolveCode(String code, Locale locale) {
|
protected MessageFormat resolveCode(String code, Locale locale) {
|
||||||
String key = code + "_" + locale.toString();
|
String key = code + '_' + locale.toString();
|
||||||
String msg = this.messages.get(key);
|
String msg = this.messages.get(key);
|
||||||
if (msg == null) {
|
if (msg == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -73,7 +73,7 @@ public class StaticMessageSource extends AbstractMessageSource {
|
||||||
Assert.notNull(code, "Code must not be null");
|
Assert.notNull(code, "Code must not be null");
|
||||||
Assert.notNull(locale, "Locale must not be null");
|
Assert.notNull(locale, "Locale must not be null");
|
||||||
Assert.notNull(msg, "Message must not be null");
|
Assert.notNull(msg, "Message must not be null");
|
||||||
this.messages.put(code + "_" + locale.toString(), msg);
|
this.messages.put(code + '_' + locale.toString(), msg);
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Added message [" + msg + "] for code [" + code + "] and Locale [" + locale + "]");
|
logger.debug("Added message [" + msg + "] for code [" + code + "] and Locale [" + locale + "]");
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,9 @@ import org.springframework.core.Ordered;
|
||||||
* Enables Spring's asynchronous method execution capability, similar to functionality
|
* Enables Spring's asynchronous method execution capability, similar to functionality
|
||||||
* found in Spring's {@code <task:*>} XML namespace.
|
* found in Spring's {@code <task:*>} XML namespace.
|
||||||
*
|
*
|
||||||
* <p>To be used together with @{@link Configuration Configuration} classes as follows:
|
* <p>To be used together with @{@link Configuration Configuration} classes as follows,
|
||||||
|
* enabling annotation-driven async processing for an entire Spring application context:
|
||||||
|
*
|
||||||
* <pre class="code">
|
* <pre class="code">
|
||||||
* @Configuration
|
* @Configuration
|
||||||
* @EnableAsync
|
* @EnableAsync
|
||||||
|
@ -45,6 +47,7 @@ import org.springframework.core.Ordered;
|
||||||
* annotation, or any custom annotation specified via the {@link #annotation} attribute.
|
* annotation, or any custom annotation specified via the {@link #annotation} attribute.
|
||||||
* The aspect is added transparently for any registered bean, for instance via this
|
* The aspect is added transparently for any registered bean, for instance via this
|
||||||
* configuration:
|
* configuration:
|
||||||
|
*
|
||||||
* <pre class="code">
|
* <pre class="code">
|
||||||
* @Configuration
|
* @Configuration
|
||||||
* public class AnotherAppConfig {
|
* public class AnotherAppConfig {
|
||||||
|
|
|
@ -241,7 +241,7 @@ public abstract class Conventions {
|
||||||
public static String getQualifiedAttributeName(Class<?> enclosingClass, String attributeName) {
|
public static String getQualifiedAttributeName(Class<?> enclosingClass, String attributeName) {
|
||||||
Assert.notNull(enclosingClass, "'enclosingClass' must not be null");
|
Assert.notNull(enclosingClass, "'enclosingClass' must not be null");
|
||||||
Assert.notNull(attributeName, "'attributeName' must not be null");
|
Assert.notNull(attributeName, "'attributeName' must not be null");
|
||||||
return enclosingClass.getName() + "." + attributeName;
|
return enclosingClass.getName() + '.' + attributeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ import org.springframework.core.io.support.ResourceRegion;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.MimeType;
|
import org.springframework.util.MimeType;
|
||||||
import org.springframework.util.MimeTypeUtils;
|
import org.springframework.util.MimeTypeUtils;
|
||||||
import org.springframework.util.ResourceUtils;
|
|
||||||
import org.springframework.util.StreamUtils;
|
import org.springframework.util.StreamUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,6 +72,7 @@ public class ResourceRegionEncoder extends AbstractEncoder<ResourceRegion> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public Flux<DataBuffer> encode(Publisher<? extends ResourceRegion> inputStream,
|
public Flux<DataBuffer> encode(Publisher<? extends ResourceRegion> inputStream,
|
||||||
DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
|
DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
|
||||||
|
|
||||||
|
@ -138,10 +138,10 @@ public class ResourceRegionEncoder extends AbstractEncoder<ResourceRegion> {
|
||||||
long end = start + region.getCount() - 1;
|
long end = start + region.getCount() - 1;
|
||||||
OptionalLong contentLength = contentLength(region.getResource());
|
OptionalLong contentLength = contentLength(region.getResource());
|
||||||
if (contentLength.isPresent()) {
|
if (contentLength.isPresent()) {
|
||||||
return getAsciiBytes("Content-Range: bytes " + start + "-" + end + "/" + contentLength.getAsLong() + "\r\n\r\n");
|
return getAsciiBytes("Content-Range: bytes " + start + '-' + end + '/' + contentLength.getAsLong() + "\r\n\r\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return getAsciiBytes("Content-Range: bytes " + start + "-" + end + "\r\n\r\n");
|
return getAsciiBytes("Content-Range: bytes " + start + '-' + end + "\r\n\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -30,6 +30,7 @@ import org.springframework.expression.spel.ExpressionState;
|
||||||
import org.springframework.expression.spel.SpelEvaluationException;
|
import org.springframework.expression.spel.SpelEvaluationException;
|
||||||
import org.springframework.expression.spel.SpelMessage;
|
import org.springframework.expression.spel.SpelMessage;
|
||||||
import org.springframework.expression.spel.support.ReflectionHelper;
|
import org.springframework.expression.spel.support.ReflectionHelper;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,8 +104,7 @@ public class FunctionReference extends SpelNodeImpl {
|
||||||
// Only static methods can be called in this way
|
// Only static methods can be called in this way
|
||||||
if (!Modifier.isStatic(method.getModifiers())) {
|
if (!Modifier.isStatic(method.getModifiers())) {
|
||||||
throw new SpelEvaluationException(getStartPosition(),
|
throw new SpelEvaluationException(getStartPosition(),
|
||||||
SpelMessage.FUNCTION_MUST_BE_STATIC,
|
SpelMessage.FUNCTION_MUST_BE_STATIC, ClassUtils.getQualifiedMethodName(method), this.name);
|
||||||
method.getDeclaringClass().getName() + "." + method.getName(), this.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
argumentConversionOccurred = false;
|
argumentConversionOccurred = false;
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class StandardTypeLocator implements TypeLocator {
|
||||||
}
|
}
|
||||||
for (String prefix : this.knownPackagePrefixes) {
|
for (String prefix : this.knownPackagePrefixes) {
|
||||||
try {
|
try {
|
||||||
nameToLookup = prefix + "." + typeName;
|
nameToLookup = prefix + '.' + typeName;
|
||||||
return ClassUtils.forName(nameToLookup, this.classLoader);
|
return ClassUtils.forName(nameToLookup, this.classLoader);
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException ex) {
|
catch (ClassNotFoundException ex) {
|
||||||
|
|
|
@ -316,8 +316,8 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
||||||
String metaDataSchemaName = metaDataSchemaNameToUse(schemaName);
|
String metaDataSchemaName = metaDataSchemaNameToUse(schemaName);
|
||||||
String metaDataProcedureName = procedureNameToUse(procedureName);
|
String metaDataProcedureName = procedureNameToUse(procedureName);
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Retrieving metadata for " + metaDataCatalogName + "/" +
|
logger.debug("Retrieving metadata for " + metaDataCatalogName + '/' +
|
||||||
metaDataSchemaName + "/" + metaDataProcedureName);
|
metaDataSchemaName + '/' + metaDataProcedureName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultSet procs = null;
|
ResultSet procs = null;
|
||||||
|
@ -325,8 +325,8 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
||||||
procs = databaseMetaData.getProcedures(metaDataCatalogName, metaDataSchemaName, metaDataProcedureName);
|
procs = databaseMetaData.getProcedures(metaDataCatalogName, metaDataSchemaName, metaDataProcedureName);
|
||||||
List<String> found = new ArrayList<>();
|
List<String> found = new ArrayList<>();
|
||||||
while (procs.next()) {
|
while (procs.next()) {
|
||||||
found.add(procs.getString("PROCEDURE_CAT") + "." + procs.getString("PROCEDURE_SCHEM") +
|
found.add(procs.getString("PROCEDURE_CAT") + '.' + procs.getString("PROCEDURE_SCHEM") +
|
||||||
"." + procs.getString("PROCEDURE_NAME"));
|
'.' + procs.getString("PROCEDURE_NAME"));
|
||||||
}
|
}
|
||||||
procs.close();
|
procs.close();
|
||||||
|
|
||||||
|
|
|
@ -371,8 +371,8 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
|
||||||
String metaDataSchemaName = metaDataSchemaNameToUse(tmd.getSchemaName());
|
String metaDataSchemaName = metaDataSchemaNameToUse(tmd.getSchemaName());
|
||||||
String metaDataTableName = tableNameToUse(tmd.getTableName());
|
String metaDataTableName = tableNameToUse(tmd.getTableName());
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Retrieving metadata for " + metaDataCatalogName + "/" +
|
logger.debug("Retrieving metadata for " + metaDataCatalogName + '/' +
|
||||||
metaDataSchemaName + "/" + metaDataTableName);
|
metaDataSchemaName + '/' + metaDataTableName);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
tableColumns = databaseMetaData.getColumns(
|
tableColumns = databaseMetaData.getColumns(
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -112,7 +112,7 @@ public class JdbcBeanDefinitionReader {
|
||||||
String property = rs.getString(2);
|
String property = rs.getString(2);
|
||||||
String value = rs.getString(3);
|
String value = rs.getString(3);
|
||||||
// Make a properties entry by combining bean name and property.
|
// Make a properties entry by combining bean name and property.
|
||||||
props.setProperty(beanName + "." + property, value);
|
props.setProperty(beanName + '.' + property, value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.propReader.registerBeanDefinitions(props);
|
this.propReader.registerBeanDefinitions(props);
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.springframework.core.ParameterNameDiscoverer;
|
||||||
import org.springframework.core.ResolvableType;
|
import org.springframework.core.ResolvableType;
|
||||||
import org.springframework.messaging.Message;
|
import org.springframework.messaging.Message;
|
||||||
import org.springframework.messaging.handler.HandlerMethod;
|
import org.springframework.messaging.handler.HandlerMethod;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,15 +107,13 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||||
public Object invoke(Message<?> message, Object... providedArgs) throws Exception {
|
public Object invoke(Message<?> message, Object... providedArgs) throws Exception {
|
||||||
Object[] args = getMethodArgumentValues(message, providedArgs);
|
Object[] args = getMethodArgumentValues(message, providedArgs);
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
StringBuilder sb = new StringBuilder("Invoking [");
|
logger.trace("Invoking '" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||||
sb.append(getBeanType().getSimpleName()).append(".");
|
"' with arguments " + Arrays.toString(args));
|
||||||
sb.append(getMethod().getName()).append("] method with arguments ");
|
|
||||||
sb.append(Arrays.asList(args));
|
|
||||||
logger.trace(sb.toString());
|
|
||||||
}
|
}
|
||||||
Object returnValue = doInvoke(args);
|
Object returnValue = doInvoke(args);
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
logger.trace("Method [" + getMethod().getName() + "] returned [" + returnValue + "]");
|
logger.trace("Method [" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||||
|
"] returned [" + returnValue + "]");
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,13 +133,11 @@ public class SendToMethodReturnValueHandler implements HandlerMethodReturnValueH
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsReturnType(MethodParameter returnType) {
|
public boolean supportsReturnType(MethodParameter returnType) {
|
||||||
if (returnType.hasMethodAnnotation(SendTo.class) ||
|
return (returnType.hasMethodAnnotation(SendTo.class) ||
|
||||||
AnnotatedElementUtils.hasAnnotation(returnType.getDeclaringClass(), SendTo.class) ||
|
AnnotatedElementUtils.hasAnnotation(returnType.getDeclaringClass(), SendTo.class) ||
|
||||||
returnType.hasMethodAnnotation(SendToUser.class) ||
|
returnType.hasMethodAnnotation(SendToUser.class) ||
|
||||||
AnnotatedElementUtils.hasAnnotation(returnType.getDeclaringClass(), SendToUser.class)) {
|
AnnotatedElementUtils.hasAnnotation(returnType.getDeclaringClass(), SendToUser.class) ||
|
||||||
return true;
|
!this.annotationRequired);
|
||||||
}
|
|
||||||
return !this.annotationRequired;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -188,56 +186,34 @@ public class SendToMethodReturnValueHandler implements HandlerMethodReturnValueH
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object findAnnotation(MethodParameter returnType) {
|
private Object findAnnotation(MethodParameter returnType) {
|
||||||
Annotation[] annot = new Annotation[4];
|
Annotation[] anns = new Annotation[4];
|
||||||
annot[0] = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendToUser.class);
|
anns[0] = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendToUser.class);
|
||||||
annot[1] = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendTo.class);
|
anns[1] = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendTo.class);
|
||||||
annot[2] = AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendToUser.class);
|
anns[2] = AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendToUser.class);
|
||||||
annot[3] = AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendTo.class);
|
anns[3] = AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendTo.class);
|
||||||
|
|
||||||
if (annot[0] != null && !ObjectUtils.isEmpty(((SendToUser) annot[0]).value())) {
|
if (anns[0] != null && !ObjectUtils.isEmpty(((SendToUser) anns[0]).value())) {
|
||||||
return annot[0];
|
return anns[0];
|
||||||
}
|
}
|
||||||
if (annot[1] != null && !ObjectUtils.isEmpty(((SendTo) annot[1]).value())) {
|
if (anns[1] != null && !ObjectUtils.isEmpty(((SendTo) anns[1]).value())) {
|
||||||
return annot[1];
|
return anns[1];
|
||||||
}
|
}
|
||||||
if (annot[2] != null && !ObjectUtils.isEmpty(((SendToUser) annot[2]).value())) {
|
if (anns[2] != null && !ObjectUtils.isEmpty(((SendToUser) anns[2]).value())) {
|
||||||
return annot[2];
|
return anns[2];
|
||||||
}
|
}
|
||||||
if (annot[3] != null && !ObjectUtils.isEmpty(((SendTo) annot[3]).value())) {
|
if (anns[3] != null && !ObjectUtils.isEmpty(((SendTo) anns[3]).value())) {
|
||||||
return annot[3];
|
return anns[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i < 4; i++) {
|
for (int i=0; i < 4; i++) {
|
||||||
if (annot[i] != null) {
|
if (anns[i] != null) {
|
||||||
return annot[i];
|
return anns[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SendToUser getSendToUser(MethodParameter returnType) {
|
|
||||||
SendToUser annot = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendToUser.class);
|
|
||||||
if (annot != null && !ObjectUtils.isEmpty(annot.value())) {
|
|
||||||
return annot;
|
|
||||||
}
|
|
||||||
SendToUser typeAnnot = AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendToUser.class);
|
|
||||||
if (typeAnnot != null && !ObjectUtils.isEmpty(typeAnnot.value())) {
|
|
||||||
return typeAnnot;
|
|
||||||
}
|
|
||||||
return (annot != null ? annot : typeAnnot);
|
|
||||||
}
|
|
||||||
|
|
||||||
private SendTo getSendTo(MethodParameter returnType) {
|
|
||||||
SendTo sendTo = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendTo.class);
|
|
||||||
if (sendTo != null && !ObjectUtils.isEmpty(sendTo.value())) {
|
|
||||||
return sendTo;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendTo.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private PlaceholderResolver initVarResolver(MessageHeaders headers) {
|
private PlaceholderResolver initVarResolver(MessageHeaders headers) {
|
||||||
String name = DestinationVariableMethodArgumentResolver.DESTINATION_TEMPLATE_VARIABLES_HEADER;
|
String name = DestinationVariableMethodArgumentResolver.DESTINATION_TEMPLATE_VARIABLES_HEADER;
|
||||||
|
@ -268,7 +244,7 @@ public class SendToMethodReturnValueHandler implements HandlerMethodReturnValueH
|
||||||
}
|
}
|
||||||
|
|
||||||
return (destination.startsWith("/") ?
|
return (destination.startsWith("/") ?
|
||||||
new String[] {defaultPrefix + destination} : new String[] {defaultPrefix + "/" + destination});
|
new String[] {defaultPrefix + destination} : new String[] {defaultPrefix + '/' + destination});
|
||||||
}
|
}
|
||||||
|
|
||||||
private MessageHeaders createHeaders(String sessionId, MethodParameter returnType) {
|
private MessageHeaders createHeaders(String sessionId, MethodParameter returnType) {
|
||||||
|
|
|
@ -211,7 +211,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
|
||||||
}
|
}
|
||||||
trySetStompHeaderForSubscriptionId();
|
trySetStompHeaderForSubscriptionId();
|
||||||
if (getMessageId() == null) {
|
if (getMessageId() == null) {
|
||||||
String messageId = getSessionId() + "-" + messageIdCounter.getAndIncrement();
|
String messageId = getSessionId() + '-' + messageIdCounter.getAndIncrement();
|
||||||
setNativeHeader(STOMP_MESSAGE_ID_HEADER, messageId);
|
setNativeHeader(STOMP_MESSAGE_ID_HEADER, messageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
|
||||||
catch (UnknownHostException ex) {
|
catch (UnknownHostException ex) {
|
||||||
host = "unknown";
|
host = "unknown";
|
||||||
}
|
}
|
||||||
return host + "-" + UUID.randomUUID();
|
return host + '-' + UUID.randomUUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.springframework.test.context.transaction;
|
package org.springframework.test.context.transaction;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -33,6 +32,7 @@ import org.springframework.transaction.annotation.TransactionManagementConfigure
|
||||||
import org.springframework.transaction.interceptor.DelegatingTransactionAttribute;
|
import org.springframework.transaction.interceptor.DelegatingTransactionAttribute;
|
||||||
import org.springframework.transaction.interceptor.TransactionAttribute;
|
import org.springframework.transaction.interceptor.TransactionAttribute;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -241,10 +241,9 @@ public abstract class TestContextTransactionUtils {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
|
||||||
public TestContextTransactionAttribute(TransactionAttribute targetAttribute, TestContext testContext) {
|
public TestContextTransactionAttribute(TransactionAttribute targetAttribute, TestContext testContext) {
|
||||||
super(targetAttribute);
|
super(targetAttribute);
|
||||||
this.name = testContext.getTestClass().getName() + "." + testContext.getTestMethod().getName();
|
this.name = ClassUtils.getQualifiedMethodName(testContext.getTestMethod(), testContext.getTestClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -105,7 +105,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (this.prefix.endsWith("/") || path.startsWith("/") ?
|
return (this.prefix.endsWith("/") || path.startsWith("/") ?
|
||||||
this.prefix + path : this.prefix + "/" + path);
|
this.prefix + path : this.prefix + '/' + path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
||||||
Matcher matcher = pattern.matcher(requestPath);
|
Matcher matcher = pattern.matcher(requestPath);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
String match = matcher.group(1);
|
String match = matcher.group(1);
|
||||||
return (match.contains("-") ? match.substring(match.lastIndexOf("-") + 1) : match);
|
return (match.contains("-") ? match.substring(match.lastIndexOf('-') + 1) : match);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -140,7 +140,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
||||||
public String addVersion(String requestPath, String version) {
|
public String addVersion(String requestPath, String version) {
|
||||||
String baseFilename = StringUtils.stripFilenameExtension(requestPath);
|
String baseFilename = StringUtils.stripFilenameExtension(requestPath);
|
||||||
String extension = StringUtils.getFilenameExtension(requestPath);
|
String extension = StringUtils.getFilenameExtension(requestPath);
|
||||||
return (baseFilename + "-" + version + "." + extension);
|
return (baseFilename + '-' + version + '.' + extension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,13 @@ import org.springframework.core.GenericTypeResolver;
|
||||||
import org.springframework.core.MethodParameter;
|
import org.springframework.core.MethodParameter;
|
||||||
import org.springframework.core.ParameterNameDiscoverer;
|
import org.springframework.core.ParameterNameDiscoverer;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
import org.springframework.web.method.HandlerMethod;
|
import org.springframework.web.method.HandlerMethod;
|
||||||
import org.springframework.web.reactive.HandlerResult;
|
import org.springframework.web.reactive.HandlerResult;
|
||||||
import org.springframework.web.server.ServerWebExchange;
|
import org.springframework.web.server.ServerWebExchange;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of HandlerMethod that can invoke the target method after resolving
|
* Extension of HandlerMethod that can invoke the target method after resolving
|
||||||
* its method arguments.
|
* its method arguments.
|
||||||
|
@ -160,22 +160,22 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||||
|
|
||||||
private String getDetailedErrorMessage(String message, MethodParameter param) {
|
private String getDetailedErrorMessage(String message, MethodParameter param) {
|
||||||
StringBuilder sb = new StringBuilder(message);
|
StringBuilder sb = new StringBuilder(message);
|
||||||
sb.append("argument [" + param.getParameterIndex() + "] ");
|
sb.append("argument [").append(param.getParameterIndex()).append("] ");
|
||||||
sb.append("of type [" + param.getParameterType().getName() + "] ");
|
sb.append("of type [").append(param.getParameterType().getName()).append("] ");
|
||||||
sb.append("on method [" + getBridgedMethod().toGenericString() + "]");
|
sb.append("on method [").append(getBridgedMethod().toGenericString()).append("]");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object doInvoke(Object[] args) throws Exception {
|
private Object doInvoke(Object[] args) throws Exception {
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
String target = getBeanType().getSimpleName() + "." + getMethod().getName();
|
logger.trace("Invoking '" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||||
logger.trace("Invoking [" + target + "] method with arguments " + Arrays.toString(args));
|
"' with arguments " + Arrays.toString(args));
|
||||||
}
|
}
|
||||||
ReflectionUtils.makeAccessible(getBridgedMethod());
|
ReflectionUtils.makeAccessible(getBridgedMethod());
|
||||||
Object returnValue = getBridgedMethod().invoke(getBean(), args);
|
Object returnValue = getBridgedMethod().invoke(getBean(), args);
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
String target = getBeanType().getSimpleName() + "." + getMethod().getName();
|
logger.trace("Method [" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||||
logger.trace("Method [" + target + "] returned [" + returnValue + "]");
|
"] returned [" + returnValue + "]");
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ class ResourceRegionHttpMessageWriter extends EncoderHttpMessageWriter<ResourceR
|
||||||
long start = region.getPosition();
|
long start = region.getPosition();
|
||||||
long end = start + region.getCount() - 1;
|
long end = start + region.getCount() - 1;
|
||||||
end = Math.min(end, length - 1);
|
end = Math.min(end, length - 1);
|
||||||
outputMessage.getHeaders().add("Content-Range", "bytes " + start + "-" + end + "/" + length);
|
outputMessage.getHeaders().add("Content-Range", "bytes " + start + '-' + end + '/' + length);
|
||||||
outputMessage.getHeaders().setContentLength(end - start + 1);
|
outputMessage.getHeaders().setContentLength(end - start + 1);
|
||||||
});
|
});
|
||||||
outputMessage.getHeaders().setContentType(contentType);
|
outputMessage.getHeaders().setContentType(contentType);
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessa
|
||||||
Long resourceLength = region.getResource().contentLength();
|
Long resourceLength = region.getResource().contentLength();
|
||||||
end = Math.min(end, resourceLength - 1);
|
end = Math.min(end, resourceLength - 1);
|
||||||
long rangeLength = end - start + 1;
|
long rangeLength = end - start + 1;
|
||||||
responseHeaders.add("Content-Range", "bytes " + start + "-" + end + "/" + resourceLength);
|
responseHeaders.add("Content-Range", "bytes " + start + '-' + end + '/' + resourceLength);
|
||||||
responseHeaders.setContentLength(rangeLength);
|
responseHeaders.setContentLength(rangeLength);
|
||||||
InputStream in = region.getResource().getInputStream();
|
InputStream in = region.getResource().getInputStream();
|
||||||
try {
|
try {
|
||||||
|
@ -167,7 +167,7 @@ public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessa
|
||||||
}
|
}
|
||||||
Long resourceLength = region.getResource().contentLength();
|
Long resourceLength = region.getResource().contentLength();
|
||||||
end = Math.min(end, resourceLength - 1);
|
end = Math.min(end, resourceLength - 1);
|
||||||
print(out, "Content-Range: bytes " + start + "-" + end + "/" + resourceLength);
|
print(out, "Content-Range: bytes " + start + '-' + end + '/' + resourceLength);
|
||||||
println(out);
|
println(out);
|
||||||
println(out);
|
println(out);
|
||||||
// Printing content
|
// Printing content
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -182,7 +182,7 @@ public class HessianExporter extends RemoteExporter implements InitializingBean
|
||||||
major = isToUse.read();
|
major = isToUse.read();
|
||||||
minor = isToUse.read();
|
minor = isToUse.read();
|
||||||
if (major != 0x02) {
|
if (major != 0x02) {
|
||||||
throw new IOException("Version " + major + "." + minor + " is not understood");
|
throw new IOException("Version " + major + '.' + minor + " is not understood");
|
||||||
}
|
}
|
||||||
in = new Hessian2Input(isToUse);
|
in = new Hessian2Input(isToUse);
|
||||||
out = new Hessian2Output(osToUse);
|
out = new Hessian2Output(osToUse);
|
||||||
|
|
|
@ -144,6 +144,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
||||||
* Set whether the request payload (body) should be included in the log message.
|
* Set whether the request payload (body) should be included in the log message.
|
||||||
* <p>Should be configured using an {@code <init-param>} for parameter name
|
* <p>Should be configured using an {@code <init-param>} for parameter name
|
||||||
* "includePayload" in the filter definition in {@code web.xml}.
|
* "includePayload" in the filter definition in {@code web.xml}.
|
||||||
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public void setIncludePayload(boolean includePayload) {
|
public void setIncludePayload(boolean includePayload) {
|
||||||
this.includePayload = includePayload;
|
this.includePayload = includePayload;
|
||||||
|
@ -151,6 +152,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether the request payload (body) should be included in the log message.
|
* Return whether the request payload (body) should be included in the log message.
|
||||||
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
protected boolean isIncludePayload() {
|
protected boolean isIncludePayload() {
|
||||||
return this.includePayload;
|
return this.includePayload;
|
||||||
|
@ -159,6 +161,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
||||||
/**
|
/**
|
||||||
* Sets the maximum length of the payload body to be included in the log message.
|
* Sets the maximum length of the payload body to be included in the log message.
|
||||||
* Default is 50 characters.
|
* Default is 50 characters.
|
||||||
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public void setMaxPayloadLength(int maxPayloadLength) {
|
public void setMaxPayloadLength(int maxPayloadLength) {
|
||||||
Assert.isTrue(maxPayloadLength >= 0, "'maxPayloadLength' should be larger than or equal to 0");
|
Assert.isTrue(maxPayloadLength >= 0, "'maxPayloadLength' should be larger than or equal to 0");
|
||||||
|
@ -167,6 +170,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the maximum length of the payload body to be included in the log message.
|
* Return the maximum length of the payload body to be included in the log message.
|
||||||
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
protected int getMaxPayloadLength() {
|
protected int getMaxPayloadLength() {
|
||||||
return this.maxPayloadLength;
|
return this.maxPayloadLength;
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||||
import org.springframework.core.GenericTypeResolver;
|
import org.springframework.core.GenericTypeResolver;
|
||||||
import org.springframework.core.MethodParameter;
|
import org.springframework.core.MethodParameter;
|
||||||
import org.springframework.core.ParameterNameDiscoverer;
|
import org.springframework.core.ParameterNameDiscoverer;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
import org.springframework.web.bind.WebDataBinder;
|
import org.springframework.web.bind.WebDataBinder;
|
||||||
import org.springframework.web.bind.support.SessionStatus;
|
import org.springframework.web.bind.support.SessionStatus;
|
||||||
|
@ -127,15 +128,13 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||||
|
|
||||||
Object[] args = getMethodArgumentValues(request, mavContainer, providedArgs);
|
Object[] args = getMethodArgumentValues(request, mavContainer, providedArgs);
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
StringBuilder sb = new StringBuilder("Invoking [");
|
logger.trace("Invoking '" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||||
sb.append(getBeanType().getSimpleName()).append(".");
|
"' with arguments " + Arrays.toString(args));
|
||||||
sb.append(getMethod().getName()).append("] method with arguments ");
|
|
||||||
sb.append(Arrays.asList(args));
|
|
||||||
logger.trace(sb.toString());
|
|
||||||
}
|
}
|
||||||
Object returnValue = doInvoke(args);
|
Object returnValue = doInvoke(args);
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
logger.trace("Method [" + getMethod().getName() + "] returned [" + returnValue + "]");
|
logger.trace("Method [" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||||
|
"] returned [" + returnValue + "]");
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -641,7 +641,7 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic
|
||||||
else {
|
else {
|
||||||
// Generate default id...
|
// Generate default id...
|
||||||
wac.setId(ConfigurableWebApplicationContext.APPLICATION_CONTEXT_ID_PREFIX +
|
wac.setId(ConfigurableWebApplicationContext.APPLICATION_CONTEXT_ID_PREFIX +
|
||||||
ObjectUtils.getDisplayString(getServletContext().getContextPath()) + "/" + getServletName());
|
ObjectUtils.getDisplayString(getServletContext().getContextPath()) + '/' + getServletName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -105,7 +105,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (this.prefix.endsWith("/") || path.startsWith("/") ?
|
return (this.prefix.endsWith("/") || path.startsWith("/") ?
|
||||||
this.prefix + path : this.prefix + "/" + path);
|
this.prefix + path : this.prefix + '/' + path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
||||||
Matcher matcher = pattern.matcher(requestPath);
|
Matcher matcher = pattern.matcher(requestPath);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
String match = matcher.group(1);
|
String match = matcher.group(1);
|
||||||
return (match.contains("-") ? match.substring(match.lastIndexOf("-") + 1) : match);
|
return (match.contains("-") ? match.substring(match.lastIndexOf('-') + 1) : match);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -140,7 +140,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
||||||
public String addVersion(String requestPath, String version) {
|
public String addVersion(String requestPath, String version) {
|
||||||
String baseFilename = StringUtils.stripFilenameExtension(requestPath);
|
String baseFilename = StringUtils.stripFilenameExtension(requestPath);
|
||||||
String extension = StringUtils.getFilenameExtension(requestPath);
|
String extension = StringUtils.getFilenameExtension(requestPath);
|
||||||
return (baseFilename + "-" + version + "." + extension);
|
return (baseFilename + '-' + version + '.' + extension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
template = URL_TEMPLATE_DELIMITER_PREFIX + "/" + param.getName() + URL_TEMPLATE_DELIMITER_SUFFIX;
|
template = URL_TEMPLATE_DELIMITER_PREFIX + '/' + param.getName() + URL_TEMPLATE_DELIMITER_SUFFIX;
|
||||||
if (uri.contains(template)) {
|
if (uri.contains(template)) {
|
||||||
usedParams.add(param.getName());
|
usedParams.add(param.getName());
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -179,7 +179,7 @@ public abstract class AbstractCachingViewResolver extends WebApplicationObjectSu
|
||||||
* lead to a different view resource.
|
* lead to a different view resource.
|
||||||
*/
|
*/
|
||||||
protected Object getCacheKey(String viewName, Locale locale) {
|
protected Object getCacheKey(String viewName, Locale locale) {
|
||||||
return viewName + "_" + locale;
|
return viewName + '_' + locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -303,7 +303,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
|
||||||
for (MediaType requestedMediaType : requestedMediaTypes) {
|
for (MediaType requestedMediaType : requestedMediaTypes) {
|
||||||
List<String> extensions = this.contentNegotiationManager.resolveFileExtensions(requestedMediaType);
|
List<String> extensions = this.contentNegotiationManager.resolveFileExtensions(requestedMediaType);
|
||||||
for (String extension : extensions) {
|
for (String extension : extensions) {
|
||||||
String viewNameWithExtension = viewName + "." + extension;
|
String viewNameWithExtension = viewName + '.' + extension;
|
||||||
view = viewResolver.resolveViewName(viewNameWithExtension, locale);
|
view = viewResolver.resolveViewName(viewNameWithExtension, locale);
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
candidateViews.add(view);
|
candidateViews.add(view);
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class GroovyMarkupViewResolver extends AbstractTemplateViewResolver {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Object getCacheKey(String viewName, Locale locale) {
|
protected Object getCacheKey(String viewName, Locale locale) {
|
||||||
return viewName + "_" + locale;
|
return viewName + '_' + locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue