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

Commit fb75c0d

Browse files
committed
Add repro project for SPR-13417
1 parent 39b5a43 commit fb75c0d

File tree

9 files changed

+449
-0
lines changed

9 files changed

+449
-0
lines changed

SPR-13417/README.md

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

SPR-13417/pom.xml

Lines changed: 301 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,301 @@
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-13417</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.2.1.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+
<dependency>
148+
<groupId>com.fasterxml.jackson.core</groupId>
149+
<artifactId>jackson-databind</artifactId>
150+
<version>2.6.1</version>
151+
</dependency>
152+
153+
<!-- Rome Atom+RSS
154+
<dependency>
155+
<groupId>rome</groupId>
156+
<artifactId>rome</artifactId>
157+
<version>1.0</version>
158+
</dependency>
159+
-->
160+
161+
<!-- Test -->
162+
<dependency>
163+
<groupId>junit</groupId>
164+
<artifactId>junit</artifactId>
165+
<version>4.11</version>
166+
<scope>test</scope>
167+
</dependency>
168+
</dependencies>
169+
170+
<build>
171+
<plugins>
172+
<plugin>
173+
<groupId>org.apache.maven.plugins</groupId>
174+
<artifactId>maven-compiler-plugin</artifactId>
175+
<version>2.5.1</version>
176+
<configuration>
177+
<source>${java.version}</source>
178+
<target>${java.version}</target>
179+
</configuration>
180+
</plugin>
181+
<plugin>
182+
<groupId>org.apache.maven.plugins</groupId>
183+
<artifactId>maven-dependency-plugin</artifactId>
184+
<version>2.8</version>
185+
<executions>
186+
<execution>
187+
<id>install</id>
188+
<phase>install</phase>
189+
<goals>
190+
<goal>sources</goal>
191+
</goals>
192+
</execution>
193+
</executions>
194+
</plugin>
195+
<plugin>
196+
<groupId>org.apache.maven.plugins</groupId>
197+
<artifactId>maven-eclipse-plugin</artifactId>
198+
<version>2.8</version>
199+
<configuration>
200+
<downloadSources>true</downloadSources>
201+
<downloadJavadocs>false</downloadJavadocs>
202+
<wtpversion>2.0</wtpversion>
203+
</configuration>
204+
</plugin>
205+
<plugin>
206+
<groupId>org.apache.maven.plugins</groupId>
207+
<artifactId>maven-surefire-plugin</artifactId>
208+
<version>2.12.4</version>
209+
<configuration>
210+
<includes>
211+
<include>**/*Tests.java</include>
212+
<include>**/*Test.java</include>
213+
</includes>
214+
<excludes>
215+
<exclude>**/*Abstract*.java</exclude>
216+
</excludes>
217+
</configuration>
218+
</plugin>
219+
<plugin>
220+
<groupId>org.eclipse.jetty</groupId>
221+
<artifactId>jetty-maven-plugin</artifactId>
222+
<version>${jetty.version}</version>
223+
</plugin>
224+
<plugin>
225+
<groupId>org.codehaus.cargo</groupId>
226+
<artifactId>cargo-maven2-plugin</artifactId>
227+
<version>1.4.7</version>
228+
<configuration>
229+
<configuration>
230+
<properties>
231+
<cargo.servlet.port>8080</cargo.servlet.port>
232+
<cargo.tomcat.ajp.port>1099</cargo.tomcat.ajp.port>
233+
<cargo.rmi.port>1099</cargo.rmi.port>
234+
<cargo.logging>medium</cargo.logging>
235+
<cargo.jvmargs>${cargo.container.jvmargs}</cargo.jvmargs>
236+
</properties>
237+
</configuration>
238+
<container>
239+
<containerId>${cargo.container.id}</containerId>
240+
<zipUrlInstaller>
241+
<url>${cargo.container.url}</url>
242+
</zipUrlInstaller>
243+
</container>
244+
</configuration>
245+
</plugin>
246+
</plugins>
247+
</build>
248+
249+
<profiles>
250+
<profile>
251+
<id>tomcat8</id>
252+
<properties>
253+
<cargo.container.id>tomcat8x</cargo.container.id>
254+
<cargo.container.url>
255+
http://www.eu.apache.org/dist/tomcat/tomcat-8/v8.0.26/bin/apache-tomcat-8.0.26.zip
256+
</cargo.container.url>
257+
</properties>
258+
</profile>
259+
<profile>
260+
<id>jetty8</id>
261+
<build>
262+
<plugins>
263+
<plugin>
264+
<groupId>org.codehaus.cargo</groupId>
265+
<artifactId>cargo-maven2-plugin</artifactId>
266+
<configuration>
267+
<container>
268+
<containerId>jetty8x</containerId>
269+
<type>embedded</type>
270+
</container>
271+
</configuration>
272+
</plugin>
273+
</plugins>
274+
</build>
275+
</profile>
276+
<profile>
277+
<id>debug</id>
278+
<properties>
279+
<cargo.container.jvmargs>
280+
-Xdebug
281+
-Xrunjdwp:transport=dt_socket,address=${cargo.jvm.debug.port},suspend=n,server=y
282+
-Xnoagent
283+
-Djava.compiler=NONE
284+
</cargo.container.jvmargs>
285+
</properties>
286+
</profile>
287+
</profiles>
288+
289+
<repositories>
290+
<repository>
291+
<id>spring-maven-snapshot</id>
292+
<name>Springframework Maven Snapshot Repository</name>
293+
<url>http://repo.spring.io/snapshot</url>
294+
<snapshots>
295+
<enabled>true</enabled>
296+
</snapshots>
297+
</repository>
298+
</repositories>
299+
300+
</project>
301+

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

Whitespace-only changes.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.springframework.issues;
2+
3+
import org.springframework.stereotype.Controller;
4+
import org.springframework.web.bind.annotation.RequestBody;
5+
import org.springframework.web.bind.annotation.RequestMapping;
6+
import org.springframework.web.bind.annotation.RequestMethod;
7+
import org.springframework.web.bind.annotation.ResponseBody;
8+
9+
@Controller
10+
public class TestController {
11+
12+
@RequestMapping(name= "/test", method = RequestMethod.POST)
13+
@ResponseBody
14+
public String handle(@RequestBody(required = false) String body) {
15+
return "OK";
16+
}
17+
18+
@RequestMapping(name= "/testjson", method = RequestMethod.POST,
19+
produces = "application/json", consumes = "application/json")
20+
@ResponseBody
21+
public String handle(@RequestBody(required = false) Book body) {
22+
return "OK";
23+
}
24+
25+
public class Book {
26+
String title;
27+
String author;
28+
}
29+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
}

0 commit comments

Comments
 (0)