diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java index 20b34371a8..8177fc9828 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,15 +29,13 @@ import org.springframework.util.Assert; * *
Given two pieces of advice, {@code a} and {@code b}: *
Important: Note that unlike a normal comparator a return of 0 means
@@ -51,9 +49,12 @@ import org.springframework.util.Assert;
class AspectJPrecedenceComparator implements Comparator The custom name applies only if the Configuration class is picked up via
* component scanning or supplied directly to a {@link AnnotationConfigApplicationContext}.
* If the Configuration class is registered as a traditional XML bean definition,
* the name/id of the bean element will take precedence.
- *
* @return the specified bean name, if any
* @see org.springframework.beans.factory.support.DefaultBeanNameGenerator
*/
diff --git a/spring-core/src/main/java/org/springframework/util/ClassUtils.java b/spring-core/src/main/java/org/springframework/util/ClassUtils.java
index 282c020ca8..f0c9e28ce9 100644
--- a/spring-core/src/main/java/org/springframework/util/ClassUtils.java
+++ b/spring-core/src/main/java/org/springframework/util/ClassUtils.java
@@ -58,6 +58,9 @@ public abstract class ClassUtils {
/** The package separator character '.' */
private static final char PACKAGE_SEPARATOR = '.';
+ /** The path separator character '/' */
+ private static final char PATH_SEPARATOR = '/';
+
/** The inner class separator character '$' */
private static final char INNER_CLASS_SEPARATOR = '$';
@@ -246,14 +249,15 @@ public abstract class ClassUtils {
return (clToUse != null ? clToUse.loadClass(name) : Class.forName(name));
}
catch (ClassNotFoundException ex) {
- int lastDotIndex = name.lastIndexOf('.');
+ int lastDotIndex = name.lastIndexOf(PACKAGE_SEPARATOR);
if (lastDotIndex != -1) {
- String innerClassName = name.substring(0, lastDotIndex) + '$' + name.substring(lastDotIndex + 1);
+ String innerClassName =
+ name.substring(0, lastDotIndex) + INNER_CLASS_SEPARATOR + name.substring(lastDotIndex + 1);
try {
return (clToUse != null ? clToUse.loadClass(innerClassName) : Class.forName(innerClassName));
}
catch (ClassNotFoundException ex2) {
- // swallow - let original exception get through
+ // Swallow - let original exception get through
}
}
throw ex;
@@ -424,7 +428,7 @@ public abstract class ClassUtils {
*/
public static String getShortNameAsProperty(Class> clazz) {
String shortName = ClassUtils.getShortName(clazz);
- int dotIndex = shortName.lastIndexOf('.');
+ int dotIndex = shortName.lastIndexOf(PACKAGE_SEPARATOR);
shortName = (dotIndex != -1 ? shortName.substring(dotIndex + 1) : shortName);
return Introspector.decapitalize(shortName);
}
@@ -943,7 +947,7 @@ public abstract class ClassUtils {
*/
public static String convertResourcePathToClassName(String resourcePath) {
Assert.notNull(resourcePath, "Resource path must not be null");
- return resourcePath.replace('/', '.');
+ return resourcePath.replace(PATH_SEPARATOR, PACKAGE_SEPARATOR);
}
/**
@@ -953,7 +957,7 @@ public abstract class ClassUtils {
*/
public static String convertClassNameToResourcePath(String className) {
Assert.notNull(className, "Class name must not be null");
- return className.replace('.', '/');
+ return className.replace(PACKAGE_SEPARATOR, PATH_SEPARATOR);
}
/**
@@ -966,7 +970,7 @@ public abstract class ClassUtils {
* loading a resource file that is in the same package as a class file,
* although {@link org.springframework.core.io.ClassPathResource} is usually
* even more convenient.
- * @param clazz the Class whose package will be used as the base
+ * @param clazz the Class whose package will be used as the base
* @param resourceName the resource name to append. A leading slash is optional.
* @return the built-up resource path
* @see ClassLoader#getResource
@@ -999,12 +1003,12 @@ public abstract class ClassUtils {
return "";
}
String className = clazz.getName();
- int packageEndIndex = className.lastIndexOf('.');
+ int packageEndIndex = className.lastIndexOf(PACKAGE_SEPARATOR);
if (packageEndIndex == -1) {
return "";
}
String packageName = className.substring(0, packageEndIndex);
- return packageName.replace('.', '/');
+ return packageName.replace(PACKAGE_SEPARATOR, PATH_SEPARATOR);
}
/**
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java
index 4be3506bc0..237e79d595 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java
@@ -57,7 +57,7 @@ public class SpelExpression implements Expression {
private final SpelParserConfiguration configuration;
- // the default context is used if no override is supplied by the user
+ // The default context is used if no override is supplied by the user
private EvaluationContext evaluationContext;
// Holds the compiled form of the expression (if it has been compiled)
@@ -220,12 +220,11 @@ public class SpelExpression implements Expression {
@Override
public Object getValue(EvaluationContext context) throws EvaluationException {
- Assert.notNull(context, "The EvaluationContext is required");
+ Assert.notNull(context, "EvaluationContext is required");
if (compiledAst!= null) {
try {
TypedValue contextRoot = context == null ? null : context.getRootObject();
- Object result = this.compiledAst.getValue(contextRoot==null?null:contextRoot.getValue(),context);
- return result;
+ return this.compiledAst.getValue(contextRoot != null ? contextRoot.getValue() : null, context);
}
catch (Throwable ex) {
// If running in mixed mode, revert to interpreted
@@ -247,7 +246,7 @@ public class SpelExpression implements Expression {
@Override
public Object getValue(EvaluationContext context, Object rootObject) throws EvaluationException {
- Assert.notNull(context, "The EvaluationContext is required");
+ Assert.notNull(context, "EvaluationContext is required");
if (this.compiledAst != null) {
try {
return this.compiledAst.getValue(rootObject,context);
@@ -345,16 +344,16 @@ public class SpelExpression implements Expression {
@Override
public Class> getValueType(EvaluationContext context) throws EvaluationException {
- Assert.notNull(context, "The EvaluationContext is required");
- ExpressionState eState = new ExpressionState(context, this.configuration);
- TypeDescriptor typeDescriptor = this.ast.getValueInternal(eState).getTypeDescriptor();
+ Assert.notNull(context, "EvaluationContext is required");
+ ExpressionState expressionState = new ExpressionState(context, this.configuration);
+ TypeDescriptor typeDescriptor = this.ast.getValueInternal(expressionState).getTypeDescriptor();
return (typeDescriptor != null ? typeDescriptor.getType() : null);
}
@Override
public Class> getValueType(EvaluationContext context, Object rootObject) throws EvaluationException {
- ExpressionState eState = new ExpressionState(context, toTypedValue(rootObject), this.configuration);
- TypeDescriptor typeDescriptor = this.ast.getValueInternal(eState).getTypeDescriptor();
+ ExpressionState expressionState = new ExpressionState(context, toTypedValue(rootObject), this.configuration);
+ TypeDescriptor typeDescriptor = this.ast.getValueInternal(expressionState).getTypeDescriptor();
return (typeDescriptor != null ? typeDescriptor.getType() : null);
}
@@ -365,22 +364,23 @@ public class SpelExpression implements Expression {
@Override
public TypeDescriptor getValueTypeDescriptor(Object rootObject) throws EvaluationException {
- ExpressionState eState = new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), this.configuration);
- return this.ast.getValueInternal(eState).getTypeDescriptor();
+ ExpressionState expressionState =
+ new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), this.configuration);
+ return this.ast.getValueInternal(expressionState).getTypeDescriptor();
}
@Override
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context) throws EvaluationException {
- Assert.notNull(context, "The EvaluationContext is required");
- ExpressionState eState = new ExpressionState(context, this.configuration);
- return this.ast.getValueInternal(eState).getTypeDescriptor();
+ Assert.notNull(context, "EvaluationContext is required");
+ ExpressionState expressionState = new ExpressionState(context, this.configuration);
+ return this.ast.getValueInternal(expressionState).getTypeDescriptor();
}
@Override
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, Object rootObject) throws EvaluationException {
- Assert.notNull(context, "The EvaluationContext is required");
- ExpressionState eState = new ExpressionState(context, toTypedValue(rootObject), this.configuration);
- return this.ast.getValueInternal(eState).getTypeDescriptor();
+ Assert.notNull(context, "EvaluationContext is required");
+ ExpressionState expressionState = new ExpressionState(context, toTypedValue(rootObject), this.configuration);
+ return this.ast.getValueInternal(expressionState).getTypeDescriptor();
}
@Override
@@ -390,7 +390,7 @@ public class SpelExpression implements Expression {
@Override
public boolean isWritable(EvaluationContext context) throws EvaluationException {
- Assert.notNull(context, "The EvaluationContext is required");
+ Assert.notNull(context, "EvaluationContext is required");
return this.ast.isWritable(new ExpressionState(context, this.configuration));
}
@@ -401,13 +401,13 @@ public class SpelExpression implements Expression {
@Override
public boolean isWritable(EvaluationContext context, Object rootObject) throws EvaluationException {
- Assert.notNull(context, "The EvaluationContext is required");
+ Assert.notNull(context, "EvaluationContext is required");
return this.ast.isWritable(new ExpressionState(context, toTypedValue(rootObject), this.configuration));
}
@Override
public void setValue(EvaluationContext context, Object value) throws EvaluationException {
- Assert.notNull(context, "The EvaluationContext is required");
+ Assert.notNull(context, "EvaluationContext is required");
this.ast.setValue(new ExpressionState(context, this.configuration), value);
}
@@ -418,15 +418,14 @@ public class SpelExpression implements Expression {
@Override
public void setValue(EvaluationContext context, Object rootObject, Object value) throws EvaluationException {
- Assert.notNull(context, "The EvaluationContext is required");
+ Assert.notNull(context, "EvaluationContext is required");
this.ast.setValue(new ExpressionState(context, toTypedValue(rootObject), this.configuration), value);
}
- // impl only
-
/**
- * Compile the expression if it has been evaluated more than the threshold number of times to trigger compilation.
+ * Compile the expression if it has been evaluated more than the threshold number
+ * of times to trigger compilation.
* @param expressionState the expression state used to determine compilation mode
*/
private void checkCompile(ExpressionState expressionState) {
@@ -486,16 +485,16 @@ public class SpelExpression implements Expression {
}
/**
- * @return return the Abstract Syntax Tree for the expression
+ * Return the Abstract Syntax Tree for the expression.
*/
public SpelNode getAST() {
return this.ast;
}
/**
- * Produce a string representation of the Abstract Syntax Tree for the expression, this should ideally look like the
- * input expression, but properly formatted since any unnecessary whitespace will have been discarded during the
- * parse of the expression.
+ * Produce a string representation of the Abstract Syntax Tree for the expression.
+ * This should ideally look like the input expression, but properly formatted since any
+ * unnecessary whitespace will have been discarded during the parse of the expression.
* @return the string representation of the AST
*/
public String toStringAST() {
diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/DelegatingConnectionFactory.java b/spring-jms/src/main/java/org/springframework/jms/connection/DelegatingConnectionFactory.java
index 85a1a589de..0b81da699f 100644
--- a/spring-jms/src/main/java/org/springframework/jms/connection/DelegatingConnectionFactory.java
+++ b/spring-jms/src/main/java/org/springframework/jms/connection/DelegatingConnectionFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@ public class DelegatingConnectionFactory
/**
* Indicate whether Connections obtained from the target factory are supposed
* to be stopped before closed ("true") or simply closed ("false").
- * The latter may be necessary for some connection pools that simply return
+ * An extra stop call may be necessary for some connection pools that simply return
* released connections to the pool, not stopping them while they sit in the pool.
* Default is "false", simply closing Connections.
* @see ConnectionFactoryUtils#releaseConnection
diff --git a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java
index 2a5dbf95e1..d754324e4d 100644
--- a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java
+++ b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java
@@ -72,13 +72,19 @@ import static org.mockito.BDDMockito.*;
public class JmsTemplateTests {
private Context jndiContext;
+
private ConnectionFactory connectionFactory;
+
protected Connection connection;
+
private Session session;
+
private Destination queue;
private int deliveryMode = DeliveryMode.PERSISTENT;
+
private int priority = 9;
+
private int timeToLive = 10000;
@@ -94,8 +100,7 @@ public class JmsTemplateTests {
queue = mock(Queue.class);
given(connectionFactory.createConnection()).willReturn(connection);
- given(connection.createSession(useTransactedTemplate(),
- Session.AUTO_ACKNOWLEDGE)).willReturn(session);
+ given(connection.createSession(useTransactedTemplate(), Session.AUTO_ACKNOWLEDGE)).willReturn(session);
given(session.getTransacted()).willReturn(useTransactedSession());
given(jndiContext.lookup("testDestination")).willReturn(queue);
}
@@ -126,6 +131,7 @@ public class JmsTemplateTests {
return session;
}
+
@Test
public void testExceptionStackTrace() {
JMSException jmsEx = new JMSException("could not connect");
diff --git a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTransactedTests.java b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTransactedTests.java
index 27da72ac8d..eb2d0cc87c 100644
--- a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTransactedTests.java
+++ b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTransactedTests.java
@@ -30,12 +30,12 @@ public class JmsTemplateTransactedTests extends JmsTemplateTests {
private Session localSession;
+
@Override
public void setupMocks() throws Exception {
super.setupMocks();
this.localSession = mock(Session.class);
- given(this.connection.createSession(false,
- Session.AUTO_ACKNOWLEDGE)).willReturn(this.localSession);
+ given(this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE)).willReturn(this.localSession);
}
@Override
diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/DestinationPatternsMessageCondition.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/DestinationPatternsMessageCondition.java
index c1d5b87f1c..919aa70e62 100644
--- a/spring-messaging/src/main/java/org/springframework/messaging/handler/DestinationPatternsMessageCondition.java
+++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/DestinationPatternsMessageCondition.java
@@ -38,8 +38,7 @@ import org.springframework.util.StringUtils;
* @author Rossen Stoyanchev
* @since 4.0
*/
-public final class DestinationPatternsMessageCondition
- extends AbstractMessageCondition
- * {@link #clientInboundChannel()} and {@link #clientOutboundChannel()} deliver messages
- * to and from remote clients to several message handlers such as
+ *
+ * {@link #clientInboundChannel()} and {@link #clientOutboundChannel()} deliver
+ * messages to and from remote clients to several message handlers such as
*
- * Sub-classes are responsible for the part of the configuration that feed messages
+ *
+ * Subclasses are responsible for the part of the configuration that feed messages
* to and from the client inbound/outbound channels (e.g. STOMP over WebSocket).
*
* @author Rossen Stoyanchev
@@ -78,10 +77,11 @@ import org.springframework.validation.Validator;
*/
public abstract class AbstractMessageBrokerConfiguration implements ApplicationContextAware {
+ private static final String MVC_VALIDATOR_NAME = "mvcValidator";
+
private static final boolean jackson2Present= ClassUtils.isPresent(
"com.fasterxml.jackson.databind.ObjectMapper", AbstractMessageBrokerConfiguration.class.getClassLoader());
- private static final String MVC_VALIDATOR_NAME = "mvcValidator";
private ChannelRegistration clientInboundChannelRegistration;
@@ -99,6 +99,16 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
}
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ this.applicationContext = applicationContext;
+ }
+
+ public ApplicationContext getApplicationContext() {
+ return this.applicationContext;
+ }
+
+
@Bean
public AbstractSubscribableChannel clientInboundChannel() {
ExecutorSubscribableChannel channel = new ExecutorSubscribableChannel(clientInboundChannelExecutor());
@@ -125,7 +135,6 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
return this.clientInboundChannelRegistration;
}
-
/**
* A hook for sub-classes to customize the message channel for inbound messages
* from WebSocket clients.
@@ -133,7 +142,6 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
protected void configureClientInboundChannel(ChannelRegistration registration) {
}
-
@Bean
public AbstractSubscribableChannel clientOutboundChannel() {
ExecutorSubscribableChannel channel = new ExecutorSubscribableChannel(clientOutboundChannelExecutor());
@@ -248,13 +256,13 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
@Bean
public AbstractBrokerMessageHandler simpleBrokerMessageHandler() {
SimpleBrokerMessageHandler handler = getBrokerRegistry().getSimpleBroker(brokerChannel());
- return (handler != null) ? handler : new NoOpBrokerMessageHandler();
+ return (handler != null ? handler : new NoOpBrokerMessageHandler());
}
@Bean
public AbstractBrokerMessageHandler stompBrokerRelayMessageHandler() {
AbstractBrokerMessageHandler handler = getBrokerRegistry().getStompBrokerRelay(brokerChannel());
- return (handler != null) ? handler : new NoOpBrokerMessageHandler();
+ return (handler != null ? handler : new NoOpBrokerMessageHandler());
}
@Bean
@@ -294,9 +302,8 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
/**
* Override this method to add custom message converters.
* @param messageConverters the list to add converters to, initially empty
- *
* @return {@code true} if default message converters should be added to list,
- * {@code false} if no more converters should be added.
+ * {@code false} if no more converters should be added.
*/
protected boolean configureMessageConverters(List In order, this method tries to get a Validator instance:
* Also allows for the provision of value-added methods for portable yet
- * more capable EntityManager and EntityManagerFactory subinterfaces offered
- * by Spring.
- *
- * In general, it is recommended to derive from DefaultJpaDialect instead of
- * implementing this interface directly. This allows for inheriting common
- * behavior (present and future) from DefaultJpaDialect, only overriding
- * specific hooks to plug in concrete vendor-specific behavior.
+ * In general, it is recommended to derive from {@link DefaultJpaDialect} instead
+ * of implementing this interface directly. This allows for inheriting common behavior
+ * (present and future) from DefaultJpaDialect, only overriding specific hooks to
+ * plug in concrete vendor-specific behavior.
*
* @author Juergen Hoeller
* @author Rod Johnson
@@ -141,9 +137,8 @@ public interface JpaDialect extends PersistenceExceptionTranslator {
* an implementation should use a special handle that references that other object.
* @param entityManager the current JPA EntityManager
* @param readOnly whether the Connection is only needed for read-only purposes
- * @return a handle for the JDBC Connection, to be passed into
- * {@code releaseJdbcConnection}, or {@code null}
- * if no JDBC Connection can be retrieved
+ * @return a handle for the Connection, to be passed into {@code releaseJdbcConnection},
+ * or {@code null} if no JDBC Connection can be retrieved
* @throws javax.persistence.PersistenceException if thrown by JPA methods
* @throws java.sql.SQLException if thrown by JDBC methods
* @see #releaseJdbcConnection
diff --git a/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java b/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java
index 564f582edf..a7f035097a 100644
--- a/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java
+++ b/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,12 +29,12 @@ import java.lang.annotation.Target;
* associated with a test is dirty and should be closed:
*
* Use this annotation if a test has modified the context — for example,
diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java
index 9c5f0aefb4..6524b65db4 100644
--- a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java
+++ b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java
@@ -49,9 +49,9 @@ import org.springframework.test.context.web.ServletTestExecutionListener;
* TestExecutionListeners} are configured by default:
*
* Note: this class serves only as a convenience for extension. If you do not
@@ -76,8 +76,8 @@ import org.springframework.test.context.web.ServletTestExecutionListener;
* @see org.springframework.test.context.testng.AbstractTestNGSpringContextTests
*/
@RunWith(SpringJUnit4ClassRunner.class)
-@TestExecutionListeners({ ServletTestExecutionListener.class, DependencyInjectionTestExecutionListener.class,
- DirtiesContextTestExecutionListener.class })
+@TestExecutionListeners({ServletTestExecutionListener.class, DependencyInjectionTestExecutionListener.class,
+ DirtiesContextTestExecutionListener.class})
public abstract class AbstractJUnit4SpringContextTests implements ApplicationContextAware {
/**
diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java
index 5b55e3384c..6299311b13 100644
--- a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java
+++ b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java
@@ -53,11 +53,11 @@ import org.springframework.transaction.annotation.Transactional;
* TestExecutionListeners} are configured by default:
*
* Note: this class serves only as a convenience for extension. If you do not
@@ -86,7 +86,7 @@ import org.springframework.transaction.annotation.Transactional;
* @see org.springframework.test.jdbc.JdbcTestUtils
* @see org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests
*/
-@TestExecutionListeners({ TransactionalTestExecutionListener.class, SqlScriptsTestExecutionListener.class })
+@TestExecutionListeners({TransactionalTestExecutionListener.class, SqlScriptsTestExecutionListener.class})
@Transactional
public abstract class AbstractTransactionalJUnit4SpringContextTests extends AbstractJUnit4SpringContextTests {
diff --git a/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java
index 32b4b52ff4..9becd20bd0 100644
--- a/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java
+++ b/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java
@@ -63,9 +63,9 @@ import org.springframework.test.context.web.ServletTestExecutionListener;
* TestExecutionListeners} are configured by default:
*
* Action Request:
* Render Request:
* Called after a HandlerMapping determines an appropriate handler object
@@ -305,8 +295,7 @@ public interface HandlerInterceptor {
* request execution may have failed even when this argument is {@code null})
* @throws Exception in case of errors
*/
- void afterEventCompletion(
- EventRequest request, EventResponse response, Object handler, Exception ex)
+ void afterEventCompletion(EventRequest request, EventResponse response, Object handler, Exception ex)
throws Exception;
}
diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractController.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractController.java
index de00d6f077..cc703aee27 100644
--- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractController.java
+++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractController.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,69 +41,69 @@ import org.springframework.web.portlet.util.PortletUtils;
* Workflow
* (and that defined by interface): Exposed configuration properties
* (and those defined by interface): TIP: The controller mapping will be run twice by the PortletDispatcher for
diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/ParameterizableViewController.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/ParameterizableViewController.java
index ab4818effa..7dc8640578 100644
--- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/ParameterizableViewController.java
+++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/ParameterizableViewController.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,42 +22,37 @@ import javax.portlet.RenderResponse;
import org.springframework.web.portlet.ModelAndView;
/**
- * Trivial controller that always returns a named view. The view
- * can be configured using an exposed configuration property. This
- * controller offers an alternative to sending a request straight to a view
- * such as a JSP. The advantage here is that the client is not exposed to
- * the concrete view technology but rather just to the controller URL;
- * the concrete view will be determined by the ViewResolver. Workflow
- * (and that defined by superclass): This controller does not handle action requests. This controller does not handle action requests.
*
* Exposed configuration properties
- * (and those defined by superclass): This class registers the following {@link HandlerMapping}s: Note: Additional HandlerMappings may be registered
@@ -96,30 +96,30 @@ import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolv
*
* This class registers the following {@link HandlerAdapter}s:
* This class registers the following {@link HandlerExceptionResolver}s:
* This class registers an {@link org.springframework.util.AntPathMatcher}
* and a {@link org.springframework.web.util.UrlPathHelper} to be used by:
* Configured path matcher and path helper instances are shared for:
* This class registers the following {@link HandlerMapping}s: Registers these {@link HandlerAdapter}s:
* Registers a {@link HandlerExceptionResolverComposite} with this chain of
* exception resolvers:
* Registers an {@link AntPathMatcher} and a {@link UrlPathHelper}
* to be used by:
* Adds the following exception resolvers:
* Convenient superclass for controller implementations, using the Template
- * Method design pattern. As stated in the {@link Controller Controller}
- * interface, a lot of functionality is already provided by certain abstract
- * base controllers. The AbstractController is one of the most important
- * abstract base controller providing basic features such as the generation
- * of caching headers and the enabling or disabling of
- * supported methods (GET/POST). Convenient superclass for controller implementations, using the Template Method
+ * design pattern.
*
* Workflow
* (and that defined by interface):Constraints when authoring {@code @Configuration} classes
*
- *
*
* @author Rod Johnson
@@ -337,12 +337,10 @@ public @interface Configuration {
* Explicitly specify the name of the Spring bean definition associated
* with this Configuration class. If left unspecified (the common case),
* a bean name will be automatically generated.
- *
*
- *
*/
@Override
diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java
index d40b6e4a40..259b8ca024 100644
--- a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java
+++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
-import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -56,20 +55,20 @@ import org.springframework.validation.Validator;
/**
* Provides essential configuration for handling messages with simple messaging
* protocols such as STOMP.
- *
- *
* while {@link #brokerChannel()} delivers messages from within the application to the
* the respective message handlers. {@link #brokerMessagingTemplate()} can be injected
* into any application component to send messages.
- *
- *
*/
protected Validator simpValidator() {
@@ -350,11 +349,8 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
String className = "org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean";
clazz = ClassUtils.forName(className, AbstractMessageBrokerConfiguration.class.getClassLoader());
}
- catch (ClassNotFoundException e) {
- throw new BeanInitializationException("Could not find default validator", e);
- }
- catch (LinkageError e) {
- throw new BeanInitializationException("Could not find default validator", e);
+ catch (Throwable ex) {
+ throw new BeanInitializationException("Could not find default validator class", ex);
}
validator = (Validator) BeanUtils.instantiate(clazz);
}
@@ -403,6 +399,6 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
@Override
protected void handleMessageInternal(Message> message) {
}
- };
+ }
}
diff --git a/spring-messaging/src/main/java/org/springframework/messaging/support/ImmutableMessageChannelInterceptor.java b/spring-messaging/src/main/java/org/springframework/messaging/support/ImmutableMessageChannelInterceptor.java
index c2921857fd..02b21bd267 100644
--- a/spring-messaging/src/main/java/org/springframework/messaging/support/ImmutableMessageChannelInterceptor.java
+++ b/spring-messaging/src/main/java/org/springframework/messaging/support/ImmutableMessageChannelInterceptor.java
@@ -32,7 +32,6 @@ import org.springframework.messaging.MessageChannel;
*/
public class ImmutableMessageChannelInterceptor extends ChannelInterceptorAdapter {
-
@Override
public Message> preSend(Message> message, MessageChannel channel) {
MessageHeaderAccessor accessor = MessageHeaderAccessor.getAccessor(message, MessageHeaderAccessor.class);
diff --git a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java
index 944ea4a80a..dcbfbdb51c 100644
--- a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java
+++ b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java
@@ -260,7 +260,7 @@ public class LocalSessionFactoryBuilder extends Configuration {
* @see #scanPackages
*/
public LocalSessionFactoryBuilder addPackages(String... annotatedPackages) {
- for (String annotatedPackage :annotatedPackages) {
+ for (String annotatedPackage : annotatedPackages) {
addPackage(annotatedPackage);
}
return this;
diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaDialect.java b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaDialect.java
index 11529655b6..51382cfd73 100644
--- a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaDialect.java
+++ b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaDialect.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,19 +26,15 @@ import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionException;
/**
- * SPI strategy that encapsulates certain functionality that standard JPA 2.0
- * does not offer, such as access to the underlying JDBC Connection. This
- * strategy is mainly intended for standalone usage of a JPA provider; most
- * of its functionality is not relevant when running with JTA transactions.
+ * SPI strategy that encapsulates certain functionality that standard JPA 2.0 does
+ * not offer, such as access to the underlying JDBC Connection. This strategy is
+ * mainly intended for standalone usage of a JPA provider; most of its functionality
+ * is not relevant when running with JTA transactions.
*
- *
- *
*
*
- *
*
*
- *
*
*
- *
*
* @author Sam Brannen
@@ -81,8 +81,8 @@ import org.springframework.test.context.web.ServletTestExecutionListener;
* @see AbstractTransactionalTestNGSpringContextTests
* @see org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests
*/
-@TestExecutionListeners({ ServletTestExecutionListener.class, DependencyInjectionTestExecutionListener.class,
- DirtiesContextTestExecutionListener.class })
+@TestExecutionListeners({ServletTestExecutionListener.class, DependencyInjectionTestExecutionListener.class,
+ DirtiesContextTestExecutionListener.class})
public abstract class AbstractTestNGSpringContextTests implements IHookable, ApplicationContextAware {
/** Logger available to subclasses */
diff --git a/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.java
index ccaf0547d1..45c9e7186c 100644
--- a/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.java
+++ b/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.java
@@ -52,11 +52,11 @@ import org.springframework.transaction.annotation.Transactional;
* TestExecutionListeners} are configured by default:
*
*
- *
*
* @author Sam Brannen
@@ -75,7 +75,7 @@ import org.springframework.transaction.annotation.Transactional;
* @see org.springframework.test.jdbc.JdbcTestUtils
* @see org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests
*/
-@TestExecutionListeners({ TransactionalTestExecutionListener.class, SqlScriptsTestExecutionListener.class })
+@TestExecutionListeners({TransactionalTestExecutionListener.class, SqlScriptsTestExecutionListener.class})
@Transactional
public abstract class AbstractTransactionalTestNGSpringContextTests extends AbstractTestNGSpringContextTests {
diff --git a/spring-web/src/main/java/org/springframework/web/util/Log4jWebConfigurer.java b/spring-web/src/main/java/org/springframework/web/util/Log4jWebConfigurer.java
index 4861703930..5fe7a6ae09 100644
--- a/spring-web/src/main/java/org/springframework/web/util/Log4jWebConfigurer.java
+++ b/spring-web/src/main/java/org/springframework/web/util/Log4jWebConfigurer.java
@@ -127,8 +127,7 @@ public abstract class Log4jWebConfigurer {
// Leave a URL (e.g. "classpath:" or "file:") as-is.
if (!ResourceUtils.isUrl(location)) {
- // Consider a plain file path as relative to the web
- // application root directory.
+ // Consider a plain file path as relative to the web application root directory.
location = WebUtils.getRealPath(servletContext, location);
}
diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerInterceptor.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerInterceptor.java
index d0c0a311f0..af442a75d5 100644
--- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerInterceptor.java
+++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,36 +74,32 @@ import javax.portlet.ResourceResponse;
*
*
- *
*
*
- *
*
* @author Juergen Hoeller
@@ -151,8 +147,7 @@ public interface HandlerInterceptor {
* request execution may have failed even when this argument is {@code null})
* @throws Exception in case of errors
*/
- void afterActionCompletion(
- ActionRequest request, ActionResponse response, Object handler, Exception ex)
+ void afterActionCompletion(ActionRequest request, ActionResponse response, Object handler, Exception ex)
throws Exception;
/**
@@ -191,8 +186,7 @@ public interface HandlerInterceptor {
* (can also be {@code null})
* @throws Exception in case of errors
*/
- void postHandleRender(
- RenderRequest request, RenderResponse response, Object handler, ModelAndView modelAndView)
+ void postHandleRender(RenderRequest request, RenderResponse response, Object handler, ModelAndView modelAndView)
throws Exception;
/**
@@ -208,8 +202,7 @@ public interface HandlerInterceptor {
* @param ex exception thrown on handler execution, if any
* @throws Exception in case of errors
*/
- void afterRenderCompletion(
- RenderRequest request, RenderResponse response, Object handler, Exception ex)
+ void afterRenderCompletion(RenderRequest request, RenderResponse response, Object handler, Exception ex)
throws Exception;
/**
@@ -248,8 +241,7 @@ public interface HandlerInterceptor {
* (can also be {@code null})
* @throws Exception in case of errors
*/
- void postHandleResource(
- ResourceRequest request, ResourceResponse response, Object handler, ModelAndView modelAndView)
+ void postHandleResource(ResourceRequest request, ResourceResponse response, Object handler, ModelAndView modelAndView)
throws Exception;
/**
@@ -265,11 +257,9 @@ public interface HandlerInterceptor {
* @param ex exception thrown on handler execution, if any
* @throws Exception in case of errors
*/
- void afterResourceCompletion(
- ResourceRequest request, ResourceResponse response, Object handler, Exception ex)
+ void afterResourceCompletion(ResourceRequest request, ResourceResponse response, Object handler, Exception ex)
throws Exception;
-
/**
* Intercept the execution of a handler in the action phase.
*
*
- *
*
*
*
- *
*
*
- *
- * name
- * default
- * description
- *
- *
- * requireSession
- * false
- * whether a session should be required for requests to be able to
- * be handled by this controller. This ensures, derived controller
- * can - without fear of Nullpointers - call request.getSession() to
- * retrieve a session. If no session can be found while processing
- * the request, a PortletException will be thrown
- *
- *
- * synchronizeOnSession
- * false
- * whether the calls to {@code handleRenderRequestInternal} and
- * {@code handleRenderRequestInternal} should be
- * synchronized around the PortletSession, to serialize invocations
- * from the same client. No effect if there is no PortletSession.
- *
- *
- *
- * cacheSeconds
- * -1
- * indicates the amount of seconds to specify caching is allowed in
- * the render response generatedby this request. 0 (zero) will indicate
- * no caching is allowed at all, -1 (the default) will not override the
- * portlet configuration and any positive number will cause the render
- * response to declare the amount indicated as seconds to cache the content
- *
- *
+ * renderWhenMinimized
- * false
- * whether should be rendered when the portlet is in a minimized state --
- * will return null for the ModelandView when the portlet is minimized
- * and this is false
- *
+ *
+ * name
+ * default
+ * description
+ *
+ *
+ * requireSession
+ * false
+ * whether a session should be required for requests to be able to
+ * be handled by this controller. This ensures, derived controller
+ * can - without fear of Nullpointers - call request.getSession() to
+ * retrieve a session. If no session can be found while processing
+ * the request, a PortletException will be thrown
+ *
+ *
+ * synchronizeOnSession
+ * false
+ * whether the calls to {@code handleRenderRequestInternal} and
+ * {@code handleRenderRequestInternal} should be synchronized around
+ * the PortletSession, to serialize invocations from the same client.
+ * No effect if there is no PortletSession.
+ *
+ *
+ *
+ * cacheSeconds
+ * -1
+ * indicates the amount of seconds to specify caching is allowed in
+ * the render response generatedby this request. 0 (zero) will indicate
+ * no caching is allowed at all, -1 (the default) will not override the
+ * portlet configuration and any positive number will cause the render
+ * response to declare the amount indicated as seconds to cache the content
+ *
+ *
* renderWhenMinimized
+ * false
+ * whether should be rendered when the portlet is in a minimized state --
+ * will return null for the ModelandView when the portlet is minimized
+ * and this is false
+ *
+ * (and that defined by superclass):
*
- *
- *
+ * (and those defined by superclass):
*
- *
- *
- *
- * name
- * default
- * description
- *
- *
+ * viewName
- * null
- * the name of the view the viewResolver will use to forward to
- * (if this property is not set, an exception will be thrown during
- * initialization)
- *
+ *
+ * name
+ * default
+ * description
+ *
+ *
* viewName
+ * null
+ * the name of the view the viewResolver will use to forward to (if this property
+ * is not set, an exception will be thrown during initialization)
+ *
- *
*
*
- *
*
*
- *
*
*
- *
* Note that those beans can be configured by using the {@code path-matching} MVC namespace element.
*
@@ -127,12 +127,12 @@ import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolv
* {@link ExceptionHandlerExceptionResolver} are configured with instances of
* the following by default:
*
- *
*
* @author Keith Donald
@@ -576,10 +576,12 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
if (StringUtils.hasText("bean")) {
reference = new RuntimeBeanReference(refElement.getAttribute("bean"),false);
list.add(reference);
- }else if (StringUtils.hasText("parent")){
+ }
+ else if (StringUtils.hasText("parent")){
reference = new RuntimeBeanReference(refElement.getAttribute("parent"),true);
list.add(reference);
- }else{
+ }
+ else {
parserContext.getReaderContext().error("'bean' or 'parent' attribute is required for element",
parserContext.extractSource(parentElement));
}
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.java
index dbede71a53..8203ea201c 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.java
@@ -22,11 +22,12 @@ import org.springframework.web.util.UrlPathHelper;
/**
* Helps with configuring HandlerMappings path matching options such as trailing slash match,
* suffix registration, path matcher and path helper.
- * Configured path matcher and path helper instances are shared for:
+ *
+ *
- *
*
* @author Brian Clozel
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java
index 6886f6e00c..1aa538baac 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java
@@ -102,45 +102,45 @@ import org.springframework.web.util.UrlPathHelper;
*
*
- *
*
*
- *
*
*
- *
*
*
- *
* Note that those beans can be configured with a {@link PathMatchConfigurer}.
*
@@ -148,12 +148,12 @@ import org.springframework.web.util.UrlPathHelper;
* {@link ExceptionHandlerExceptionResolver} are configured with default
* instances of the following by default:
*
- *
*
* @author Rossen Stoyanchev
@@ -439,9 +439,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
* through annotated controller methods. Consider overriding one of these
* other more fine-grained methods:
*
- *
*/
@Bean
@@ -763,17 +763,16 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
* A method available to subclasses for adding default {@link HandlerExceptionResolver}s.
*
- *
*/
protected final void addDefaultHandlerExceptionResolvers(List
- *
* @since 4.0.3
*/
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractController.java
index ec2c81639b..772953ffee 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractController.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractController.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,72 +25,64 @@ import org.springframework.web.servlet.support.WebContentGenerator;
import org.springframework.web.util.WebUtils;
/**
- *
*
- *
- *
Exposed configuration properties
* (and those defined by interface):
*
| name - * | default | - *description | - *
| supportedMethods | - *GET,POST | - *comma-separated (CSV) list of methods supported by this controller, - * such as GET, POST and PUT | - *
| requireSession | - *false | - *whether a session should be required for requests to be able to - * be handled by this controller. This ensures that derived controller - * can - without fear of null pointers - call request.getSession() to - * retrieve a session. If no session can be found while processing - * the request, a ServletException will be thrown | - *
| cacheSeconds | - *-1 | - *indicates the amount of seconds to include in the cache header - * for the response following on this request. 0 (zero) will include - * headers for no caching at all, -1 (the default) will not generate - * any headers and any positive number will generate headers - * that state the amount indicated as seconds to cache the content | - *
| synchronizeOnSession | - *false | - *whether the call to {@code handleRequestInternal} should be - * synchronized around the HttpSession, to serialize invocations - * from the same client. No effect if there is no HttpSession. - * | - *
| name + * | default | + *description | + *
| supportedMethods | + *GET,POST | + *comma-separated (CSV) list of methods supported by this controller, + * such as GET, POST and PUT | + *
| requireSession | + *false | + *whether a session should be required for requests to be able to + * be handled by this controller. This ensures that derived controller + * can - without fear of null pointers - call request.getSession() to + * retrieve a session. If no session can be found while processing + * the request, a ServletException will be thrown | + *
| cacheSeconds | + *-1 | + *indicates the amount of seconds to include in the cache header + * for the response following on this request. 0 (zero) will include + * headers for no caching at all, -1 (the default) will not generate + * any headers and any positive number will generate headers + * that state the amount indicated as seconds to cache the content | + *
| synchronizeOnSession | + *false | + *whether the call to {@code handleRequestInternal} should be + * synchronized around the HttpSession, to serialize invocations + * from the same client. No effect if there is no HttpSession. + * | + *
Can optionally prepend a {@link #setPrefix prefix} and/or append a * {@link #setSuffix suffix} to build the viewname from the URL filename. * - *
Find below some examples: - * + *
Find some examples below: *
Thanks to David Barri for suggesting prefix/suffix support! diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/AbstractVersionStrategy.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/AbstractVersionStrategy.java index 17d72700e8..ebd4e73c57 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/AbstractVersionStrategy.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/AbstractVersionStrategy.java @@ -1,3 +1,19 @@ +/* + * Copyright 2002-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.web.servlet.resource; import java.util.regex.Matcher; @@ -11,10 +27,11 @@ import org.springframework.util.StringUtils; /** * Abstract base class for {@link VersionStrategy} implementations. - * Supports versions as: + * + *
Supports versions as: *
Note: This base class does not provide support for generating the @@ -32,7 +49,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy { protected AbstractVersionStrategy(VersionPathStrategy pathStrategy) { - Assert.notNull(pathStrategy, "'pathStrategy' is required"); + Assert.notNull(pathStrategy, "VersionPathStrategy is required"); this.pathStrategy = pathStrategy; } @@ -66,9 +83,8 @@ public abstract class AbstractVersionStrategy implements VersionStrategy { private final String prefix; - public PrefixVersionPathStrategy(String version) { - Assert.hasText(version, "'version' is required and must not be empty"); + Assert.hasText(version, "'version' must not be empty"); this.prefix = version; } @@ -86,9 +102,9 @@ public abstract class AbstractVersionStrategy implements VersionStrategy { public String addVersion(String path, String version) { return (this.prefix.endsWith("/") || path.startsWith("/") ? this.prefix + path : this.prefix + "/" + path); } - } + /** * File name-based {@code VersionPathStrategy}, * e.g. {@code "path/foo-{version}.css"}. @@ -97,7 +113,6 @@ public abstract class AbstractVersionStrategy implements VersionStrategy { private static final Pattern pattern = Pattern.compile("-(\\S*)\\."); - @Override public String extractVersion(String requestPath) { Matcher matcher = pattern.matcher(requestPath); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/AppCacheManifestTransformer.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/AppCacheManifestTransformer.java index cf86d40631..b4628118bf 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/AppCacheManifestTransformer.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/AppCacheManifestTransformer.java @@ -40,22 +40,21 @@ import org.springframework.util.StringUtils; * *
This transformer: *
This hash is computed using the content of the appcache manifest and the content of the linked resources; so - * changing a resource linked in the manifest or the manifest itself should invalidate the browser cache. + *
This hash is computed using the content of the appcache manifest and the content of the linked resources;
+ * so changing a resource linked in the manifest or the manifest itself should invalidate the browser cache.
*
* @author Brian Clozel
- * @see HTML5 offline
- * applications spec
* @since 4.1
+ * @see HTML5 offline applications spec
*/
public class AppCacheManifestTransformer extends ResourceTransformerSupport {
@@ -65,6 +64,7 @@ public class AppCacheManifestTransformer extends ResourceTransformerSupport {
private static final Log logger = LogFactory.getLog(AppCacheManifestTransformer.class);
+
private final Map