diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java index 2729d82af1b..ec236a1afdb 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java @@ -84,26 +84,6 @@ public abstract class AopUtils { return (object instanceof SpringProxy && ClassUtils.isCglibProxy(object)); } - /** - * Check whether the specified class is a CGLIB-generated class. - * @param clazz the class to check - * @deprecated as of Spring 3.1 in favor of {@link ClassUtils#isCglibProxyClass(Class)} - */ - @Deprecated - public static boolean isCglibProxyClass(Class> clazz) { - return ClassUtils.isCglibProxyClass(clazz); - } - - /** - * Check whether the specified class name is a CGLIB-generated class. - * @param className the class name to check - * @deprecated as of Spring 3.1 in favor of {@link ClassUtils#isCglibProxyClassName(String)} - */ - @Deprecated - public static boolean isCglibProxyClassName(String className) { - return ClassUtils.isCglibProxyClassName(className); - } - /** * Determine the target class of the given bean instance which might be an AOP proxy. *
Returns the target class for an AOP proxy and the plain class else. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java index f70e163ce46..39d73b68f71 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.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. @@ -166,16 +166,6 @@ public class BeanDefinitionBuilder { return this; } - /** - * Add an indexed constructor arg value. The current index is tracked internally - * and all additions are at the present point. - * @deprecated since Spring 2.5, in favor of {@link #addConstructorArgValue} - */ - @Deprecated - public BeanDefinitionBuilder addConstructorArg(Object value) { - return addConstructorArgValue(value); - } - /** * Add an indexed constructor arg value. The current index is tracked internally * and all additions are at the present point. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSimpleBeanDefinitionParser.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSimpleBeanDefinitionParser.java index 70adeede2b2..67fb7fde918 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSimpleBeanDefinitionParser.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSimpleBeanDefinitionParser.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. @@ -148,27 +148,9 @@ public abstract class AbstractSimpleBeanDefinitionParser extends AbstractSingleB * @see #isEligibleAttribute(String) */ protected boolean isEligibleAttribute(Attr attribute, ParserContext parserContext) { - boolean eligible = isEligibleAttribute(attribute); - if (!eligible) { - String fullName = attribute.getName(); - eligible = (!fullName.equals("xmlns") && !fullName.startsWith("xmlns:") && - isEligibleAttribute(parserContext.getDelegate().getLocalName(attribute))); - } - return eligible; - } - - /** - * Determine whether the given attribute is eligible for being - * turned into a corresponding bean property value. - *
The default implementation considers any attribute as eligible, - * except for the "id" attribute and namespace declaration attributes. - * @param attribute the XML attribute to check - * @see #isEligibleAttribute(String) - * @deprecated in favour of {@link #isEligibleAttribute(org.w3c.dom.Attr, ParserContext)} - */ - @Deprecated - protected boolean isEligibleAttribute(Attr attribute) { - return false; + String fullName = attribute.getName(); + return (!fullName.equals("xmlns") && !fullName.startsWith("xmlns:") && + isEligibleAttribute(parserContext.getDelegate().getLocalName(attribute))); } /** diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDocumentReader.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDocumentReader.java index 86e5fd9f5a1..a41bd8b343b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDocumentReader.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDocumentReader.java @@ -37,15 +37,6 @@ import org.springframework.core.env.Environment; */ public interface BeanDefinitionDocumentReader { - /** - * Set the Environment to use when reading bean definitions. - *
Used for evaluating profile information to determine whether a
- * {@code Uses a JDBC Statement, not a PreparedStatement. If you want to
- * execute a static query with a PreparedStatement, use the overloaded
- * {@code queryForLong} method with {@code null} as argument array.
- * This method is useful for running static SQL with a known outcome.
- * The query is expected to be a single row/single column query that results
- * in a long value.
- * @param sql SQL query to execute
- * @return the long value, or 0 in case of SQL NULL
- * @throws IncorrectResultSizeDataAccessException if the query does not return
- * exactly one row, or does not return exactly one column in that row
- * @throws DataAccessException if there is any problem executing the query
- * @see #queryForLong(String, Object[])
- * @deprecated in favor of {@link #queryForObject(String, Class)}
- */
- @Deprecated
- long queryForLong(String sql) throws DataAccessException;
-
- /**
- * Execute a query that results in an int value, given static SQL.
- * Uses a JDBC Statement, not a PreparedStatement. If you want to
- * execute a static query with a PreparedStatement, use the overloaded
- * {@code queryForInt} method with {@code null} as argument array.
- * This method is useful for running static SQL with a known outcome.
- * The query is expected to be a single row/single column query that results
- * in an int value.
- * @param sql SQL query to execute
- * @return the int value, or 0 in case of SQL NULL
- * @throws IncorrectResultSizeDataAccessException if the query does not return
- * exactly one row, or does not return exactly one column in that row
- * @throws DataAccessException if there is any problem executing the query
- * @see #queryForInt(String, Object[])
- * @deprecated in favor of {@link #queryForObject(String, Class)}
- */
- @Deprecated
- int queryForInt(String sql) throws DataAccessException;
-
/**
* Execute a query for a result list, given static SQL.
* Uses a JDBC Statement, not a PreparedStatement. If you want to
@@ -695,86 +657,6 @@ public interface JdbcOperations {
*/
Map The query is expected to be a single row/single column query that
- * results in a long value.
- * @param sql SQL query to execute
- * @param args arguments to bind to the query
- * @param argTypes SQL types of the arguments
- * (constants from {@code java.sql.Types})
- * @return the long value, or 0 in case of SQL NULL
- * @throws IncorrectResultSizeDataAccessException if the query does not return
- * exactly one row, or does not return exactly one column in that row
- * @throws DataAccessException if the query fails
- * @see #queryForLong(String)
- * @see java.sql.Types
- * @deprecated in favor of {@link #queryForObject(String, Object[], int[], Class)} )}
- */
- @Deprecated
- long queryForLong(String sql, Object[] args, int[] argTypes) throws DataAccessException;
-
- /**
- * Query given SQL to create a prepared statement from SQL and a
- * list of arguments to bind to the query, resulting in a long value.
- * The query is expected to be a single row/single column query that
- * results in a long value.
- * @param sql SQL query to execute
- * @param args arguments to bind to the query
- * (leaving it to the PreparedStatement to guess the corresponding SQL type);
- * may also contain {@link SqlParameterValue} objects which indicate not
- * only the argument value but also the SQL type and optionally the scale
- * @return the long value, or 0 in case of SQL NULL
- * @throws IncorrectResultSizeDataAccessException if the query does not return
- * exactly one row, or does not return exactly one column in that row
- * @throws DataAccessException if the query fails
- * @see #queryForLong(String)
- * @deprecated in favor of {@link #queryForObject(String, Class, Object[])} )}
- */
- @Deprecated
- long queryForLong(String sql, Object... args) throws DataAccessException;
-
- /**
- * Query given SQL to create a prepared statement from SQL and a
- * list of arguments to bind to the query, resulting in an int value.
- * The query is expected to be a single row/single column query that
- * results in an int value.
- * @param sql SQL query to execute
- * @param args arguments to bind to the query
- * @param argTypes SQL types of the arguments
- * (constants from {@code java.sql.Types})
- * @return the int value, or 0 in case of SQL NULL
- * @throws IncorrectResultSizeDataAccessException if the query does not return
- * exactly one row, or does not return exactly one column in that row
- * @throws DataAccessException if the query fails
- * @see #queryForInt(String)
- * @see java.sql.Types
- * @deprecated in favor of {@link #queryForObject(String, Object[], int[], Class)} )}
- */
- @Deprecated
- int queryForInt(String sql, Object[] args, int[] argTypes) throws DataAccessException;
-
- /**
- * Query given SQL to create a prepared statement from SQL and a
- * list of arguments to bind to the query, resulting in an int value.
- * The query is expected to be a single row/single column query that
- * results in an int value.
- * @param sql SQL query to execute
- * @param args arguments to bind to the query
- * (leaving it to the PreparedStatement to guess the corresponding SQL type);
- * may also contain {@link SqlParameterValue} objects which indicate not
- * only the argument value but also the SQL type and optionally the scale
- * @return the int value, or 0 in case of SQL NULL
- * @throws IncorrectResultSizeDataAccessException if the query does not return
- * exactly one row, or does not return exactly one column in that row
- * @throws DataAccessException if the query fails
- * @see #queryForInt(String)
- * @deprecated in favor of {@link #queryForObject(String, Class, Object[])} )}
- */
- @Deprecated
- int queryForInt(String sql, Object... args) throws DataAccessException;
-
/**
* Query given SQL to create a prepared statement from SQL and a
* list of arguments to bind to the query, expecting a result list.
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java
index 6190090e4b8..650f32dcc38 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java
@@ -497,20 +497,6 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
return queryForObject(sql, getSingleColumnRowMapper(requiredType));
}
- @Override
- @Deprecated
- public long queryForLong(String sql) throws DataAccessException {
- Number number = queryForObject(sql, Long.class);
- return (number != null ? number.longValue() : 0);
- }
-
- @Override
- @Deprecated
- public int queryForInt(String sql) throws DataAccessException {
- Number number = queryForObject(sql, Integer.class);
- return (number != null ? number.intValue() : 0);
- }
-
@Override
public The query is expected to be a single row/single column query that
- * results in a long value.
- * @param sql SQL query to execute
- * @param paramSource container of arguments to bind to the query
- * @return the long value, or 0 in case of SQL NULL
- * @throws org.springframework.dao.IncorrectResultSizeDataAccessException
- * if the query does not return exactly one row, or does not return exactly
- * one column in that row
- * @throws org.springframework.dao.DataAccessException if the query fails
- * @see org.springframework.jdbc.core.JdbcTemplate#queryForLong(String)
- * @deprecated in favor of {@link #queryForObject(String, SqlParameterSource, Class)}
- */
- @Deprecated
- long queryForLong(String sql, SqlParameterSource paramSource) throws DataAccessException;
-
- /**
- * Query given SQL to create a prepared statement from SQL and a
- * list of arguments to bind to the query, resulting in a long value.
- * The query is expected to be a single row/single column query that
- * results in a long value.
- * @param sql SQL query to execute
- * @param paramMap map of parameters to bind to the query
- * (leaving it to the PreparedStatement to guess the corresponding SQL type)
- * @return the long value, or 0 in case of SQL NULL
- * @throws org.springframework.dao.IncorrectResultSizeDataAccessException
- * if the query does not return exactly one row, or does not return exactly
- * one column in that row
- * @throws org.springframework.dao.DataAccessException if the query fails
- * @see org.springframework.jdbc.core.JdbcTemplate#queryForLong(String)
- * @deprecated in favor of {@link #queryForObject(String, Map, Class)}
- */
- @Deprecated
- long queryForLong(String sql, Map The query is expected to be a single row/single column query that
- * results in an int value.
- * @param sql SQL query to execute
- * @param paramSource container of arguments to bind to the query
- * @return the int value, or 0 in case of SQL NULL
- * @throws org.springframework.dao.IncorrectResultSizeDataAccessException if the query does not return
- * exactly one row, or does not return exactly one column in that row
- * @throws org.springframework.dao.DataAccessException if the query fails
- * @see org.springframework.jdbc.core.JdbcTemplate#queryForInt(String)
- * @deprecated in favor of {@link #queryForObject(String, SqlParameterSource, Class)}
- */
- @Deprecated
- int queryForInt(String sql, SqlParameterSource paramSource) throws DataAccessException;
-
- /**
- * Query given SQL to create a prepared statement from SQL and a
- * list of arguments to bind to the query, resulting in an int value.
- * The query is expected to be a single row/single column query that
- * results in an int value.
- * @param sql SQL query to execute
- * @param paramMap map of parameters to bind to the query
- * (leaving it to the PreparedStatement to guess the corresponding SQL type)
- * @return the int value, or 0 in case of SQL NULL
- * @throws org.springframework.dao.IncorrectResultSizeDataAccessException if the query does not return
- * exactly one row, or does not return exactly one column in that row
- * @throws org.springframework.dao.DataAccessException if the query fails
- * @see org.springframework.jdbc.core.JdbcTemplate#queryForInt(String)
- * @deprecated in favor of {@link #queryForObject(String, Map, Class)}
- */
- @Deprecated
- int queryForInt(String sql, Map Given the following business class...
- *
- * The test for the above bad argument path can be expressed using
- * {@code AssertThrows} like so:
- *
- * This will result in the test passing if the {@code Foo.someBusinessLogic(..)}
- * method threw an {@code IllegalArgumentException}; if it did not, the
- * test would fail with the following message:
- *
- * If the wrong type of {@code Throwable} was thrown,
- * the test will also fail, this time with a message similar to the following:
- *
- * The test for the correct {@code Throwable} respects polymorphism,
- * so you can test that any old {@code Exception} is thrown like so:
- *
- * The default implementation simply fails the test by throwing an
- * {@link AssertionError}.
- * If you want to customize the failure message, consider overriding
- * {@link #createMessageForNoExceptionThrown()}, and / or supplying an
- * extra, contextual failure message via the appropriate constructor.
- * @see #getFailureMessage()
- * @see #createMessageForNoExceptionThrown()
- */
- protected void doFail() {
- throw new AssertionError(createMessageForNoExceptionThrown());
- }
-
- /**
- * Creates the failure message used if the test fails
- * (i.e. the expected exception is not thrown in the body of the test).
- * @return the failure message used if the test fails
- * @see #getFailureMessage()
- */
- protected String createMessageForNoExceptionThrown() {
- StringBuilder sb = new StringBuilder();
- sb.append("Should have thrown a [").append(this.getExpectedException()).append("]");
- if (getFailureMessage() != null) {
- sb.append(": ").append(getFailureMessage());
- }
- return sb.toString();
- }
-
- /**
- * Does the donkey work of checking (verifying) that the
- * {@link Throwable} that was thrown in the body of the test is
- * an instance of the {@link #getExpectedException()} class (or an
- * instance of a subclass).
- * If you want to customize the failure message, consider overriding
- * {@link #createMessageForWrongThrownExceptionType(Throwable)}.
- * @param actualException the {@link Throwable} that has been thrown
- * in the body of a test method (will never be {@code null})
- */
- protected void checkExceptionExpectations(Throwable actualException) {
- if (!getExpectedException().isAssignableFrom(actualException.getClass())) {
- AssertionError error = new AssertionError(createMessageForWrongThrownExceptionType(actualException));
- error.initCause(actualException);
- throw error;
- }
- }
-
- /**
- * Creates the failure message used if the wrong type
- * of {@link java.lang.Throwable} is thrown in the body of the test.
- * @param actualException the actual exception thrown
- * @return the message for the given exception
- */
- protected String createMessageForWrongThrownExceptionType(Throwable actualException) {
- StringBuilder sb = new StringBuilder();
- sb.append("Was expecting a [").append(getExpectedException().getName());
- sb.append("] to be thrown, but instead a [").append(actualException.getClass().getName());
- sb.append("] was thrown.");
- return sb.toString();
- }
-
- /**
- * Expose the actual exception thrown from {@link #test}, if any.
- * @return the actual exception, or {@code null} if none
- */
- public final Throwable getActualException() {
- return this.actualException;
- }
-
-}
diff --git a/spring-test/src/main/java/org/springframework/test/context/ContextConfigurationAttributes.java b/spring-test/src/main/java/org/springframework/test/context/ContextConfigurationAttributes.java
index 16c724a8a65..db36807fe88 100644
--- a/spring-test/src/main/java/org/springframework/test/context/ContextConfigurationAttributes.java
+++ b/spring-test/src/main/java/org/springframework/test/context/ContextConfigurationAttributes.java
@@ -91,29 +91,6 @@ public class ContextConfigurationAttributes {
(Class extends ContextLoader>) annAttrs.getClass("loader"));
}
- /**
- * Construct a new {@link ContextConfigurationAttributes} instance for the
- * {@linkplain Class test class} that declared the
- * {@link ContextConfiguration @ContextConfiguration} annotation and its
- * corresponding attributes.
- * @param declaringClass the test class that declared {@code @ContextConfiguration}
- * @param locations the resource locations declared via {@code @ContextConfiguration}
- * @param classes the annotated classes declared via {@code @ContextConfiguration}
- * @param inheritLocations the {@code inheritLocations} flag declared via {@code @ContextConfiguration}
- * @param contextLoaderClass the {@code ContextLoader} class declared via {@code @ContextConfiguration}
- * @throws IllegalArgumentException if the {@code declaringClass} or {@code contextLoaderClass} is
- * {@code null}
- * @deprecated as of Spring 3.2, use
- * {@link #ContextConfigurationAttributes(Class, String[], Class[], boolean, Class[], boolean, String, Class)}
- * instead
- */
- @Deprecated
- public ContextConfigurationAttributes(Class> declaringClass, String[] locations, Class>[] classes,
- boolean inheritLocations, Class extends ContextLoader> contextLoaderClass) {
-
- this(declaringClass, locations, classes, inheritLocations, null, true, null, contextLoaderClass);
- }
-
/**
* Construct a new {@link ContextConfigurationAttributes} instance for the
* {@linkplain Class test class} that declared the
diff --git a/spring-test/src/main/java/org/springframework/test/context/web/WebMergedContextConfiguration.java b/spring-test/src/main/java/org/springframework/test/context/web/WebMergedContextConfiguration.java
index fb577b6aa1c..f89ce244cff 100644
--- a/spring-test/src/main/java/org/springframework/test/context/web/WebMergedContextConfiguration.java
+++ b/spring-test/src/main/java/org/springframework/test/context/web/WebMergedContextConfiguration.java
@@ -63,36 +63,6 @@ public class WebMergedContextConfiguration extends MergedContextConfiguration {
* supplied parameters.
* Delegates to
* {@link #WebMergedContextConfiguration(Class, String[], Class[], Set, String[], String[], String[], String, ContextLoader, CacheAwareContextLoaderDelegate, MergedContextConfiguration)}.
- *
- * @param testClass the test class for which the configuration was merged
- * @param locations the merged resource locations
- * @param classes the merged annotated classes
- * @param contextInitializerClasses the merged context initializer classes
- * @param activeProfiles the merged active bean definition profiles
- * @param resourceBasePath the resource path to the root directory of the web application
- * @param contextLoader the resolved {@code ContextLoader}
- * @see #WebMergedContextConfiguration(Class, String[], Class[], Set, String[], String, ContextLoader, CacheAwareContextLoaderDelegate, MergedContextConfiguration)
- * @deprecated as of Spring 3.2.2, use
- * {@link #WebMergedContextConfiguration(Class, String[], Class[], Set, String[], String, ContextLoader, CacheAwareContextLoaderDelegate, MergedContextConfiguration)} instead.
- */
- @Deprecated
- public WebMergedContextConfiguration(
- Class> testClass,
- String[] locations,
- Class>[] classes,
- Set Delegates to
- * {@link #WebMergedContextConfiguration(Class, String[], Class[], Set, String[], String[], String[], String, ContextLoader, CacheAwareContextLoaderDelegate, MergedContextConfiguration)}.
- *
* @param testClass the test class for which the configuration was merged
* @param locations the merged resource locations
* @param classes the merged annotated classes
@@ -137,7 +107,6 @@ public class WebMergedContextConfiguration extends MergedContextConfiguration {
/**
* Create a new {@code WebMergedContextConfiguration} instance for the
* supplied parameters.
- *
* If a {@code null} value is supplied for {@code locations},
* {@code classes}, {@code activeProfiles}, {@code propertySourceLocations},
* or {@code propertySourceProperties} an empty array will be stored instead.
@@ -146,7 +115,6 @@ public class WebMergedContextConfiguration extends MergedContextConfiguration {
* If an empty value is supplied for the {@code resourceBasePath}
* an empty string will be used. Furthermore, active profiles will be sorted,
* and duplicate profiles will be removed.
- *
* @param testClass the test class for which the configuration was merged
* @param locations the merged resource locations
* @param classes the merged annotated classes
@@ -161,10 +129,7 @@ public class WebMergedContextConfiguration extends MergedContextConfiguration {
* @param parent the parent configuration or {@code null} if there is no parent
* @since 4.1
*/
- public WebMergedContextConfiguration(
- Class> testClass,
- String[] locations,
- Class>[] classes,
+ public WebMergedContextConfiguration(Class> testClass, String[] locations, Class>[] classes,
Set Performs a default TransactionAttribute lookup for the given method.
- * @param method the method about to execute
- * @param targetClass the class that the method is being invoked on
- * @return a TransactionInfo object, whether or not a transaction was created.
- * The {@code hasTransaction()} method on TransactionInfo can be used to
- * tell if there was a transaction created.
- * @see #getTransactionAttributeSource()
- * @deprecated in favor of
- * {@link #createTransactionIfNecessary(PlatformTransactionManager, TransactionAttribute, String)}
- */
- @Deprecated
- protected TransactionInfo createTransactionIfNecessary(Method method, Class> targetClass) {
- // If the transaction attribute is null, the method is non-transactional.
- TransactionAttribute txAttr = getTransactionAttributeSource().getTransactionAttribute(method, targetClass);
- PlatformTransactionManager tm = determineTransactionManager(txAttr);
- return createTransactionIfNecessary(tm, txAttr, methodIdentification(method, targetClass));
- }
-
/**
* Create a transaction if necessary based on the given TransactionAttribute.
* Allows callers to perform custom TransactionAttribute lookups through
diff --git a/spring-web/src/main/java/org/springframework/http/HttpHeaders.java b/spring-web/src/main/java/org/springframework/http/HttpHeaders.java
index f13cdb182f7..192e080a302 100644
--- a/spring-web/src/main/java/org/springframework/http/HttpHeaders.java
+++ b/spring-web/src/main/java/org/springframework/http/HttpHeaders.java
@@ -624,17 +624,6 @@ public class HttpHeaders implements MultiValueMap The date is returned as the number of milliseconds since
- * January 1, 1970 GMT. Returns -1 when the date is unknown.
- * @deprecated use {@link #getIfModifiedSince()}
- */
- @Deprecated
- public long getIfNotModifiedSince() {
- return getIfModifiedSince();
- }
-
/**
* Return the value of the {@code If-Modified-Since} header.
* The date is returned as the number of milliseconds since
diff --git a/spring-web/src/main/java/org/springframework/web/context/ContextLoader.java b/spring-web/src/main/java/org/springframework/web/context/ContextLoader.java
index 16da9161d32..208f03971dc 100644
--- a/spring-web/src/main/java/org/springframework/web/context/ContextLoader.java
+++ b/spring-web/src/main/java/org/springframework/web/context/ContextLoader.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.
@@ -107,7 +107,6 @@ public class ContextLoader {
/**
* Config param for the root WebApplicationContext implementation class to use: {@value}
* @see #determineContextClass(ServletContext)
- * @see #createWebApplicationContext(ServletContext, ApplicationContext)
*/
public static final String CONTEXT_CLASS_PARAM = "contextClass";
@@ -360,16 +359,6 @@ public class ContextLoader {
return (ConfigurableWebApplicationContext) BeanUtils.instantiateClass(contextClass);
}
- /**
- * @deprecated as of Spring 3.1 in favor of
- * {@link #createWebApplicationContext(ServletContext)} and
- * {@link #configureAndRefreshWebApplicationContext(ConfigurableWebApplicationContext, ServletContext)}
- */
- @Deprecated
- protected WebApplicationContext createWebApplicationContext(ServletContext sc, ApplicationContext parent) {
- return createWebApplicationContext(sc);
- }
-
protected void configureAndRefreshWebApplicationContext(ConfigurableWebApplicationContext wac, ServletContext sc) {
if (ObjectUtils.identityToString(wac).equals(wac.getId())) {
// The application context id is still set to its original default value
@@ -417,7 +406,6 @@ public class ContextLoader {
* org.springframework.core.annotation.Order Order} will be sorted appropriately.
* @param sc the current servlet context
* @param wac the newly created application context
- * @see #createWebApplicationContext(ServletContext, ApplicationContext)
* @see #CONTEXT_INITIALIZER_CLASSES_PARAM
* @see ApplicationContextInitializer#initialize(ConfigurableApplicationContext)
*/
diff --git a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextPropertyPlaceholderConfigurer.java b/spring-web/src/main/java/org/springframework/web/context/support/ServletContextPropertyPlaceholderConfigurer.java
deleted file mode 100644
index 720d26c0a98..00000000000
--- a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextPropertyPlaceholderConfigurer.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright 2002-2012 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.context.support;
-
-import java.util.Properties;
-import javax.servlet.ServletContext;
-
-import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
-import org.springframework.web.context.ServletContextAware;
-
-/**
- * Subclass of {@link PropertyPlaceholderConfigurer} that resolves placeholders as
- * ServletContext init parameters (that is, {@code web.xml} context-param
- * entries).
- *
- * Can be combined with "locations" and/or "properties" values in addition
- * to web.xml context-params. Alternatively, can be defined without local
- * properties, to resolve all placeholders as {@code web.xml} context-params
- * (or JVM system properties).
- *
- * If a placeholder could not be resolved against the provided local
- * properties within the application, this configurer will fall back to
- * ServletContext parameters. Can also be configured to let ServletContext
- * init parameters override local properties (contextOverride=true).
- *
- * Optionally supports searching for ServletContext attributes: If turned
- * on, an otherwise unresolvable placeholder will matched against the corresponding
- * ServletContext attribute, using its stringified value if found. This can be
- * used to feed dynamic values into Spring's placeholder resolution.
- *
- * If not running within a WebApplicationContext (or any other context that
- * is able to satisfy the ServletContextAware callback), this class will behave
- * like the default PropertyPlaceholderConfigurer. This allows for keeping
- * ServletContextPropertyPlaceholderConfigurer definitions in test suites.
- *
- * @author Juergen Hoeller
- * @since 1.1.4
- * @see #setLocations
- * @see #setProperties
- * @see #setSystemPropertiesModeName
- * @see #setContextOverride
- * @see #setSearchContextAttributes
- * @see javax.servlet.ServletContext#getInitParameter(String)
- * @see javax.servlet.ServletContext#getAttribute(String)
- * @deprecated in Spring 3.1 in favor of {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer}
- * in conjunction with {@link StandardServletEnvironment}.
- */
-@Deprecated
-public class ServletContextPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer
- implements ServletContextAware {
-
- private boolean contextOverride = false;
-
- private boolean searchContextAttributes = false;
-
- private ServletContext servletContext;
-
-
- /**
- * Set whether ServletContext init parameters (and optionally also ServletContext
- * attributes) should override local properties within the application.
- * Default is "false": ServletContext settings serve as fallback.
- * Note that system properties will still override ServletContext settings,
- * if the system properties mode is set to "SYSTEM_PROPERTIES_MODE_OVERRIDE".
- * @see #setSearchContextAttributes
- * @see #setSystemPropertiesModeName
- * @see #SYSTEM_PROPERTIES_MODE_OVERRIDE
- */
- public void setContextOverride(boolean contextOverride) {
- this.contextOverride = contextOverride;
- }
-
- /**
- * Set whether to search for matching a ServletContext attribute before
- * checking a ServletContext init parameter. Default is "false": only
- * checking init parameters.
- * If turned on, the configurer will look for a ServletContext attribute with
- * the same name as the placeholder, and use its stringified value if found.
- * Exposure of such ServletContext attributes can be used to dynamically override
- * init parameters defined in {@code web.xml}, for example in a custom
- * context listener.
- * @see javax.servlet.ServletContext#getInitParameter(String)
- * @see javax.servlet.ServletContext#getAttribute(String)
- */
- public void setSearchContextAttributes(boolean searchContextAttributes) {
- this.searchContextAttributes = searchContextAttributes;
- }
-
- /**
- * Set the ServletContext to resolve placeholders against.
- * Will be auto-populated when running in a WebApplicationContext.
- * If not set, this configurer will simply not resolve placeholders
- * against the ServletContext: It will effectively behave like a plain
- * PropertyPlaceholderConfigurer in such a scenario.
- */
- @Override
- public void setServletContext(ServletContext servletContext) {
- this.servletContext = servletContext;
- }
-
-
- @Override
- protected String resolvePlaceholder(String placeholder, Properties props) {
- String value = null;
- if (this.contextOverride && this.servletContext != null) {
- value = resolvePlaceholder(placeholder, this.servletContext, this.searchContextAttributes);
- }
- if (value == null) {
- value = super.resolvePlaceholder(placeholder, props);
- }
- if (value == null && this.servletContext != null) {
- value = resolvePlaceholder(placeholder, this.servletContext, this.searchContextAttributes);
- }
- return value;
- }
-
- /**
- * Resolves the given placeholder using the init parameters
- * and optionally also the attributes of the given ServletContext.
- * Default implementation checks ServletContext attributes before
- * init parameters. Can be overridden to customize this behavior,
- * potentially also applying specific naming patterns for parameters
- * and/or attributes (instead of using the exact placeholder name).
- * @param placeholder the placeholder to resolve
- * @param servletContext the ServletContext to check
- * @param searchContextAttributes whether to search for a matching
- * ServletContext attribute
- * @return the resolved value, of null if none
- * @see javax.servlet.ServletContext#getInitParameter(String)
- * @see javax.servlet.ServletContext#getAttribute(String)
- */
- protected String resolvePlaceholder(
- String placeholder, ServletContext servletContext, boolean searchContextAttributes) {
-
- String value = null;
- if (searchContextAttributes) {
- Object attrValue = servletContext.getAttribute(placeholder);
- if (attrValue != null) {
- value = attrValue.toString();
- }
- }
- if (value == null) {
- value = servletContext.getInitParameter(placeholder);
- }
- return value;
- }
-
-}
diff --git a/spring-web/src/main/java/org/springframework/web/util/CookieGenerator.java b/spring-web/src/main/java/org/springframework/web/util/CookieGenerator.java
index c79a59e6a21..2768278ad14 100644
--- a/spring-web/src/main/java/org/springframework/web/util/CookieGenerator.java
+++ b/spring-web/src/main/java/org/springframework/web/util/CookieGenerator.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.
@@ -46,13 +46,6 @@ public class CookieGenerator {
*/
public static final String DEFAULT_COOKIE_PATH = "/";
- /**
- * Default maximum age of cookies: maximum integer value, i.e. forever.
- * @deprecated in favor of setting no max age value at all in such a case
- */
- @Deprecated
- public static final int DEFAULT_COOKIE_MAX_AGE = Integer.MAX_VALUE;
-
protected final Log logger = LogFactory.getLog(getClass());
diff --git a/spring-web/src/main/java/org/springframework/web/util/UriUtils.java b/spring-web/src/main/java/org/springframework/web/util/UriUtils.java
index 538e6d3041f..e33531ba62e 100644
--- a/spring-web/src/main/java/org/springframework/web/util/UriUtils.java
+++ b/spring-web/src/main/java/org/springframework/web/util/UriUtils.java
@@ -67,148 +67,6 @@ public abstract class UriUtils {
PATH_PATTERN + "(\\?" + LAST_PATTERN + ")?");
- // encoding
-
- /**
- * Encodes the given source URI into an encoded String. All various URI components are
- * encoded according to their respective valid character sets.
- * Note that this method does not attempt to encode "=" and "&"
- * characters in query parameter names and query parameter values because they cannot
- * be parsed in a reliable way. Instead use:
- * Note that this method does not support fragments ({@code #}),
- * as these are not supposed to be sent to the server, but retained by the client.
- * Note that this method does not attempt to encode "=" and "&"
- * characters in query parameter names and query parameter values because they cannot
- * be parsed in a reliable way. Instead use:
- * The {@code ContentNegotiatingViewResolver} does not resolve views itself, but delegates to other {@link
- * ViewResolver}s. By default, these other view resolvers are picked up automatically from the application context,
- * though they can also be set explicitly by using the {@link #setViewResolvers(List) viewResolvers} property.
- * Note that in order for this view resolver to work properly, the {@link #setOrder(int) order}
- * property needs to be set to a higher precedence than the others (the default is {@link Ordered#HIGHEST_PRECEDENCE}.)
+ * The {@code ContentNegotiatingViewResolver} does not resolve views itself, but delegates to
+ * other {@link ViewResolver}s. By default, these other view resolvers are picked up automatically
+ * from the application context, though they can also be set explicitly by using the
+ * {@link #setViewResolvers viewResolvers} property. Note that in order for this
+ * view resolver to work properly, the {@link #setOrder order} property needs to be set to a higher
+ * precedence than the others (the default is {@link Ordered#HIGHEST_PRECEDENCE}).
*
- * This view resolver uses the requested {@linkplain MediaType media type} to select a suitable {@link View} for a
- * request. The requested media type is determined through the configured {@link ContentNegotiationManager}.
- * Once the requested media type has been determined, this resolver queries each delegate view resolver for a
- * {@link View} and determines if the requested media type is {@linkplain MediaType#includes(MediaType) compatible}
- * with the view's {@linkplain View#getContentType() content type}). The most compatible view is returned.
+ * This view resolver uses the requested {@linkplain MediaType media type} to select a suitable
+ * {@link View} for a request. The requested media type is determined through the configured
+ * {@link ContentNegotiationManager}. Once the requested media type has been determined, this resolver
+ * queries each delegate view resolver for a {@link View} and determines if the requested media type
+ * is {@linkplain MediaType#includes(MediaType) compatible} with the view's
+ * {@linkplain View#getContentType() content type}). The most compatible view is returned.
*
- * Additionally, this view resolver exposes the {@link #setDefaultViews(List) defaultViews} property, allowing you to
- * override the views provided by the view resolvers. Note that these default views are offered as candidates, and
- * still need have the content type requested (via file extension, parameter, or {@code Accept} header, described above).
- * You can also set the {@linkplain #setDefaultContentType(MediaType) default content type} directly, which will be
- * returned when the other mechanisms ({@code Accept} header, file extension or parameter) do not result in a match.
+ * Additionally, this view resolver exposes the {@link #setDefaultViews(List) defaultViews} property,
+ * allowing you to override the views provided by the view resolvers. Note that these default views are
+ * offered as candidates, and still need have the content type requested (via file extension, parameter,
+ * or {@code Accept} header, described above).
*
- * For example, if the request path is {@code /view.html}, this view resolver will look for a view that has the
- * {@code text/html} content type (based on the {@code html} file extension). A request for {@code /view} with a {@code
- * text/html} request {@code Accept} header has the same result.
+ * For example, if the request path is {@code /view.html}, this view resolver will look for a view
+ * that has the {@code text/html} content type (based on the {@code html} file extension). A request
+ * for {@code /view} with a {@code text/html} request {@code Accept} header has the same result.
*
* @author Arjen Poutsma
* @author Juergen Hoeller
@@ -123,90 +123,6 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
this.contentNegotiationManager = contentNegotiationManager;
}
- /**
- * Indicate whether the extension of the request path should be used to determine the requested media type,
- * in favor of looking at the {@code Accept} header. The default value is {@code true}.
- * For instance, when this flag is {@code true} (the default), a request for {@code /hotels.pdf}
- * will result in an {@code AbstractPdfView} being resolved, while the {@code Accept} header can be the
- * browser-defined {@code text/html,application/xhtml+xml}.
- * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)}
- */
- @Deprecated
- public void setFavorPathExtension(boolean favorPathExtension) {
- this.cnManagerFactoryBean.setFavorPathExtension(favorPathExtension);
- }
-
- /**
- * Indicate whether to use the Java Activation Framework to map from file extensions to media types.
- * Default is {@code true}, i.e. the Java Activation Framework is used (if available).
- * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)}
- */
- @Deprecated
- public void setUseJaf(boolean useJaf) {
- this.cnManagerFactoryBean.setUseJaf(useJaf);
- }
-
- /**
- * Indicate whether a request parameter should be used to determine the requested media type,
- * in favor of looking at the {@code Accept} header. The default value is {@code false}.
- * For instance, when this flag is {@code true}, a request for {@code /hotels?format=pdf} will result
- * in an {@code AbstractPdfView} being resolved, while the {@code Accept} header can be the browser-defined
- * {@code text/html,application/xhtml+xml}.
- * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)}
- */
- @Deprecated
- public void setFavorParameter(boolean favorParameter) {
- this.cnManagerFactoryBean.setFavorParameter(favorParameter);
- }
-
- /**
- * Set the parameter name that can be used to determine the requested media type if the {@link
- * #setFavorParameter} property is {@code true}. The default parameter name is {@code format}.
- * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)}
- */
- @Deprecated
- public void setParameterName(String parameterName) {
- this.cnManagerFactoryBean.setParameterName(parameterName);
- }
-
- /**
- * Indicate whether the HTTP {@code Accept} header should be ignored. Default is {@code false}.
- * If set to {@code true}, this view resolver will only refer to the file extension and/or
- * parameter, as indicated by the {@link #setFavorPathExtension favorPathExtension} and
- * {@link #setFavorParameter favorParameter} properties.
- * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)}
- */
- @Deprecated
- public void setIgnoreAcceptHeader(boolean ignoreAcceptHeader) {
- this.cnManagerFactoryBean.setIgnoreAcceptHeader(ignoreAcceptHeader);
- }
-
- /**
- * Set the mapping from file extensions to media types.
- * When this mapping is not set or when an extension is not present, this view resolver
- * will fall back to using a {@link FileTypeMap} when the Java Action Framework is available.
- * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)}
- */
- @Deprecated
- public void setMediaTypes(Map This content type will be used when file extension, parameter, nor {@code Accept}
- * header define a content-type, either through being disabled or empty.
- * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)}
- */
- @Deprecated
- public void setDefaultContentType(MediaType defaultContentType) {
- this.cnManagerFactoryBean.setDefaultContentType(defaultContentType);
- }
-
/**
* Indicate whether a {@link HttpServletResponse#SC_NOT_ACCEPTABLE 406 Not Acceptable}
* status code should be returned if no suitable view can be found.
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJackson2JsonView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJackson2JsonView.java
index b410a9b8690..5209d3b7049 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJackson2JsonView.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJackson2JsonView.java
@@ -133,25 +133,6 @@ public class MappingJackson2JsonView extends AbstractJackson2View {
return this.modelKeys;
}
- /**
- * Set the attributes in the model that should be rendered by this view.
- * When set, all other model attributes will be ignored.
- * @deprecated use {@link #setModelKeys(Set)} instead
- */
- @Deprecated
- public void setRenderedAttributes(Set
- * // the class under test
- * public class Foo {
- * public void someBusinessLogic(String name) {
- * if (name == null) {
- * throw new IllegalArgumentException("The 'name' argument is required");
- * }
- * // rest of business logic here...
- * }
- * }
- *
- *
- * public class FooTest {
- * public void testSomeBusinessLogicBadArgumentPath() {
- * new AssertThrows(IllegalArgumentException.class) {
- * public void test() {
- * new Foo().someBusinessLogic(null);
- * }
- * }.runTest();
- * }
- * }
- *
- * "Must have thrown a [class java.lang.IllegalArgumentException]"
- *
- * "java.lang.AssertionError: Was expecting a [class java.lang.UnsupportedOperationException] to be thrown, but instead a [class java.lang.IllegalArgumentException] was thrown"
- *
- *
- * public class FooTest {
- * public void testSomeBusinessLogicBadArgumentPath() {
- * // any Exception will do...
- * new AssertThrows(Exception.class) {
- * public void test() {
- * new Foo().someBusinessLogic(null);
- * }
- * }.runTest();
- * }
- * }
- *
- * @author Rick Evans
- * @author Juergen Hoeller
- * @author Sam Brannen
- * @since 2.0
- * @deprecated Favor use of JUnit's {@code @Test(expected=...)} or
- * {@code @Rule ExpectedException} support or TestNG's
- * {@code @Test(expectedExceptions=...)} support
- */
-@Deprecated
-public abstract class AssertThrows {
-
- private final Class extends Throwable> expectedException;
-
- private String failureMessage;
-
- private Throwable actualException;
-
-
- /**
- * Create a new instance of the {@code AssertThrows} class.
- * @param expectedException the {@link Throwable} expected to be
- * thrown during the execution of the surrounding test
- * @throws IllegalArgumentException if the supplied {@code expectedException} is
- * {@code null}; or if said argument is not a {@code Throwable}-derived class
- */
- public AssertThrows(Class extends Throwable> expectedException) {
- this(expectedException, null);
- }
-
- /**
- * Create a new instance of the {@code AssertThrows} class.
- * @param expectedException the {@link Throwable} expected to be
- * thrown during the execution of the surrounding test
- * @param failureMessage the extra, contextual failure message that will be
- * included in the failure text if the text fails (can be {@code null})
- * @throws IllegalArgumentException if the supplied {@code expectedException} is
- * {@code null}; or if said argument is not a {@code Throwable}-derived class
- */
- public AssertThrows(Class extends Throwable> expectedException, String failureMessage) {
- Assert.notNull(expectedException, "expectedException is required");
- Assert.isAssignable(Throwable.class, expectedException, "expectedException: ");
- this.expectedException = expectedException;
- this.failureMessage = failureMessage;
- }
-
- /**
- * Return the {@link java.lang.Throwable} expected to be thrown during
- * the execution of the surrounding test.
- */
- protected Class extends Throwable> getExpectedException() {
- return this.expectedException;
- }
-
- /**
- * Set the extra, contextual failure message that will be included
- * in the failure text if the text fails.
- */
- public void setFailureMessage(String failureMessage) {
- this.failureMessage = failureMessage;
- }
-
- /**
- * Return the extra, contextual failure message that will be included
- * in the failure text if the text fails.
- */
- protected String getFailureMessage() {
- return this.failureMessage;
- }
-
- /**
- * Subclass must override this {@code abstract} method and
- * provide the test logic.
- * @throws Throwable if an error occurs during the execution of the
- * aforementioned test logic
- */
- public abstract void test() throws Throwable;
-
- /**
- * The main template method that drives the running of the
- * {@linkplain #test() test logic} and the
- * {@linkplain #checkExceptionExpectations(Throwable) checking} of the
- * resulting (expected) {@link java.lang.Throwable}.
- * @see #test()
- * @see #doFail()
- * @see #checkExceptionExpectations(Throwable)
- */
- public void runTest() {
- try {
- test();
- doFail();
- }
- catch (Throwable actualException) {
- this.actualException = actualException;
- checkExceptionExpectations(actualException);
- }
- }
-
- /**
- * Template method called when the test fails; i.e. the expected
- * {@link java.lang.Throwable} is not thrown.
- *
- * UriComponents uriComponents = UriComponentsBuilder.fromUri("/path?name={value}").buildAndExpand("a=b");
- * String encodedUri = uriComponents.encode().toUriString();
- *
- * @param uri the URI to be encoded
- * @param encoding the character encoding to encode to
- * @return the encoded URI
- * @throws IllegalArgumentException when the given uri parameter is not a valid URI
- * @throws UnsupportedEncodingException when the given encoding parameter is not supported
- * @deprecated in favor of {@link UriComponentsBuilder}; see note about query param encoding
- */
- @Deprecated
- public static String encodeUri(String uri, String encoding) throws UnsupportedEncodingException {
- Assert.notNull(uri, "URI must not be null");
- Assert.hasLength(encoding, "Encoding must not be empty");
- Matcher matcher = URI_PATTERN.matcher(uri);
- if (matcher.matches()) {
- String scheme = matcher.group(2);
- String authority = matcher.group(3);
- String userinfo = matcher.group(5);
- String host = matcher.group(6);
- String port = matcher.group(8);
- String path = matcher.group(9);
- String query = matcher.group(11);
- String fragment = matcher.group(13);
- return encodeUriComponents(scheme, authority, userinfo, host, port, path, query, fragment, encoding);
- }
- else {
- throw new IllegalArgumentException("[" + uri + "] is not a valid URI");
- }
- }
-
- /**
- * Encodes the given HTTP URI into an encoded String. All various URI components are
- * encoded according to their respective valid character sets.
- *
- * UriComponents uriComponents = UriComponentsBuilder.fromHttpUrl("/path?name={value}").buildAndExpand("a=b");
- * String encodedUri = uriComponents.encode().toUriString();
- *
- * @param httpUrl the HTTP URL to be encoded
- * @param encoding the character encoding to encode to
- * @return the encoded URL
- * @throws IllegalArgumentException when the given uri parameter is not a valid URI
- * @throws UnsupportedEncodingException when the given encoding parameter is not supported
- * @deprecated in favor of {@link UriComponentsBuilder}; see note about query param encoding
- */
- @Deprecated
- public static String encodeHttpUrl(String httpUrl, String encoding) throws UnsupportedEncodingException {
- Assert.notNull(httpUrl, "HTTP URL must not be null");
- Assert.hasLength(encoding, "Encoding must not be empty");
- Matcher matcher = HTTP_URL_PATTERN.matcher(httpUrl);
- if (matcher.matches()) {
- String scheme = matcher.group(1);
- String authority = matcher.group(2);
- String userinfo = matcher.group(4);
- String host = matcher.group(5);
- String portString = matcher.group(7);
- String path = matcher.group(8);
- String query = matcher.group(10);
- return encodeUriComponents(scheme, authority, userinfo, host, portString, path, query, null, encoding);
- }
- else {
- throw new IllegalArgumentException("[" + httpUrl + "] is not a valid HTTP URL");
- }
- }
-
- /**
- * Encodes the given source URI components into an encoded String. All various URI components
- * are optional, but encoded according to their respective valid character sets.
- * @param scheme the scheme
- * @param authority the authority
- * @param userInfo the user info
- * @param host the host
- * @param port the port
- * @param path the path
- * @param query the query
- * @param fragment the fragment
- * @param encoding the character encoding to encode to
- * @return the encoded URI
- * @throws IllegalArgumentException when the given uri parameter is not a valid URI
- * @throws UnsupportedEncodingException when the given encoding parameter is not supported
- * @deprecated in favor of {@link UriComponentsBuilder}
- */
- @Deprecated
- public static String encodeUriComponents(String scheme, String authority, String userInfo,
- String host, String port, String path, String query, String fragment, String encoding)
- throws UnsupportedEncodingException {
-
- Assert.hasLength(encoding, "Encoding must not be empty");
- StringBuilder sb = new StringBuilder();
-
- if (scheme != null) {
- sb.append(encodeScheme(scheme, encoding));
- sb.append(':');
- }
-
- if (authority != null) {
- sb.append("//");
- if (userInfo != null) {
- sb.append(encodeUserInfo(userInfo, encoding));
- sb.append('@');
- }
- if (host != null) {
- sb.append(encodeHost(host, encoding));
- }
- if (port != null) {
- sb.append(':');
- sb.append(encodePort(port, encoding));
- }
- }
-
- sb.append(encodePath(path, encoding));
-
- if (query != null) {
- sb.append('?');
- sb.append(encodeQuery(query, encoding));
- }
-
- if (fragment != null) {
- sb.append('#');
- sb.append(encodeFragment(fragment, encoding));
- }
-
- return sb.toString();
- }
-
-
- // encoding convenience methods
-
/**
* Encodes the given URI scheme with the given encoding.
* @param scheme the scheme to be encoded
diff --git a/spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java b/spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java
index 2bac5b66fee..1d6993b2f7a 100644
--- a/spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java
+++ b/spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java
@@ -42,11 +42,13 @@ public class HttpHeadersTests {
private HttpHeaders headers;
+
@Before
public void setUp() {
headers = new HttpHeaders();
}
+
@Test
public void accept() {
MediaType mediaType1 = new MediaType("text", "html");
@@ -59,9 +61,7 @@ public class HttpHeadersTests {
assertEquals("Invalid Accept header", "text/html, text/plain", headers.getFirst("Accept"));
}
- // SPR-9655
-
- @Test
+ @Test // SPR-9655
public void acceptiPlanet() {
headers.add("Accept", "text/html");
headers.add("Accept", "text/plain");
@@ -228,7 +228,7 @@ public class HttpHeadersTests {
calendar.setTimeZone(TimeZone.getTimeZone("CET"));
long date = calendar.getTimeInMillis();
headers.setIfModifiedSince(date);
- assertEquals("Invalid If-Modified-Since header", date, headers.getIfNotModifiedSince());
+ assertEquals("Invalid If-Modified-Since header", date, headers.getIfModifiedSince());
assertEquals("Invalid If-Modified-Since header", "Thu, 18 Dec 2008 10:20:00 GMT",
headers.getFirst("if-modified-since"));
}
@@ -260,12 +260,9 @@ public class HttpHeadersTests {
headers.getFirst("Content-Disposition"));
}
- // SPR-11917
-
- @Test
+ @Test // SPR-11917
public void getAllowEmptySet() {
headers.setAllow(Collections.