Refactor all Spring Session, Apache Geode Samples using Spring Boot to switch from Thymeleaf to FreeMarker.

Convert Thymelead templates to FreeMarker templates.

Remove the use of WebJars.

Refactor all Sample application code.
This commit is contained in:
John Blum
2021-12-02 23:33:57 -08:00
parent 0040b9a37e
commit 39ff983567
11 changed files with 45 additions and 43 deletions

View File

@@ -6,7 +6,7 @@ dependencies {
implementation project(':spring-session-data-geode')
implementation("org.springframework.boot:spring-boot-starter-thymeleaf") {
implementation("org.springframework.boot:spring-boot-starter-freemarker") {
exclude group: "org.apache.logging.log4j", module: "log4j-to-slf4j"
}
@@ -16,8 +16,6 @@ dependencies {
implementation "jakarta.servlet:jakarta.servlet-api"
implementation "org.springframework.data:spring-data-geode-test"
implementation "org.webjars:bootstrap"
implementation "org.webjars:webjars-locator"
runtimeOnly "org.springframework.shell:spring-shell"

View File

@@ -102,6 +102,7 @@ public class Application {
// end::class[]
@SuppressWarnings("all")
HttpSession updateRequestCount(HttpSession session) {
synchronized (session) {

View File

@@ -1,5 +1,4 @@
<!DOCTYPE html SYSTEM "https://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-3.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Session Attributes</title>
<style type="text/css">
@@ -19,7 +18,7 @@
<h1>Try it</h1>
<form class="form-inline" role="form" action="./session" method="post">
<form role="form" action="./session" method="post">
<label for="attributeName">Attribute Name</label>
<input id="attributeName" type="text" name="attributeName"/>
<label for="attributeValue">Attribute Value</label>
@@ -29,7 +28,7 @@
<hr/>
<table class="table table-striped">
<table>
<thead>
<tr>
<th>Attribute Name</th>
@@ -37,10 +36,15 @@
</tr>
</thead>
<tbody>
<tr th:each="attribute: ${sessionAttributes}">
<td th:text="${attribute.key}">name</td>
<td th:text="${attribute.value}">value</td>
<#attempt>
<#list sessionAttributes as attributeName, attributeValue>
<tr>
<td>${attributeName}</td>
<td>${attributeValue}</td>
</tr>
</#list>
<#recover>
</#attempt>
</tbody>
</table>
</div>