Skip to content

Commit e27f4b1

Browse files
committed
revised DispatcherServlet's last-modified handling to properly work with scoped controllers
1 parent f8690cf commit e27f4b1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,7 +37,6 @@
3737
import org.springframework.mock.web.MockHttpServletResponse;
3838
import org.springframework.mock.web.MockServletConfig;
3939
import org.springframework.mock.web.MockServletContext;
40-
import org.springframework.validation.BindException;
4140
import org.springframework.web.bind.EscapedErrors;
4241
import org.springframework.web.context.ServletConfigAwareBean;
4342
import org.springframework.web.context.ServletContextAwareBean;
@@ -206,9 +205,9 @@ public void testLocaleRequest() throws Exception {
206205
MockHttpServletRequest request = new MockHttpServletRequest(getServletContext(), "GET", "/locale.do");
207206
request.addPreferredLocale(Locale.CANADA);
208207
MockHttpServletResponse response = new MockHttpServletResponse();
209-
assertEquals(98, simpleDispatcherServlet.getLastModified(request));
210208
simpleDispatcherServlet.service(request, response);
211209
assertTrue("Not forwarded", response.getForwardedUrl() == null);
210+
assertEquals(new Long(98), response.getHeader("Last-Modified"));
212211
}
213212

214213
public void testUnknownRequest() throws Exception {
@@ -269,7 +268,6 @@ public void testAnotherLocaleRequest() throws Exception {
269268
request.addPreferredLocale(Locale.CANADA);
270269
request.addUserRole("role1");
271270
MockHttpServletResponse response = new MockHttpServletResponse();
272-
assertEquals(99, complexDispatcherServlet.getLastModified(request));
273271
complexDispatcherServlet.service(request, response);
274272

275273
assertTrue("Not forwarded", response.getForwardedUrl() == null);
@@ -282,6 +280,7 @@ public void testAnotherLocaleRequest() throws Exception {
282280
assertTrue(request.getAttribute("test3") != null);
283281
assertTrue(request.getAttribute("test3x") != null);
284282
assertTrue(request.getAttribute("test3y") != null);
283+
assertEquals(new Long(99), response.getHeader("Last-Modified"));
285284
}
286285

287286
public void testExistingMultipartRequest() throws Exception {
@@ -824,6 +823,7 @@ public void testDispatcherServletContextRefresh() throws ServletException {
824823
servlet.destroy();
825824
}
826825

826+
827827
public static class ControllerFromParent implements Controller {
828828

829829
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {

0 commit comments

Comments
 (0)