|
|
|
@ -17,7 +17,6 @@ |
|
|
|
package org.springframework.web.servlet.resource; |
|
|
|
package org.springframework.web.servlet.resource; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collections; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.ServletException; |
|
|
|
import javax.servlet.ServletException; |
|
|
|
@ -26,7 +25,6 @@ import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
|
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.mock.web.test.MockFilterChain; |
|
|
|
import org.springframework.mock.web.test.MockFilterChain; |
|
|
|
import org.springframework.mock.web.test.MockHttpServletRequest; |
|
|
|
import org.springframework.mock.web.test.MockHttpServletRequest; |
|
|
|
@ -36,7 +34,6 @@ import org.springframework.web.context.WebApplicationContext; |
|
|
|
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; |
|
|
|
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; |
|
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
|
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; |
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; |
|
|
|
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.junit.Assert.*; |
|
|
|
import static org.junit.Assert.*; |
|
|
|
|
|
|
|
|
|
|
|
@ -120,6 +117,7 @@ public class ResourceUrlFilterTests { |
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
static class WebConfig extends WebMvcConfigurationSupport { |
|
|
|
static class WebConfig extends WebMvcConfigurationSupport { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) { |
|
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) { |
|
|
|
|
|
|
|
|
|
|
|
@ -131,14 +129,6 @@ public class ResourceUrlFilterTests { |
|
|
|
.addResourceLocations("classpath:org/springframework/web/servlet/resource/test/") |
|
|
|
.addResourceLocations("classpath:org/springframework/web/servlet/resource/test/") |
|
|
|
.setResourceResolvers(resourceResolvers); |
|
|
|
.setResourceResolvers(resourceResolvers); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
public ResourceUrlGenerator resourceUrlGenerator() { |
|
|
|
|
|
|
|
ResourceUrlGenerator generator = new ResourceUrlGenerator(); |
|
|
|
|
|
|
|
SimpleUrlHandlerMapping handlerMapping = (SimpleUrlHandlerMapping) resourceHandlerMapping(); |
|
|
|
|
|
|
|
generator.setResourceHandlerMappings(Collections.singletonList(handlerMapping)); |
|
|
|
|
|
|
|
return generator; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static class TestServlet extends HttpServlet { |
|
|
|
private static class TestServlet extends HttpServlet { |
|
|
|
|