Browse Source
Spring 5 removed support for Tiles 2 and Thymeleaf does not support Tiles 3 yet. This commit updates to Thymeleaf 3.0.2 and uses Thymeleaf's build in layout support. Issue gh-4080pull/232/merge
24 changed files with 180 additions and 362 deletions
@ -1,57 +0,0 @@
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?> |
||||
<!DOCTYPE tiles-definitions PUBLIC |
||||
"-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN" |
||||
"http://tiles.apache.org/dtds/tiles-config_2_1.dtd"> |
||||
<tiles-definitions> |
||||
|
||||
<definition name="messages/*" |
||||
template="layout"> |
||||
<put-attribute name="content" |
||||
value="content/messages/{1}"/> |
||||
<put-attribute name="title" |
||||
value="title/messages/{1}"/> |
||||
<put-attribute name="head" |
||||
value="head/messages/{1}"/> |
||||
</definition> |
||||
|
||||
<definition name="content/messages/*" |
||||
template="messages/{1} :: content"/> |
||||
<definition name="title/messages/*" |
||||
template="messages/{1} :: title"/> |
||||
<definition name="head/messages/*" |
||||
template="messages/{1} :: /html/head/link"/> |
||||
|
||||
<definition name="user/*" |
||||
template="layout"> |
||||
<put-attribute name="content" |
||||
value="content/user/{1}"/> |
||||
<put-attribute name="title" |
||||
value="title/user/{1}"/> |
||||
<put-attribute name="head" |
||||
value="head/user/{1}"/> |
||||
</definition> |
||||
|
||||
<definition name="content/user/*" |
||||
template="user/{1} :: content"/> |
||||
<definition name="title/user/*" |
||||
template="user/{1} :: title"/> |
||||
<definition name="head/user/*" |
||||
template="user/{1} :: /html/head/link"/> |
||||
|
||||
<definition name="*" |
||||
template="layout"> |
||||
<put-attribute name="content" |
||||
value="content/{1}"/> |
||||
<put-attribute name="title" |
||||
value="title/{1}"/> |
||||
<put-attribute name="head" |
||||
value="head/{1}"/> |
||||
</definition> |
||||
|
||||
<definition name="content/*" |
||||
template="{1} :: content"/> |
||||
<definition name="title/*" |
||||
template="{1} :: title"/> |
||||
<definition name="head/*" |
||||
template="{1} :: /html/head/link"/> |
||||
</tiles-definitions> |
||||
@ -1,27 +1,24 @@
@@ -1,27 +1,24 @@
|
||||
<html xmlns:th="http://www.thymeleaf.org" xmlns:tiles="http://www.thymeleaf.org"> |
||||
<head> |
||||
<title tiles:fragment="title">Log In</title> |
||||
</head> |
||||
<body> |
||||
<div tiles:fragment="content"> |
||||
<form name="f" th:action="@{/login}" method="post"> |
||||
<fieldset> |
||||
<legend>Please Login</legend> |
||||
<div th:if="${param.error}" class="alert alert-error"> |
||||
Invalid username and password. |
||||
</div> |
||||
<div th:if="${param.logout}" class="alert alert-success"> |
||||
You have been logged out. |
||||
</div> |
||||
<label for="username">Username</label> |
||||
<input type="text" id="username" name="username"/> |
||||
<label for="password">Password</label> |
||||
<input type="password" id="password" name="password"/> |
||||
<div class="form-actions"> |
||||
<button type="submit" class="btn">Log in</button> |
||||
</div> |
||||
</fieldset> |
||||
</form> |
||||
</div> |
||||
</body> |
||||
<html xmlns:th="http://www.thymeleaf.org"> |
||||
<head th:include="layout :: head(title=~{::title},links=~{})"> |
||||
<title>Please Login</title> |
||||
</head> |
||||
<body th:include="layout :: body" th:with="content=~{::content}"> |
||||
<div th:fragment="content"> |
||||
<form name="f" th:action="@{/login}" method="post"> |
||||
<fieldset> |
||||
<legend>Please Login</legend> |
||||
<div th:if="${param.error}" class="alert alert-error">Invalid |
||||
username and password.</div> |
||||
<div th:if="${param.logout}" class="alert alert-success">You |
||||
have been logged out.</div> |
||||
<label for="username">Username</label> <input type="text" |
||||
id="username" name="username" /> <label for="password">Password</label> |
||||
<input type="password" id="password" name="password" /> |
||||
<div class="form-actions"> |
||||
<button type="submit" class="btn">Log in</button> |
||||
</div> |
||||
</fieldset> |
||||
</form> |
||||
</div> |
||||
</body> |
||||
</html> |
||||
@ -1,27 +1,24 @@
@@ -1,27 +1,24 @@
|
||||
<html xmlns:th="http://www.thymeleaf.org" xmlns:tiles="http://www.thymeleaf.org"> |
||||
<head> |
||||
<title tiles:fragment="title">Please Login</title> |
||||
</head> |
||||
<body> |
||||
<div tiles:fragment="content"> |
||||
<form name="f" th:action="@{/login}" method="post"> |
||||
<fieldset> |
||||
<legend>Please Login</legend> |
||||
<div th:if="${param.error}" class="alert alert-error"> |
||||
Invalid username and password. |
||||
</div> |
||||
<div th:if="${param.logout}" class="alert alert-success"> |
||||
You have been logged out. |
||||
</div> |
||||
<label for="username">Username</label> |
||||
<input type="text" id="username" name="username"/> |
||||
<label for="password">Password</label> |
||||
<input type="password" id="password" name="password"/> |
||||
<div class="form-actions"> |
||||
<button type="submit" class="btn">Log in</button> |
||||
</div> |
||||
</fieldset> |
||||
</form> |
||||
</div> |
||||
</body> |
||||
<html xmlns:th="http://www.thymeleaf.org"> |
||||
<head th:include="layout :: head(title=~{::title},links=~{})"> |
||||
<title>Please Login</title> |
||||
</head> |
||||
<body th:include="layout :: body" th:with="content=~{::content}"> |
||||
<div th:fragment="content"> |
||||
<form name="f" th:action="@{/login}" method="post"> |
||||
<fieldset> |
||||
<legend>Please Login</legend> |
||||
<div th:if="${param.error}" class="alert alert-error">Invalid |
||||
username and password.</div> |
||||
<div th:if="${param.logout}" class="alert alert-success">You |
||||
have been logged out.</div> |
||||
<label for="username">Username</label> <input type="text" |
||||
id="username" name="username" /> <label for="password">Password</label> |
||||
<input type="password" id="password" name="password" /> |
||||
<div class="form-actions"> |
||||
<button type="submit" class="btn">Log in</button> |
||||
</div> |
||||
</fieldset> |
||||
</form> |
||||
</div> |
||||
</body> |
||||
</html> |
||||
@ -1,41 +0,0 @@
@@ -1,41 +0,0 @@
|
||||
/* |
||||
* Copyright 2002-2013 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.security.samples.mvc.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.core.Ordered; |
||||
import org.thymeleaf.spring4.SpringTemplateEngine; |
||||
import org.thymeleaf.spring4.view.ThymeleafViewResolver; |
||||
|
||||
/** |
||||
* Disable tiles so that we can provide our custom view without being decorated. |
||||
* |
||||
* @author Rob Winch |
||||
* |
||||
*/ |
||||
@Configuration |
||||
public class CustomMvcConfig { |
||||
|
||||
@Bean |
||||
public ThymeleafViewResolver thymeleafViewResolver(SpringTemplateEngine templateEngine) { |
||||
ThymeleafViewResolver viewResolver = new ThymeleafViewResolver(); |
||||
viewResolver.setOrder(Ordered.HIGHEST_PRECEDENCE - 10); |
||||
viewResolver.setTemplateEngine(templateEngine); |
||||
return viewResolver; |
||||
} |
||||
|
||||
} |
||||
@ -1,57 +0,0 @@
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?> |
||||
<!DOCTYPE tiles-definitions PUBLIC |
||||
"-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN" |
||||
"http://tiles.apache.org/dtds/tiles-config_2_1.dtd"> |
||||
<tiles-definitions> |
||||
|
||||
<definition name="messages/*" |
||||
template="layout"> |
||||
<put-attribute name="content" |
||||
value="content/messages/{1}"/> |
||||
<put-attribute name="title" |
||||
value="title/messages/{1}"/> |
||||
<put-attribute name="head" |
||||
value="head/messages/{1}"/> |
||||
</definition> |
||||
|
||||
<definition name="content/messages/*" |
||||
template="messages/{1} :: content"/> |
||||
<definition name="title/messages/*" |
||||
template="messages/{1} :: title"/> |
||||
<definition name="head/messages/*" |
||||
template="messages/{1} :: /html/head/link"/> |
||||
|
||||
<definition name="user/*" |
||||
template="layout"> |
||||
<put-attribute name="content" |
||||
value="content/user/{1}"/> |
||||
<put-attribute name="title" |
||||
value="title/user/{1}"/> |
||||
<put-attribute name="head" |
||||
value="head/user/{1}"/> |
||||
</definition> |
||||
|
||||
<definition name="content/user/*" |
||||
template="user/{1} :: content"/> |
||||
<definition name="title/user/*" |
||||
template="user/{1} :: title"/> |
||||
<definition name="head/user/*" |
||||
template="user/{1} :: /html/head/link"/> |
||||
|
||||
<definition name="*" |
||||
template="layout"> |
||||
<put-attribute name="content" |
||||
value="content/{1}"/> |
||||
<put-attribute name="title" |
||||
value="title/{1}"/> |
||||
<put-attribute name="head" |
||||
value="head/{1}"/> |
||||
</definition> |
||||
|
||||
<definition name="content/*" |
||||
template="{1} :: content"/> |
||||
<definition name="title/*" |
||||
template="{1} :: title"/> |
||||
<definition name="head/*" |
||||
template="{1} :: /html/head/link"/> |
||||
</tiles-definitions> |
||||
@ -1,27 +1,24 @@
@@ -1,27 +1,24 @@
|
||||
<html xmlns:th="http://www.thymeleaf.org" xmlns:tiles="http://www.thymeleaf.org"> |
||||
<head> |
||||
<title tiles:fragment="title">Messages : Create</title> |
||||
</head> |
||||
<body> |
||||
<div tiles:fragment="content"> |
||||
<form name="f" th:action="@{/j_security_check}" method="post"> |
||||
<fieldset> |
||||
<legend>Please Login</legend> |
||||
<div th:if="${param.error}" class="alert alert-error"> |
||||
Invalid username and password. |
||||
</div> |
||||
<div th:if="${param.logout}" class="alert alert-success"> |
||||
You have been logged out. |
||||
</div> |
||||
<label for="username">Username</label> |
||||
<input type="text" id="username" name="username"/> |
||||
<label for="password">Password</label> |
||||
<input type="password" id="password" name="password"/> |
||||
<div class="form-actions"> |
||||
<button type="submit" class="btn">Log in</button> |
||||
</div> |
||||
</fieldset> |
||||
</form> |
||||
</div> |
||||
</body> |
||||
<html xmlns:th="http://www.thymeleaf.org"> |
||||
<head th:include="layout :: head(title=~{::title},links=~{})"> |
||||
<title>Please Login</title> |
||||
</head> |
||||
<body th:include="layout :: body" th:with="content=~{::content}"> |
||||
<div th:fragment="content"> |
||||
<form name="f" th:action="@{/j_security_check}" method="post"> |
||||
<fieldset> |
||||
<legend>Please Login</legend> |
||||
<div th:if="${param.error}" class="alert alert-error">Invalid |
||||
username and password.</div> |
||||
<div th:if="${param.logout}" class="alert alert-success">You |
||||
have been logged out.</div> |
||||
<label for="username">Username</label> <input type="text" |
||||
id="username" name="username" /> <label for="password">Password</label> |
||||
<input type="password" id="password" name="password" /> |
||||
<div class="form-actions"> |
||||
<button type="submit" class="btn">Log in</button> |
||||
</div> |
||||
</fieldset> |
||||
</form> |
||||
</div> |
||||
</body> |
||||
</html> |
||||
@ -1,29 +1,26 @@
@@ -1,29 +1,26 @@
|
||||
<html xmlns:th="http://www.thymeleaf.org" xmlns:tiles="http://www.thymeleaf.org"> |
||||
<head> |
||||
<title tiles:fragment="title">Messages : Create</title> |
||||
</head> |
||||
<body> |
||||
<div tiles:fragment="content"> |
||||
<form name="f" th:action="@{/login}" method="post"> |
||||
<fieldset> |
||||
<legend>Please Login</legend> |
||||
<div th:if="${param.error}" class="alert alert-error"> |
||||
Invalid username and password. |
||||
</div> |
||||
<div th:if="${param.logout}" class="alert alert-success"> |
||||
You have been logged out. |
||||
</div> |
||||
<label for="username">Username</label> |
||||
<input type="text" id="username" name="username"/> |
||||
<label for="password">Password</label> |
||||
<input type="password" id="password" name="password"/> |
||||
<label for="remember-me">Remember Me?</label> |
||||
<input type="checkbox" id="remember-me" name="remember-me"/> |
||||
<div class="form-actions"> |
||||
<button type="submit" class="btn">Log in</button> |
||||
</div> |
||||
</fieldset> |
||||
</form> |
||||
</div> |
||||
</body> |
||||
<html xmlns:th="http://www.thymeleaf.org"> |
||||
<head th:include="layout :: head(title=~{::title},links=~{})"> |
||||
<title>Please Login</title> |
||||
</head> |
||||
<body th:include="layout :: body" th:with="content=~{::content}"> |
||||
<div th:fragment="content"> |
||||
<form name="f" th:action="@{/login}" method="post"> |
||||
<fieldset> |
||||
<legend>Please Login</legend> |
||||
<div th:if="${param.error}" class="alert alert-error">Invalid |
||||
username and password.</div> |
||||
<div th:if="${param.logout}" class="alert alert-success">You |
||||
have been logged out.</div> |
||||
<label for="username">Username</label> <input type="text" |
||||
id="username" name="username" /> <label for="password">Password</label> |
||||
<input type="password" id="password" name="password" /> <label |
||||
for="remember-me">Remember Me?</label> <input type="checkbox" |
||||
id="remember-me" name="remember-me" /> |
||||
<div class="form-actions"> |
||||
<button type="submit" class="btn">Log in</button> |
||||
</div> |
||||
</fieldset> |
||||
</form> |
||||
</div> |
||||
</body> |
||||
</html> |
||||
Loading…
Reference in new issue