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

Commit 3affcf7

Browse files
committed
Project for SPR-13412
1 parent 6bdf345 commit 3affcf7

File tree

10 files changed

+488
-0
lines changed

10 files changed

+488
-0
lines changed

SPR-13412/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Repro project for SPR-0000-war-java
2+
3+
The project will be available at: http://localhost:8080/SPR-0000-war-java/
4+
5+
## Deploying
6+
7+
It is possible to deploy your application directly from the command-line
8+
using maven. You can use either [cargo](http://cargo.codehaus.org/) or
9+
the [jetty plugin](http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html)
10+
to run on a wide range of containers.
11+
12+
### Cargo
13+
14+
By default Cargo is configured to start `Tomcat7` and can be invoked by
15+
running `mvn package cargo:run`. Cargo can also run a [wide range of other
16+
containers](http://cargo.codehaus.org/Containers) and you can easily add
17+
yours by editing the `pom.xml`. For instance, a `tomcat8` profile
18+
has been added and can be invoked via `mvn package cargo:run -Ptomcat8`.
19+
20+
You can remote debug the application, in your IDE, by using the following command:
21+
`mvn package cargo:run -Ptomcat8 -Pdebug`. Note that you can customize the debug
22+
port used with the `cargo.jvm.debug.port` maven property.
23+
24+
### Jetty
25+
26+
To deploy your application to jetty9, simply invoke `mvn jetty:run`. It
27+
is possible to tune the exact jetty9 version you want to use by specifying
28+
the version of the command line, e.g. `mvn jetty:run -Djetty.version=9.0.6.v20130930`
29+
30+
To run a different version of jetty, please fallback to cargo as the
31+
coordinates of the maven plugin have changed. A sample `jetty8` profile is
32+
created for reference and can be tuned to suit your needs. To deploy your
33+
sample application to jetty8 run `mvn cargo:run -Pjetty8`
34+
35+
## Logging
36+
37+
This project contains a `log4j.properties` file in `src/main/resources` that you
38+
may wish to configure to emit more detailed logging. The root logger is set to
39+
`INFO` and a custom `org.springframework.web` logger is set to `DEBUG`.
40+
41+

SPR-13412/pom.xml

Lines changed: 303 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,303 @@
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-13412</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+
<!-- Logging -->
47+
<dependency>
48+
<groupId>org.slf4j</groupId>
49+
<artifactId>slf4j-api</artifactId>
50+
<version>${slf4j.version}</version>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.slf4j</groupId>
54+
<artifactId>jcl-over-slf4j</artifactId>
55+
<version>${slf4j.version}</version>
56+
<scope>runtime</scope>
57+
</dependency>
58+
<dependency>
59+
<groupId>org.slf4j</groupId>
60+
<artifactId>slf4j-log4j12</artifactId>
61+
<version>${slf4j.version}</version>
62+
<scope>runtime</scope>
63+
</dependency>
64+
<dependency>
65+
<groupId>log4j</groupId>
66+
<artifactId>log4j</artifactId>
67+
<version>1.2.17</version>
68+
<scope>runtime</scope>
69+
</dependency>
70+
71+
<!-- Servlet API -->
72+
<dependency>
73+
<groupId>javax.servlet</groupId>
74+
<artifactId>servlet-api</artifactId>
75+
<version>2.5</version>
76+
<scope>provided</scope>
77+
</dependency>
78+
79+
<!-- JSP API and JSTL
80+
<dependency>
81+
<groupId>javax.servlet.jsp</groupId>
82+
<artifactId>jsp-api</artifactId>
83+
<version>2.1</version>
84+
<scope>provided</scope>
85+
</dependency>
86+
<dependency>
87+
<groupId>javax.servlet</groupId>
88+
<artifactId>jstl</artifactId>
89+
<version>1.2</version>
90+
</dependency>
91+
-->
92+
93+
<!-- Apache Tiles
94+
<dependency>
95+
<groupId>org.apache.tiles</groupId>
96+
<artifactId>tiles-jsp</artifactId>
97+
<version>2.1.3</version>
98+
<exclusions>
99+
<exclusion>
100+
<groupId>commons-logging</groupId>
101+
<artifactId>commons-logging-api</artifactId>
102+
</exclusion>
103+
</exclusions>
104+
</dependency>
105+
-->
106+
107+
<!-- JSR 303 with Hibernate Validator
108+
<dependency>
109+
<groupId>javax.validation</groupId>
110+
<artifactId>validation-api</artifactId>
111+
<version>1.0.0.GA</version>
112+
</dependency>
113+
<dependency>
114+
<groupId>org.hibernate</groupId>
115+
<artifactId>hibernate-validator</artifactId>
116+
<version>4.1.0.Final</version>
117+
</dependency>
118+
-->
119+
120+
<!-- Joda Time Library
121+
<dependency>
122+
<groupId>joda-time</groupId>
123+
<artifactId>joda-time</artifactId>
124+
<version>1.6.2</version>
125+
</dependency>
126+
<dependency>
127+
<groupId>joda-time</groupId>
128+
<artifactId>joda-time-jsptags</artifactId>
129+
<version>1.0.2</version>
130+
<scope>runtime</scope>
131+
</dependency>
132+
-->
133+
134+
<!-- Apache Commons File Upload
135+
<dependency>
136+
<groupId>commons-fileupload</groupId>
137+
<artifactId>commons-fileupload</artifactId>
138+
<version>1.2.2</version>
139+
</dependency>
140+
<dependency>
141+
<groupId>commons-io</groupId>
142+
<artifactId>commons-io</artifactId>
143+
<version>2.0.1</version>
144+
</dependency>
145+
-->
146+
147+
<!-- Jackson JSON Processor
148+
<dependency>
149+
<groupId>com.fasterxml.jackson.core</groupId>
150+
<artifactId>jackson-databind</artifactId>
151+
<version>2.4.3</version>
152+
</dependency>
153+
-->
154+
155+
<!-- Rome Atom+RSS
156+
<dependency>
157+
<groupId>rome</groupId>
158+
<artifactId>rome</artifactId>
159+
<version>1.0</version>
160+
</dependency>
161+
-->
162+
163+
<!-- Test -->
164+
<dependency>
165+
<groupId>junit</groupId>
166+
<artifactId>junit</artifactId>
167+
<version>4.11</version>
168+
<scope>test</scope>
169+
</dependency>
170+
</dependencies>
171+
172+
<build>
173+
<plugins>
174+
<plugin>
175+
<groupId>org.apache.maven.plugins</groupId>
176+
<artifactId>maven-compiler-plugin</artifactId>
177+
<version>2.5.1</version>
178+
<configuration>
179+
<source>${java.version}</source>
180+
<target>${java.version}</target>
181+
</configuration>
182+
</plugin>
183+
<plugin>
184+
<groupId>org.apache.maven.plugins</groupId>
185+
<artifactId>maven-dependency-plugin</artifactId>
186+
<version>2.8</version>
187+
<executions>
188+
<execution>
189+
<id>install</id>
190+
<phase>install</phase>
191+
<goals>
192+
<goal>sources</goal>
193+
</goals>
194+
</execution>
195+
</executions>
196+
</plugin>
197+
<plugin>
198+
<groupId>org.apache.maven.plugins</groupId>
199+
<artifactId>maven-eclipse-plugin</artifactId>
200+
<version>2.8</version>
201+
<configuration>
202+
<downloadSources>true</downloadSources>
203+
<downloadJavadocs>false</downloadJavadocs>
204+
<wtpversion>2.0</wtpversion>
205+
</configuration>
206+
</plugin>
207+
<plugin>
208+
<groupId>org.apache.maven.plugins</groupId>
209+
<artifactId>maven-surefire-plugin</artifactId>
210+
<version>2.12.4</version>
211+
<configuration>
212+
<includes>
213+
<include>**/*Tests.java</include>
214+
<include>**/*Test.java</include>
215+
</includes>
216+
<excludes>
217+
<exclude>**/*Abstract*.java</exclude>
218+
</excludes>
219+
</configuration>
220+
</plugin>
221+
<plugin>
222+
<groupId>org.eclipse.jetty</groupId>
223+
<artifactId>jetty-maven-plugin</artifactId>
224+
<version>${jetty.version}</version>
225+
</plugin>
226+
<plugin>
227+
<groupId>org.codehaus.cargo</groupId>
228+
<artifactId>cargo-maven2-plugin</artifactId>
229+
<version>1.4.7</version>
230+
<configuration>
231+
<configuration>
232+
<properties>
233+
<cargo.servlet.port>8080</cargo.servlet.port>
234+
<cargo.tomcat.ajp.port>1099</cargo.tomcat.ajp.port>
235+
<cargo.rmi.port>1099</cargo.rmi.port>
236+
<cargo.logging>medium</cargo.logging>
237+
<cargo.jvmargs>${cargo.container.jvmargs}</cargo.jvmargs>
238+
</properties>
239+
</configuration>
240+
<container>
241+
<containerId>${cargo.container.id}</containerId>
242+
<zipUrlInstaller>
243+
<url>${cargo.container.url}</url>
244+
</zipUrlInstaller>
245+
</container>
246+
</configuration>
247+
</plugin>
248+
</plugins>
249+
</build>
250+
251+
<profiles>
252+
<profile>
253+
<id>tomcat8</id>
254+
<properties>
255+
<cargo.container.id>tomcat8x</cargo.container.id>
256+
<cargo.container.url>
257+
http://www.eu.apache.org/dist/tomcat/tomcat-8/v8.0.15/bin/apache-tomcat-8.0.15.zip
258+
</cargo.container.url>
259+
</properties>
260+
</profile>
261+
<profile>
262+
<id>jetty8</id>
263+
<build>
264+
<plugins>
265+
<plugin>
266+
<groupId>org.codehaus.cargo</groupId>
267+
<artifactId>cargo-maven2-plugin</artifactId>
268+
<configuration>
269+
<container>
270+
<containerId>jetty8x</containerId>
271+
<type>embedded</type>
272+
</container>
273+
</configuration>
274+
</plugin>
275+
</plugins>
276+
</build>
277+
</profile>
278+
<profile>
279+
<id>debug</id>
280+
<properties>
281+
<cargo.container.jvmargs>
282+
-Xdebug
283+
-Xrunjdwp:transport=dt_socket,address=${cargo.jvm.debug.port},suspend=n,server=y
284+
-Xnoagent
285+
-Djava.compiler=NONE
286+
</cargo.container.jvmargs>
287+
</properties>
288+
</profile>
289+
</profiles>
290+
291+
<repositories>
292+
<repository>
293+
<id>spring-maven-snapshot</id>
294+
<name>Springframework Maven Snapshot Repository</name>
295+
<url>http://repo.spring.io/snapshot</url>
296+
<snapshots>
297+
<enabled>true</enabled>
298+
</snapshots>
299+
</repository>
300+
</repositories>
301+
302+
</project>
303+

SPR-13412/src/main/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+
/*
2+
* Copyright 2002-2015 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.issues;
17+
18+
import org.springframework.stereotype.Controller;
19+
import org.springframework.web.bind.annotation.RequestMapping;
20+
import org.springframework.web.bind.annotation.RequestMethod;
21+
import org.springframework.web.bind.annotation.ResponseBody;
22+
import org.springframework.web.context.request.async.DeferredResult;
23+
24+
@Controller
25+
public class TestController {
26+
27+
@RequestMapping(value = "/getAsync", method = RequestMethod.GET)
28+
@ResponseBody
29+
public DeferredResult<String> getAsync() {
30+
final DeferredResult<String> res = new DeferredResult<String>();
31+
new Thread(new Runnable() {
32+
@Override
33+
public void run() {
34+
try {
35+
Thread.sleep(5000);
36+
res.setResult("Test string");
37+
} catch(InterruptedException e) {
38+
e.printStackTrace();
39+
}
40+
}
41+
}).start();
42+
return res;
43+
}
44+
45+
}

0 commit comments

Comments
 (0)