Remove deprecated LastModified APIs
See gh-33809
This commit is contained in:
@@ -261,12 +261,6 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
|
||||
((MyHandler) delegate).doSomething(request);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public long getLastModified(HttpServletRequest request, Object delegate) {
|
||||
return ((MyHandler) delegate).lastModified();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -282,12 +276,6 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
|
||||
throws IOException, ServletException {
|
||||
throw new ServletException("dummy");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public long getLastModified(HttpServletRequest request, Object delegate) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.context.ApplicationContextInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.server.RequestPath;
|
||||
import org.springframework.web.HttpRequestHandler;
|
||||
@@ -72,6 +73,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -196,7 +198,6 @@ class DispatcherServletTests {
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
simpleDispatcherServlet.service(request, response);
|
||||
assertThat(response.getForwardedUrl()).as("Not forwarded").isNull();
|
||||
assertThat(response.getHeader("Last-Modified")).isEqualTo("Wed, 01 Apr 2015 00:00:00 GMT");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -226,7 +227,6 @@ class DispatcherServletTests {
|
||||
assertThat(request.getAttribute("test3")).isNotNull();
|
||||
assertThat(request.getAttribute("test3x")).isNotNull();
|
||||
assertThat(request.getAttribute("test3y")).isNotNull();
|
||||
assertThat(response.getHeader("Last-Modified")).isEqualTo("Wed, 01 Apr 2015 00:00:01 GMT");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -789,8 +789,7 @@ class DispatcherServletTests {
|
||||
ConfigurableEnvironment env1 = new StandardServletEnvironment();
|
||||
servlet.setEnvironment(env1); // should succeed
|
||||
assertThat(servlet.getEnvironment()).isSameAs(env1);
|
||||
assertThatIllegalArgumentException().as("non-configurable Environment").isThrownBy(() ->
|
||||
servlet.setEnvironment(new DummyEnvironment()));
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> servlet.setEnvironment(mock(Environment.class)));
|
||||
class CustomServletEnvironment extends StandardServletEnvironment { }
|
||||
DispatcherServlet custom = new DispatcherServlet() {
|
||||
@Override
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2019 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
|
||||
*
|
||||
* https://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;
|
||||
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.env.Profiles;
|
||||
|
||||
class DummyEnvironment implements Environment {
|
||||
|
||||
@Override
|
||||
public boolean containsProperty(String key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(String key, String defaultValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getProperty(String key, Class<T> targetType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getProperty(String key, Class<T> targetType, T defaultValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequiredProperty(String key) throws IllegalStateException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getRequiredProperty(String key, Class<T> targetType) throws IllegalStateException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolvePlaceholders(String text) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolveRequiredPlaceholders(String text) throws IllegalArgumentException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getActiveProfiles() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getDefaultProfiles() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean acceptsProfiles(String... profiles) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsProfiles(Profiles profiles) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -53,8 +53,7 @@ public class SimpleWebApplicationContext extends StaticWebApplicationContext {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static class LocaleChecker implements Controller, org.springframework.web.servlet.mvc.LastModified {
|
||||
public static class LocaleChecker implements Controller {
|
||||
|
||||
@Override
|
||||
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
@@ -71,11 +70,6 @@ public class SimpleWebApplicationContext extends StaticWebApplicationContext {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastModified(HttpServletRequest request) {
|
||||
return 1427846400000L;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user