Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

Commit 29d7294

Browse files
committed
Add repro project for SPR-12669
1 parent 2af6d43 commit 29d7294

File tree

10 files changed

+466
-0
lines changed

10 files changed

+466
-0
lines changed

SPR-12669/pom.xml

Lines changed: 308 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>org.springframework.issues</groupId>
5+
<artifactId>SPR-12669</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<name>Spring MVC Issue Reproduction Project</name>
8+
<packaging>war</packaging>
9+
10+
<properties>
11+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12+
13+
<java.version>1.6</java.version>
14+
<spring.version>4.1.4.RELEASE</spring.version>
15+
<slf4j.version>1.7.5</slf4j.version>
16+
17+
<jetty.version>9.1.2.v20140210</jetty.version>
18+
<cargo.container.id>tomcat7x</cargo.container.id>
19+
<cargo.container.url>
20+
http://www.eu.apache.org/dist/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.zip
21+
</cargo.container.url>
22+
<cargo.container.jvmargs>-Xms96m -Xmx512m -Djava.awt.headless=true</cargo.container.jvmargs>
23+
<cargo.jvm.debug.port>8000</cargo.jvm.debug.port>
24+
</properties>
25+
26+
<dependencies>
27+
<!-- Spring Framework -->
28+
<dependency>
29+
<groupId>org.springframework</groupId>
30+
<artifactId>spring-context</artifactId>
31+
<version>${spring.version}</version>
32+
<exclusions>
33+
<!-- Exclude Commons Logging in favor of SLF4j -->
34+
<exclusion>
35+
<groupId>commons-logging</groupId>
36+
<artifactId>commons-logging</artifactId>
37+
</exclusion>
38+
</exclusions>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.springframework</groupId>
42+
<artifactId>spring-webmvc</artifactId>
43+
<version>${spring.version}</version>
44+
</dependency>
45+
46+
<!-- CGLIB, required for @Configuration usage -->
47+
<dependency>
48+
<groupId>cglib</groupId>
49+
<artifactId>cglib-nodep</artifactId>
50+
<version>2.2</version>
51+
</dependency>
52+
53+
<!-- Logging -->
54+
<dependency>
55+
<groupId>org.slf4j</groupId>
56+
<artifactId>slf4j-api</artifactId>
57+
<version>${slf4j.version}</version>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.slf4j</groupId>
61+
<artifactId>jcl-over-slf4j</artifactId>
62+
<version>${slf4j.version}</version>
63+
<scope>runtime</scope>
64+
</dependency>
65+
<dependency>
66+
<groupId>org.slf4j</groupId>
67+
<artifactId>slf4j-log4j12</artifactId>
68+
<version>${slf4j.version}</version>
69+
<scope>runtime</scope>
70+
</dependency>
71+
<dependency>
72+
<groupId>log4j</groupId>
73+
<artifactId>log4j</artifactId>
74+
<version>1.2.17</version>
75+
<scope>runtime</scope>
76+
</dependency>
77+
78+
<!-- Servlet API -->
79+
<dependency>
80+
<groupId>javax.servlet</groupId>
81+
<artifactId>servlet-api</artifactId>
82+
<version>2.5</version>
83+
<scope>provided</scope>
84+
</dependency>
85+
86+
<dependency>
87+
<groupId>javax.servlet.jsp</groupId>
88+
<artifactId>jsp-api</artifactId>
89+
<version>2.1</version>
90+
<scope>provided</scope>
91+
</dependency>
92+
<dependency>
93+
<groupId>javax.servlet</groupId>
94+
<artifactId>jstl</artifactId>
95+
<version>1.2</version>
96+
</dependency>
97+
98+
<!-- Apache Tiles
99+
<dependency>
100+
<groupId>org.apache.tiles</groupId>
101+
<artifactId>tiles-jsp</artifactId>
102+
<version>2.1.3</version>
103+
<exclusions>
104+
<exclusion>
105+
<groupId>commons-logging</groupId>
106+
<artifactId>commons-logging-api</artifactId>
107+
</exclusion>
108+
</exclusions>
109+
</dependency>
110+
-->
111+
112+
<!-- JSR 303 with Hibernate Validator
113+
<dependency>
114+
<groupId>javax.validation</groupId>
115+
<artifactId>validation-api</artifactId>
116+
<version>1.0.0.GA</version>
117+
</dependency>
118+
<dependency>
119+
<groupId>org.hibernate</groupId>
120+
<artifactId>hibernate-validator</artifactId>
121+
<version>4.1.0.Final</version>
122+
</dependency>
123+
-->
124+
125+
<!-- Joda Time Library
126+
<dependency>
127+
<groupId>joda-time</groupId>
128+
<artifactId>joda-time</artifactId>
129+
<version>1.6.2</version>
130+
</dependency>
131+
<dependency>
132+
<groupId>joda-time</groupId>
133+
<artifactId>joda-time-jsptags</artifactId>
134+
<version>1.0.2</version>
135+
<scope>runtime</scope>
136+
</dependency>
137+
-->
138+
139+
<!-- Apache Commons File Upload
140+
<dependency>
141+
<groupId>commons-fileupload</groupId>
142+
<artifactId>commons-fileupload</artifactId>
143+
<version>1.2.2</version>
144+
</dependency>
145+
<dependency>
146+
<groupId>commons-io</groupId>
147+
<artifactId>commons-io</artifactId>
148+
<version>2.0.1</version>
149+
</dependency>
150+
-->
151+
152+
<!-- Jackson JSON Processor
153+
<dependency>
154+
<groupId>com.fasterxml.jackson.core</groupId>
155+
<artifactId>jackson-databind</artifactId>
156+
<version>2.4.3</version>
157+
</dependency>
158+
-->
159+
160+
<!-- Rome Atom+RSS
161+
<dependency>
162+
<groupId>rome</groupId>
163+
<artifactId>rome</artifactId>
164+
<version>1.0</version>
165+
</dependency>
166+
-->
167+
168+
<!-- Test -->
169+
<dependency>
170+
<groupId>junit</groupId>
171+
<artifactId>junit</artifactId>
172+
<version>4.11</version>
173+
<scope>test</scope>
174+
</dependency>
175+
</dependencies>
176+
177+
<build>
178+
<plugins>
179+
<plugin>
180+
<groupId>org.apache.maven.plugins</groupId>
181+
<artifactId>maven-compiler-plugin</artifactId>
182+
<version>2.5.1</version>
183+
<configuration>
184+
<source>${java.version}</source>
185+
<target>${java.version}</target>
186+
</configuration>
187+
</plugin>
188+
<plugin>
189+
<groupId>org.apache.maven.plugins</groupId>
190+
<artifactId>maven-dependency-plugin</artifactId>
191+
<version>2.8</version>
192+
<executions>
193+
<execution>
194+
<id>install</id>
195+
<phase>install</phase>
196+
<goals>
197+
<goal>sources</goal>
198+
</goals>
199+
</execution>
200+
</executions>
201+
</plugin>
202+
<plugin>
203+
<groupId>org.apache.maven.plugins</groupId>
204+
<artifactId>maven-eclipse-plugin</artifactId>
205+
<version>2.8</version>
206+
<configuration>
207+
<downloadSources>true</downloadSources>
208+
<downloadJavadocs>false</downloadJavadocs>
209+
<wtpversion>2.0</wtpversion>
210+
</configuration>
211+
</plugin>
212+
<plugin>
213+
<groupId>org.apache.maven.plugins</groupId>
214+
<artifactId>maven-surefire-plugin</artifactId>
215+
<version>2.12.4</version>
216+
<configuration>
217+
<includes>
218+
<include>**/*Tests.java</include>
219+
<include>**/*Test.java</include>
220+
</includes>
221+
<excludes>
222+
<exclude>**/*Abstract*.java</exclude>
223+
</excludes>
224+
</configuration>
225+
</plugin>
226+
<plugin>
227+
<groupId>org.eclipse.jetty</groupId>
228+
<artifactId>jetty-maven-plugin</artifactId>
229+
<version>${jetty.version}</version>
230+
</plugin>
231+
<plugin>
232+
<groupId>org.codehaus.cargo</groupId>
233+
<artifactId>cargo-maven2-plugin</artifactId>
234+
<version>1.4.7</version>
235+
<configuration>
236+
<configuration>
237+
<properties>
238+
<cargo.servlet.port>8080</cargo.servlet.port>
239+
<cargo.tomcat.ajp.port>1099</cargo.tomcat.ajp.port>
240+
<cargo.rmi.port>1099</cargo.rmi.port>
241+
<cargo.logging>medium</cargo.logging>
242+
<cargo.jvmargs>${cargo.container.jvmargs}</cargo.jvmargs>
243+
</properties>
244+
</configuration>
245+
<container>
246+
<containerId>${cargo.container.id}</containerId>
247+
<zipUrlInstaller>
248+
<url>${cargo.container.url}</url>
249+
</zipUrlInstaller>
250+
</container>
251+
</configuration>
252+
</plugin>
253+
</plugins>
254+
</build>
255+
256+
<profiles>
257+
<profile>
258+
<id>tomcat8</id>
259+
<properties>
260+
<cargo.container.id>tomcat8x</cargo.container.id>
261+
<cargo.container.url>
262+
http://www.eu.apache.org/dist/tomcat/tomcat-8/v8.0.18/bin/apache-tomcat-8.0.18.zip
263+
</cargo.container.url>
264+
</properties>
265+
</profile>
266+
<profile>
267+
<id>jetty8</id>
268+
<build>
269+
<plugins>
270+
<plugin>
271+
<groupId>org.codehaus.cargo</groupId>
272+
<artifactId>cargo-maven2-plugin</artifactId>
273+
<configuration>
274+
<container>
275+
<containerId>jetty8x</containerId>
276+
<type>embedded</type>
277+
</container>
278+
</configuration>
279+
</plugin>
280+
</plugins>
281+
</build>
282+
</profile>
283+
<profile>
284+
<id>debug</id>
285+
<properties>
286+
<cargo.container.jvmargs>
287+
-Xdebug
288+
-Xrunjdwp:transport=dt_socket,address=${cargo.jvm.debug.port},suspend=n,server=y
289+
-Xnoagent
290+
-Djava.compiler=NONE
291+
</cargo.container.jvmargs>
292+
</properties>
293+
</profile>
294+
</profiles>
295+
296+
<repositories>
297+
<repository>
298+
<id>spring-maven-snapshot</id>
299+
<name>Springframework Maven Snapshot Repository</name>
300+
<url>http://repo.spring.io/snapshot</url>
301+
<snapshots>
302+
<enabled>true</enabled>
303+
</snapshots>
304+
</repository>
305+
</repositories>
306+
307+
</project>
308+

SPR-12669/src/main/java/org/springframework/issues/.gitignore

Whitespace-only changes.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package org.springframework.issues.config;
2+
3+
import java.util.Collections;
4+
import java.util.LinkedHashMap;
5+
import java.util.Map;
6+
7+
import javax.servlet.ServletContext;
8+
9+
import org.springframework.beans.BeansException;
10+
import org.springframework.beans.factory.annotation.Autowired;
11+
import org.springframework.context.ApplicationContext;
12+
import org.springframework.context.ApplicationContextAware;
13+
import org.springframework.context.annotation.Bean;
14+
import org.springframework.context.annotation.Configuration;
15+
import org.springframework.web.servlet.HandlerInterceptor;
16+
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
17+
import org.springframework.web.servlet.resource.PathResourceResolver;
18+
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
19+
import org.springframework.web.servlet.resource.ResourceResolver;
20+
import org.springframework.web.servlet.resource.ResourceUrlProvider;
21+
import org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor;
22+
23+
@Configuration
24+
public class ResourceConfiguration {
25+
26+
@Bean
27+
@Autowired
28+
public SimpleUrlHandlerMapping wuicResourceHandlerMapping(ApplicationContext applicationContext,
29+
ServletContext servletContext,
30+
ResourceUrlProvider resourceUrlProvider) {
31+
SimpleUrlHandlerMapping hm = new SimpleUrlHandlerMapping();
32+
hm.setUrlMap(createResourceHandlingUrlMap(applicationContext, servletContext));
33+
hm.setInterceptors(new HandlerInterceptor[] {
34+
new ResourceUrlProviderExposingInterceptor(resourceUrlProvider)});
35+
return hm;
36+
}
37+
38+
private Map<String, ResourceHttpRequestHandler> createResourceHandlingUrlMap(ApplicationContext applicationContext,
39+
ServletContext servletContext) {
40+
Map<String, ResourceHttpRequestHandler> urlMap = new LinkedHashMap<String, ResourceHttpRequestHandler>();
41+
ResourceHttpRequestHandler resourceHandler = new ResourceHttpRequestHandler();
42+
resourceHandler.setServletContext(servletContext);
43+
resourceHandler.setApplicationContext(applicationContext);
44+
resourceHandler.setLocations(Collections.singletonList(applicationContext.getResource("classpath:/static/")));
45+
resourceHandler.setResourceResolvers(Collections.<ResourceResolver>singletonList(new PathResourceResolver()));
46+
urlMap.put("/static/**", resourceHandler);
47+
return urlMap;
48+
}
49+
50+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.springframework.issues.config;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.ComponentScan;
5+
import org.springframework.context.annotation.Configuration;
6+
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
7+
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
8+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
9+
import org.springframework.web.servlet.view.InternalResourceViewResolver;
10+
11+
@EnableWebMvc
12+
@ComponentScan(basePackages="org.springframework.issues")
13+
@Configuration
14+
public class WebConfig extends WebMvcConfigurerAdapter {
15+
16+
@Override
17+
public void addViewControllers(ViewControllerRegistry registry) {
18+
registry.addViewController("/").setViewName("home");
19+
}
20+
21+
@Bean
22+
public InternalResourceViewResolver viewResolver() {
23+
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
24+
viewResolver.setPrefix("/WEB-INF/views/");
25+
viewResolver.setSuffix(".jsp");
26+
return viewResolver;
27+
}
28+
29+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
log4j.rootCategory=INFO, stdout
2+
3+
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
4+
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
5+
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
6+
7+
log4j.category.org.springframework.web=DEBUG

0 commit comments

Comments
 (0)