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

Commit 10b59ef

Browse files
committed
Add repro project for SPR-12013
1 parent aeed125 commit 10b59ef

File tree

10 files changed

+371
-0
lines changed

10 files changed

+371
-0
lines changed

SPR-12013/pom.xml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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-12013</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<packaging>war</packaging>
8+
9+
<properties>
10+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11+
12+
<java.version>1.6</java.version>
13+
<spring.version>4.1.0.BUILD-SNAPSHOT</spring.version>
14+
<slf4j.version>1.7.5</slf4j.version>
15+
<thymeleaf.version>2.1.2.RELEASE</thymeleaf.version>
16+
</properties>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>org.springframework</groupId>
21+
<artifactId>spring-context</artifactId>
22+
<version>${spring.version}</version>
23+
</dependency>
24+
25+
<dependency>
26+
<groupId>org.springframework</groupId>
27+
<artifactId>spring-webmvc</artifactId>
28+
<version>${spring.version}</version>
29+
</dependency>
30+
31+
<dependency>
32+
<groupId>javax.servlet</groupId>
33+
<artifactId>jstl</artifactId>
34+
<version>1.2</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+
<dependency>
63+
<groupId>junit</groupId>
64+
<artifactId>junit</artifactId>
65+
<version>4.11</version>
66+
<scope>test</scope>
67+
</dependency>
68+
69+
<dependency>
70+
<groupId>org.thymeleaf</groupId>
71+
<artifactId>thymeleaf</artifactId>
72+
<version>${thymeleaf.version}</version>
73+
</dependency>
74+
75+
<dependency>
76+
<groupId>org.thymeleaf</groupId>
77+
<artifactId>thymeleaf-spring4</artifactId>
78+
<version>${thymeleaf.version}</version>
79+
</dependency>
80+
81+
<dependency>
82+
<groupId>org.thymeleaf.extras</groupId>
83+
<artifactId>thymeleaf-extras-tiles2-spring4</artifactId>
84+
<version>2.1.1.RELEASE</version>
85+
</dependency>
86+
</dependencies>
87+
88+
<build>
89+
<plugins>
90+
<plugin>
91+
<groupId>org.apache.maven.plugins</groupId>
92+
<artifactId>maven-compiler-plugin</artifactId>
93+
<version>2.5.1</version>
94+
<configuration>
95+
<source>${java.version}</source>
96+
<target>${java.version}</target>
97+
</configuration>
98+
</plugin>
99+
<plugin>
100+
<groupId>org.apache.maven.plugins</groupId>
101+
<artifactId>maven-surefire-plugin</artifactId>
102+
<version>2.12.4</version>
103+
<configuration>
104+
<includes>
105+
<include>**/*Tests.java</include>
106+
<include>**/*Test.java</include>
107+
</includes>
108+
<excludes>
109+
<exclude>**/*Abstract*.java</exclude>
110+
</excludes>
111+
</configuration>
112+
</plugin>
113+
</plugins>
114+
</build>
115+
116+
<repositories>
117+
<repository>
118+
<id>spring-maven-snapshot</id>
119+
<name>Springframework Maven Snapshot Repository</name>
120+
<url>http://repo.spring.io/snapshot</url>
121+
<snapshots>
122+
<enabled>true</enabled>
123+
</snapshots>
124+
</repository>
125+
</repositories>
126+
127+
</project>
128+
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Copyright 2002-2014 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+
17+
package org.springframework.issues;
18+
19+
import java.util.HashSet;
20+
import java.util.Set;
21+
22+
import org.thymeleaf.dialect.IDialect;
23+
import org.thymeleaf.extras.tiles2.dialect.TilesDialect;
24+
import org.thymeleaf.extras.tiles2.spring4.web.configurer.ThymeleafTilesConfigurer;
25+
import org.thymeleaf.extras.tiles2.spring4.web.view.ThymeleafTilesView;
26+
import org.thymeleaf.spring4.SpringTemplateEngine;
27+
import org.thymeleaf.spring4.view.ThymeleafViewResolver;
28+
import org.thymeleaf.templateresolver.ServletContextTemplateResolver;
29+
import org.thymeleaf.templateresolver.TemplateResolver;
30+
31+
import org.springframework.context.annotation.Bean;
32+
import org.springframework.context.annotation.Configuration;
33+
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
34+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
35+
36+
@EnableWebMvc
37+
@Configuration
38+
public class Config extends WebMvcConfigurerAdapter {
39+
40+
@Bean
41+
public SpringTemplateEngine templateEngine() {
42+
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
43+
Set<TemplateResolver> templateResolvers = new java.util.HashSet<TemplateResolver>();
44+
templateResolvers.add(webTemplateResolver());
45+
templateEngine.setTemplateResolvers(templateResolvers);
46+
Set<IDialect> additionalDialects = new HashSet<IDialect>();
47+
additionalDialects.add(new TilesDialect());
48+
templateEngine.setAdditionalDialects(additionalDialects);
49+
return templateEngine;
50+
}
51+
52+
@Bean
53+
public ServletContextTemplateResolver webTemplateResolver() {
54+
ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
55+
templateResolver.setPrefix("WEB-INF/templates/");
56+
templateResolver.setSuffix(".html");
57+
templateResolver.setTemplateMode("HTML5");
58+
templateResolver.setCharacterEncoding("UTF-8");
59+
templateResolver.setOrder(2);
60+
return templateResolver;
61+
}
62+
63+
@Bean
64+
public ThymeleafViewResolver viewResolver() {
65+
ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
66+
viewResolver.setViewClass(ThymeleafTilesView.class);
67+
viewResolver.setTemplateEngine(templateEngine());
68+
viewResolver.setCharacterEncoding("UTF-8");
69+
return viewResolver;
70+
}
71+
72+
@Bean
73+
public ThymeleafTilesConfigurer tilesConfigurer() {
74+
ThymeleafTilesConfigurer tilesConfigurer = new ThymeleafTilesConfigurer();
75+
return tilesConfigurer;
76+
}
77+
78+
@Bean
79+
public ContactController contactController() {
80+
return new ContactController();
81+
}
82+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2002-2014 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+
17+
package org.springframework.issues;
18+
19+
public class Contact {
20+
21+
private String firstname;
22+
private String lastname;
23+
24+
public Contact(String firstname, String lastname) {
25+
this.firstname = firstname;
26+
this.lastname = lastname;
27+
}
28+
29+
public String getFirstname() {
30+
return firstname;
31+
}
32+
33+
public void setFirstname(String firstname) {
34+
this.firstname = firstname;
35+
}
36+
37+
public String getLastname() {
38+
return lastname;
39+
}
40+
41+
public void setLastname(String lastname) {
42+
this.lastname = lastname;
43+
}
44+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2002-2014 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+
17+
package org.springframework.issues;
18+
19+
import java.util.ArrayList;
20+
import java.util.List;
21+
22+
import org.springframework.stereotype.Controller;
23+
import org.springframework.ui.Model;
24+
import org.springframework.web.bind.annotation.RequestMapping;
25+
26+
@Controller
27+
public class ContactController {
28+
29+
@RequestMapping("/")
30+
public String index(Model model) {
31+
List<Contact> contacts = new ArrayList<Contact>();
32+
contacts.add(new Contact("Brian", "Clozel"));
33+
contacts.add(new Contact("Rossen", "Stoyanchev"));
34+
model.addAttribute("contacts", contacts);
35+
return "index";
36+
}
37+
38+
}

SPR-12013/src/main/resources/.gitignore

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<table xmlns:th="http://www.thymeleaf.org" th:if="${not #lists.isEmpty(contacts)}">
2+
<tr>
3+
<th>Firstname</th>
4+
<th>Lastname</th>
5+
</tr>
6+
<tr th:each="contact : ${contacts}">
7+
<td th:text="${contact.lastname}">The first name</td>
8+
<td th:text="${contact.firstname}">The last name</td>
9+
</tr>
10+
</table>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:tiles="http://www.thymeleaf.org">
3+
4+
<body>
5+
<div id="body">
6+
<div tiles:include="body">
7+
Sample text
8+
</div>
9+
</div>
10+
</body>
11+
</html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="ISO-8859-1" ?>
2+
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
3+
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
4+
5+
<tiles-definitions>
6+
7+
<definition name="index" template="template">
8+
<put-attribute name="body" value="main" />
9+
</definition>
10+
11+
</tiles-definitions>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
5+
6+
<context-param>
7+
<param-name>contextClass</param-name>
8+
<param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
9+
</context-param>
10+
11+
<context-param>
12+
<param-name>contextConfigLocation</param-name>
13+
<param-value>org.springframework.issues</param-value>
14+
</context-param>
15+
16+
<listener>
17+
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
18+
</listener>
19+
20+
<servlet>
21+
<servlet-name>appServlet</servlet-name>
22+
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
23+
<init-param>
24+
<param-name>contextConfigLocation</param-name>
25+
<param-value></param-value>
26+
</init-param>
27+
<load-on-startup>1</load-on-startup>
28+
</servlet>
29+
30+
<servlet-mapping>
31+
<servlet-name>appServlet</servlet-name>
32+
<url-pattern>/</url-pattern>
33+
</servlet-mapping>
34+
35+
<!-- Disables Servlet Container welcome file handling. Needed for compatibility
36+
with Servlet 3.0 and Tomcat 7.0 -->
37+
<welcome-file-list>
38+
<welcome-file></welcome-file>
39+
</welcome-file-list>
40+
41+
</web-app>

0 commit comments

Comments
 (0)