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

Commit 139ad04

Browse files
committed
Add repro project for SPR-13806
1 parent 49c0466 commit 139ad04

File tree

10 files changed

+447
-0
lines changed

10 files changed

+447
-0
lines changed

SPR-13806/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Spring MVC project with XML config
2+
3+
This is a simple template for creating issue reproduction projects per
4+
the [README in the root of this repository](https://github.com/spring-projects/spring-framework-issues#readme).
5+
Please review that document before starting.
6+
7+
As described at the link above, do not edit this project directly! Rather
8+
use the `./create-repro-project.sh` script to create a fresh copy to
9+
a new directory having the same name as the JIRA issue you're trying
10+
to reproduce and edit from there.
11+
12+
## Deploying
13+
14+
It is possible to deploy your application directly from the command-line
15+
using maven. See the next two sections on Cargo and Jetty.
16+
17+
### Cargo
18+
19+
You can deploy with the [Cargo Maven plugin](http://cargo.codehaus.org/) which
20+
supports a wide [range of servers](http://cargo.codehaus.org/Containers).
21+
The required command is `mvn package cargo:run`.
22+
23+
By default Cargo is configured to start with `Tomcat 8` but you can easily
24+
edit the plugin settings in `pom.xml` to switch to a different server
25+
and version. The pom.xml or to switch to debug settings.
26+
27+
### Jetty
28+
29+
You can also deploy with the
30+
[Jetty Maven plugin](http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html).
31+
The required command is `mvn jetty:run` or `mvnDebug jetty:run`.
32+
33+
## Logging
34+
35+
This project contains a `log4j.properties` file in `src/main/resources` that you
36+
may wish to configure to emit more detailed logging. The root logger is set to
37+
`INFO` and a custom `org.springframework.web` logger is set to `DEBUG`.

SPR-13806/pom.xml

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
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-13806</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+
<java.version>1.6</java.version>
13+
<spring.version>4.2.1.RELEASE</spring.version>
14+
<slf4j.version>1.7.12</slf4j.version>
15+
</properties>
16+
17+
<dependencies>
18+
<!-- Spring Framework -->
19+
<dependency>
20+
<groupId>org.springframework</groupId>
21+
<artifactId>spring-context</artifactId>
22+
<version>${spring.version}</version>
23+
<exclusions>
24+
<!-- Exclude Commons Logging in favor of SLF4j -->
25+
<exclusion>
26+
<groupId>commons-logging</groupId>
27+
<artifactId>commons-logging</artifactId>
28+
</exclusion>
29+
</exclusions>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.springframework</groupId>
33+
<artifactId>spring-webmvc</artifactId>
34+
<version>${spring.version}</version>
35+
</dependency>
36+
37+
<!-- Logging -->
38+
<dependency>
39+
<groupId>org.slf4j</groupId>
40+
<artifactId>slf4j-api</artifactId>
41+
<version>${slf4j.version}</version>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.slf4j</groupId>
45+
<artifactId>jcl-over-slf4j</artifactId>
46+
<version>${slf4j.version}</version>
47+
<scope>runtime</scope>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.slf4j</groupId>
51+
<artifactId>slf4j-log4j12</artifactId>
52+
<version>${slf4j.version}</version>
53+
<scope>runtime</scope>
54+
</dependency>
55+
<dependency>
56+
<groupId>log4j</groupId>
57+
<artifactId>log4j</artifactId>
58+
<version>1.2.17</version>
59+
<scope>runtime</scope>
60+
</dependency>
61+
62+
<!-- Servlet API -->
63+
<dependency>
64+
<groupId>javax.servlet</groupId>
65+
<artifactId>javax.servlet-api</artifactId>
66+
<version>3.0.1</version>
67+
<scope>provided</scope>
68+
</dependency>
69+
70+
<!-- JSP API and JSTL
71+
<dependency>
72+
<groupId>javax.servlet.jsp</groupId>
73+
<artifactId>jsp-api</artifactId>
74+
<version>2.1</version>
75+
<scope>provided</scope>
76+
</dependency>
77+
<dependency>
78+
<groupId>javax.servlet</groupId>
79+
<artifactId>jstl</artifactId>
80+
<version>1.2</version>
81+
</dependency>
82+
-->
83+
84+
<!-- Apache Tiles
85+
<dependency>
86+
<groupId>org.apache.tiles</groupId>
87+
<artifactId>tiles-jsp</artifactId>
88+
<version>2.1.3</version>
89+
<exclusions>
90+
<exclusion>
91+
<groupId>commons-logging</groupId>
92+
<artifactId>commons-logging-api</artifactId>
93+
</exclusion>
94+
</exclusions>
95+
</dependency>
96+
-->
97+
98+
<!-- JSR 303 with Hibernate Validator
99+
<dependency>
100+
<groupId>javax.validation</groupId>
101+
<artifactId>validation-api</artifactId>
102+
<version>1.0.0.GA</version>
103+
</dependency>
104+
<dependency>
105+
<groupId>org.hibernate</groupId>
106+
<artifactId>hibernate-validator</artifactId>
107+
<version>4.1.0.Final</version>
108+
</dependency>
109+
-->
110+
111+
<!-- Joda Time Library
112+
<dependency>
113+
<groupId>joda-time</groupId>
114+
<artifactId>joda-time</artifactId>
115+
<version>1.6.2</version>
116+
</dependency>
117+
<dependency>
118+
<groupId>joda-time</groupId>
119+
<artifactId>joda-time-jsptags</artifactId>
120+
<version>1.0.2</version>
121+
<scope>runtime</scope>
122+
</dependency>
123+
-->
124+
125+
<!-- Apache Commons File Upload
126+
<dependency>
127+
<groupId>commons-fileupload</groupId>
128+
<artifactId>commons-fileupload</artifactId>
129+
<version>1.2.2</version>
130+
</dependency>
131+
<dependency>
132+
<groupId>commons-io</groupId>
133+
<artifactId>commons-io</artifactId>
134+
<version>2.0.1</version>
135+
</dependency>
136+
-->
137+
138+
<!-- Jackson JSON Processor
139+
<dependency>
140+
<groupId>com.fasterxml.jackson.core</groupId>
141+
<artifactId>jackson-databind</artifactId>
142+
<version>2.6.2</version>
143+
</dependency>
144+
-->
145+
146+
<!-- Rome Atom+RSS
147+
<dependency>
148+
<groupId>rome</groupId>
149+
<artifactId>rome</artifactId>
150+
<version>1.0</version>
151+
</dependency>
152+
-->
153+
154+
<!-- Test -->
155+
<dependency>
156+
<groupId>junit</groupId>
157+
<artifactId>junit</artifactId>
158+
<version>4.12</version>
159+
<scope>test</scope>
160+
</dependency>
161+
<dependency>
162+
<groupId>org.springframework</groupId>
163+
<artifactId>spring-test</artifactId>
164+
<version>${spring.version}</version>
165+
<scope>test</scope>
166+
</dependency>
167+
</dependencies>
168+
169+
<build>
170+
<plugins>
171+
<plugin>
172+
<groupId>org.apache.maven.plugins</groupId>
173+
<artifactId>maven-compiler-plugin</artifactId>
174+
<version>2.5.1</version>
175+
<configuration>
176+
<source>${java.version}</source>
177+
<target>${java.version}</target>
178+
</configuration>
179+
</plugin>
180+
<plugin>
181+
<groupId>org.apache.maven.plugins</groupId>
182+
<artifactId>maven-dependency-plugin</artifactId>
183+
<version>2.8</version>
184+
<executions>
185+
<execution>
186+
<id>install</id>
187+
<phase>install</phase>
188+
<goals>
189+
<goal>sources</goal>
190+
</goals>
191+
</execution>
192+
</executions>
193+
</plugin>
194+
<plugin>
195+
<groupId>org.apache.maven.plugins</groupId>
196+
<artifactId>maven-eclipse-plugin</artifactId>
197+
<version>2.8</version>
198+
<configuration>
199+
<downloadSources>true</downloadSources>
200+
<downloadJavadocs>false</downloadJavadocs>
201+
<wtpversion>2.0</wtpversion>
202+
</configuration>
203+
</plugin>
204+
<plugin>
205+
<groupId>org.apache.maven.plugins</groupId>
206+
<artifactId>maven-surefire-plugin</artifactId>
207+
<version>2.12.4</version>
208+
<configuration>
209+
<includes>
210+
<include>**/*Tests.java</include>
211+
<include>**/*Test.java</include>
212+
</includes>
213+
<excludes>
214+
<exclude>**/*Abstract*.java</exclude>
215+
</excludes>
216+
</configuration>
217+
</plugin>
218+
<plugin>
219+
<groupId>org.eclipse.jetty</groupId>
220+
<artifactId>jetty-maven-plugin</artifactId>
221+
<version>9.3.3.v20150827</version>
222+
</plugin>
223+
<plugin>
224+
<groupId>org.codehaus.cargo</groupId>
225+
<artifactId>cargo-maven2-plugin</artifactId>
226+
<version>1.4.7</version>
227+
<configuration>
228+
<configuration>
229+
<properties>
230+
<cargo.servlet.port>8080</cargo.servlet.port>
231+
<cargo.logging>medium</cargo.logging>
232+
<cargo.jvmargs>-Xms96m -Xmx512m -Djava.awt.headless=true</cargo.jvmargs>
233+
<!--
234+
<cargo.jvmargs>
235+
-Xdebug
236+
-Xrunjdwp:transport=dt_socket,address=8000,suspend=n,server=y
237+
-Xnoagent
238+
-Djava.compiler=NONE
239+
</cargo.jvmargs>
240+
-->
241+
</properties>
242+
</configuration>
243+
<container>
244+
<containerId>tomcat8x</containerId>
245+
<zipUrlInstaller>
246+
<url>http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.26/bin/apache-tomcat-8.0.26.zip</url>
247+
</zipUrlInstaller>
248+
</container>
249+
</configuration>
250+
</plugin>
251+
</plugins>
252+
</build>
253+
254+
<repositories>
255+
<repository>
256+
<id>spring-maven-snapshot</id>
257+
<name>Springframework Maven Snapshot Repository</name>
258+
<url>http://repo.spring.io/snapshot</url>
259+
<snapshots>
260+
<enabled>true</enabled>
261+
</snapshots>
262+
</repository>
263+
</repositories>
264+
265+
</project>
266+

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

Whitespace-only changes.
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

SPR-13806/src/test/java/org/springframework/issues/.gitignore

Whitespace-only changes.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package org.springframework.issues;
2+
3+
import static org.junit.Assert.*;
4+
5+
import java.util.List;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import org.springframework.beans.factory.annotation.Autowired;
11+
import org.springframework.test.context.ContextConfiguration;
12+
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
13+
import org.springframework.test.context.web.WebAppConfiguration;
14+
import org.springframework.web.context.WebApplicationContext;
15+
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
16+
import org.springframework.web.servlet.resource.PathResourceResolver;
17+
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
18+
import org.springframework.web.servlet.resource.ResourceResolver;
19+
import org.springframework.web.servlet.resource.ResourceTransformer;
20+
21+
@RunWith(SpringJUnit4ClassRunner.class)
22+
@ContextConfiguration(locations = "classpath:mvc-resources-no-auto.xml")
23+
@WebAppConfiguration
24+
public class ResourceChainNoAutoTests {
25+
26+
@Autowired
27+
private WebApplicationContext webApplicationContext;
28+
29+
@Test
30+
public void shouldNotRegisterDefaultResourceChain() throws Exception {
31+
SimpleUrlHandlerMapping mapping = webApplicationContext.getBean(SimpleUrlHandlerMapping.class);
32+
assertNotNull(mapping);
33+
assertNotNull(mapping.getUrlMap().get("/resources/**"));
34+
ResourceHttpRequestHandler handler = webApplicationContext.getBean((String) mapping.getUrlMap().get("/resources/**"),
35+
ResourceHttpRequestHandler.class);
36+
assertNotNull(handler);
37+
38+
List<ResourceResolver> resolvers = handler.getResourceResolvers();
39+
assertEquals(resolvers.size(), 1);
40+
assertEquals(PathResourceResolver.class, resolvers.get(0).getClass());
41+
42+
List<ResourceTransformer> transformers = handler.getResourceTransformers();
43+
assertEquals(transformers.size(), 0);
44+
}
45+
}

0 commit comments

Comments
 (0)