Remove pre-3.2 deprecated classes and methods
Issue: SPR-12578
This commit is contained in:
@@ -624,17 +624,6 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
||||
setDate(IF_MODIFIED_SINCE, ifModifiedSince);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the {@code IfModifiedSince} header.
|
||||
* <p>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.
|
||||
* <p>The date is returned as the number of milliseconds since
|
||||
|
||||
@@ -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)
|
||||
*/
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
* <p>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).
|
||||
*
|
||||
* <p>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).
|
||||
*
|
||||
* <p>Optionally supports searching for ServletContext <i>attributes</i>: 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.
|
||||
*
|
||||
* <p>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.
|
||||
* <p>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.
|
||||
* <p>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.
|
||||
* <p>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.
|
||||
* <p>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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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.
|
||||
* <p><strong>Note</strong> 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:
|
||||
* <pre class="code">
|
||||
* UriComponents uriComponents = UriComponentsBuilder.fromUri("/path?name={value}").buildAndExpand("a=b");
|
||||
* String encodedUri = uriComponents.encode().toUriString();
|
||||
* </pre>
|
||||
* @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.
|
||||
* <p><strong>Note</strong> that this method does not support fragments ({@code #}),
|
||||
* as these are not supposed to be sent to the server, but retained by the client.
|
||||
* <p><strong>Note</strong> 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:
|
||||
* <pre class="code">
|
||||
* UriComponents uriComponents = UriComponentsBuilder.fromHttpUrl("/path?name={value}").buildAndExpand("a=b");
|
||||
* String encodedUri = uriComponents.encode().toUriString();
|
||||
* </pre>
|
||||
* @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
|
||||
|
||||
Reference in New Issue
Block a user