This repository has been archived by the owner on Dec 15, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
418 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target/ | ||
.idea/ | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Repro project for SPR-13078 | ||
|
||
The project will be available at: http://localhost:8080/index.html | ||
|
||
## Deploying | ||
|
||
It is possible to deploy your application directly from the command-line | ||
using maven. You can use either [cargo](http://cargo.codehaus.org/) or | ||
the [jetty plugin](http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html) | ||
to run on a wide range of containers. | ||
|
||
### Cargo | ||
|
||
By default Cargo is configured to start `Tomcat7` and can be invoked by | ||
running `mvn package cargo:run`. Cargo can also run a [wide range of other | ||
containers](http://cargo.codehaus.org/Containers) and you can easily add | ||
yours by editing the `pom.xml`. For instance, a `tomcat8` profile | ||
has been added and can be invoked via `mvn package cargo:run -Ptomcat8`. | ||
|
||
You can remote debug the application, in your IDE, by using the following command: | ||
`mvn package cargo:run -Ptomcat8 -Pdebug`. Note that you can customize the debug | ||
port used with the `cargo.jvm.debug.port` maven property. | ||
|
||
### Jetty | ||
|
||
To deploy your application to jetty9, simply invoke `mvn jetty:run`. It | ||
is possible to tune the exact jetty9 version you want to use by specifying | ||
the version of the command line, e.g. `mvn jetty:run -Djetty.version=9.0.6.v20130930` | ||
|
||
To run a different version of jetty, please fallback to cargo as the | ||
coordinates of the maven plugin have changed. A sample `jetty8` profile is | ||
created for reference and can be tuned to suit your needs. To deploy your | ||
sample application to jetty8 run `mvn cargo:run -Pjetty8` | ||
|
||
## Logging | ||
|
||
This project contains a `log4j.properties` file in `src/main/resources` that you | ||
may wish to configure to emit more detailed logging. The root logger is set to | ||
`INFO` and a custom `org.springframework.web` logger is set to `DEBUG`. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.springframework.issues</groupId> | ||
<artifactId>SPR-13078</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>Spring MVC Issue Reproduction Project</name> | ||
<packaging>war</packaging> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
|
||
<java.version>1.6</java.version> | ||
<spring.version>4.1.4.RELEASE</spring.version> | ||
<slf4j.version>1.7.5</slf4j.version> | ||
|
||
<jetty.version>9.1.2.v20140210</jetty.version> | ||
<cargo.container.id>tomcat7x</cargo.container.id> | ||
<cargo.container.url> | ||
http://www.eu.apache.org/dist/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.zip | ||
</cargo.container.url> | ||
<cargo.container.jvmargs>-Xms96m -Xmx512m -Djava.awt.headless=true</cargo.container.jvmargs> | ||
<cargo.jvm.debug.port>8000</cargo.jvm.debug.port> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- Spring Framework --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
<version>${spring.version}</version> | ||
<exclusions> | ||
<!-- Exclude Commons Logging in favor of SLF4j --> | ||
<exclusion> | ||
<groupId>commons-logging</groupId> | ||
<artifactId>commons-logging</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-webmvc</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
|
||
<!-- Logging --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>${slf4j.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>jcl-over-slf4j</artifactId> | ||
<version>${slf4j.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<version>${slf4j.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<version>1.2.17</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
|
||
<!-- Servlet API --> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>servlet-api</artifactId> | ||
<version>2.5</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.4.3</version> | ||
</dependency> | ||
|
||
<!-- Test --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.11</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.5.1</version> | ||
<configuration> | ||
<source>${java.version}</source> | ||
<target>${java.version}</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<version>2.8</version> | ||
<executions> | ||
<execution> | ||
<id>install</id> | ||
<phase>install</phase> | ||
<goals> | ||
<goal>sources</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-eclipse-plugin</artifactId> | ||
<version>2.8</version> | ||
<configuration> | ||
<downloadSources>true</downloadSources> | ||
<downloadJavadocs>false</downloadJavadocs> | ||
<wtpversion>2.0</wtpversion> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.12.4</version> | ||
<configuration> | ||
<includes> | ||
<include>**/*Tests.java</include> | ||
<include>**/*Test.java</include> | ||
</includes> | ||
<excludes> | ||
<exclude>**/*Abstract*.java</exclude> | ||
</excludes> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-maven-plugin</artifactId> | ||
<version>${jetty.version}</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.cargo</groupId> | ||
<artifactId>cargo-maven2-plugin</artifactId> | ||
<version>1.4.7</version> | ||
<configuration> | ||
<configuration> | ||
<properties> | ||
<cargo.servlet.port>8080</cargo.servlet.port> | ||
<cargo.tomcat.ajp.port>1099</cargo.tomcat.ajp.port> | ||
<cargo.rmi.port>1099</cargo.rmi.port> | ||
<cargo.logging>medium</cargo.logging> | ||
<cargo.jvmargs>${cargo.container.jvmargs}</cargo.jvmargs> | ||
</properties> | ||
</configuration> | ||
<container> | ||
<containerId>${cargo.container.id}</containerId> | ||
<zipUrlInstaller> | ||
<url>${cargo.container.url}</url> | ||
</zipUrlInstaller> | ||
</container> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>tomcat8</id> | ||
<properties> | ||
<cargo.container.id>tomcat8x</cargo.container.id> | ||
<cargo.container.url> | ||
http://www.eu.apache.org/dist/tomcat/tomcat-8/v8.0.15/bin/apache-tomcat-8.0.15.zip | ||
</cargo.container.url> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>jetty8</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.cargo</groupId> | ||
<artifactId>cargo-maven2-plugin</artifactId> | ||
<configuration> | ||
<container> | ||
<containerId>jetty8x</containerId> | ||
<type>embedded</type> | ||
</container> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
<profile> | ||
<id>debug</id> | ||
<properties> | ||
<cargo.container.jvmargs> | ||
-Xdebug | ||
-Xrunjdwp:transport=dt_socket,address=${cargo.jvm.debug.port},suspend=n,server=y | ||
-Xnoagent | ||
-Djava.compiler=NONE | ||
</cargo.container.jvmargs> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
|
||
<repositories> | ||
<repository> | ||
<id>spring-maven-snapshot</id> | ||
<name>Springframework Maven Snapshot Repository</name> | ||
<url>http://repo.spring.io/snapshot</url> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
</project> | ||
|
34 changes: 34 additions & 0 deletions
34
SPR-13078/src/main/java/org/springframework/issues/SampleController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2002-2015 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.issues; | ||
|
||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.servlet.view.json.MappingJackson2JsonView; | ||
|
||
@Controller | ||
public class SampleController { | ||
|
||
@RequestMapping("/user") | ||
MappingJackson2JsonView user() { | ||
MappingJackson2JsonView view = new MappingJackson2JsonView(); | ||
view.addStaticAttribute("user", new User("Sébastien", "Deleuze")); | ||
view.setPrefixJson(true); | ||
return view; | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
SPR-13078/src/main/java/org/springframework/issues/User.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2002-2015 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.issues; | ||
|
||
public class User { | ||
|
||
private String firstname; | ||
private String lastname; | ||
|
||
public User() { | ||
} | ||
|
||
public User(String firstname, String lastname) { | ||
this.firstname = firstname; | ||
this.lastname = lastname; | ||
} | ||
|
||
public String getFirstname() { | ||
return firstname; | ||
} | ||
|
||
public void setFirstname(String firstname) { | ||
this.firstname = firstname; | ||
} | ||
|
||
public String getLastname() { | ||
return lastname; | ||
} | ||
|
||
public void setLastname(String lastname) { | ||
this.lastname = lastname; | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
SPR-13078/src/main/java/org/springframework/issues/config/WebConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.springframework.issues.config; | ||
|
||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; | ||
import org.springframework.web.servlet.config.annotation.EnableWebMvc; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | ||
|
||
@EnableWebMvc | ||
@ComponentScan(basePackages="org.springframework.issues") | ||
@Configuration | ||
public class WebConfig extends WebMvcConfigurerAdapter { | ||
|
||
@Override | ||
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { | ||
configurer.enable(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
log4j.rootCategory=INFO, stdout | ||
|
||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | ||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n | ||
|
||
log4j.category.org.springframework.web=DEBUG |
Oops, something went wrong.