Skip to content
Snippets Groups Projects
Commit d69b8969 authored by Antoine Rey's avatar Antoine Rey
Browse files

Fix #171 Jetty 9 support by removing Dandelion

parent f78ee5d7
No related branches found
No related tags found
No related merge requests found
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
<webjars-bootstrap.version>3.3.6</webjars-bootstrap.version> <webjars-bootstrap.version>3.3.6</webjars-bootstrap.version>
<webjars-jquery-ui.version>1.11.4</webjars-jquery-ui.version> <webjars-jquery-ui.version>1.11.4</webjars-jquery-ui.version>
<webjars-jquery.version>2.2.4</webjars-jquery.version> <webjars-jquery.version>2.2.4</webjars-jquery.version>
<dandelion.version>1.1.1</dandelion.version>
<dandelion.datatables.version>1.1.0</dandelion.datatables.version>
<cobertura.version>2.7</cobertura.version> <cobertura.version>2.7</cobertura.version>
...@@ -54,6 +52,13 @@ ...@@ -54,6 +52,13 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<!-- Uncomment bellow lines in order to deploy the Springboot Petlinic WAR file into an external Jetty -->
<!--exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions-->
</dependency> </dependency>
<dependency> <dependency>
...@@ -90,23 +95,6 @@ ...@@ -90,23 +95,6 @@
<artifactId>ehcache</artifactId> <artifactId>ehcache</artifactId>
</dependency> </dependency>
<!-- Dandelion -->
<dependency>
<groupId>com.github.dandelion</groupId>
<artifactId>dandelion-jsp</artifactId>
<version>${dandelion.version}</version>
</dependency>
<dependency>
<groupId>com.github.dandelion</groupId>
<artifactId>datatables-jsp</artifactId>
<version>${dandelion.datatables.version}</version>
</dependency>
<dependency>
<groupId>com.github.dandelion</groupId>
<artifactId>datatables-export-itext</artifactId>
<version>${dandelion.datatables.version}</version>
</dependency>
<!-- webjars --> <!-- webjars -->
<dependency> <dependency>
<groupId>org.webjars</groupId> <groupId>org.webjars</groupId>
......
...@@ -73,10 +73,6 @@ File -> Import -> Maven -> Existing Maven project ...@@ -73,10 +73,6 @@ File -> Import -> Maven -> Existing Maven project
<td>Caching</td> <td>Caching</td>
<td>Use of EhCache <a href="/src/main/java/org/springframework/samples/petclinic/config/CacheConfig.java">CacheConfig.java</a> <a href="/src/main/resources/ehcache.xml">ehcache.xml</a></td> <td>Use of EhCache <a href="/src/main/java/org/springframework/samples/petclinic/config/CacheConfig.java">CacheConfig.java</a> <a href="/src/main/resources/ehcache.xml">ehcache.xml</a></td>
</tr> </tr>
<tr>
<td>Dandelion</td>
<td>DatatablesFilter, DandelionFilter and DandelionServlet registration <a href="/src/main/java/org/springframework/samples/petclinic/config/DandelionConfig.java">DandelionConfig.java</a></td>
</tr>
<tr> <tr>
<td>Spring MVC - XML integration</td> <td>Spring MVC - XML integration</td>
<td><a href="/src/main/java/org/springframework/samples/petclinic/config/CustomViewsConfiguration.java">CustomViewsConfiguration.java</a></td> <td><a href="/src/main/java/org/springframework/samples/petclinic/config/CustomViewsConfiguration.java">CustomViewsConfiguration.java</a></td>
...@@ -104,15 +100,6 @@ File -> Import -> Maven -> Existing Maven project ...@@ -104,15 +100,6 @@ File -> Import -> Maven -> Existing Maven project
<a href="/src/main/webapp/WEB-INF/jsp/fragments/staticFiles.jsp#L12">sample usage in JSP</a></td> <a href="/src/main/webapp/WEB-INF/jsp/fragments/staticFiles.jsp#L12">sample usage in JSP</a></td>
</td> </td>
</tr> </tr>
<tr>
<td>Dandelion-datatables</td>
<td>
<a href="/src/main/webapp/WEB-INF/jsp/owners/ownersList.jsp">ownersList.jsp</a>
<a href="/src/main/webapp/WEB-INF/jsp/vets/vetList.jsp">vetList.jsp</a>
<a href="/src/main/webapp/WEB-INF/web.xml">web.xml</a>
<a href="/src/main/resources/dandelion/datatables/datatables.properties">datatables.properties</a>
</td>
</tr>
</table> </table>
......
/*
* Copyright 2002-2016 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.samples.petclinic.config;
import com.github.dandelion.core.web.DandelionFilter;
import com.github.dandelion.core.web.DandelionServlet;
import com.github.dandelion.datatables.core.web.filter.DatatablesFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Description;
import org.springframework.core.env.Environment;
import javax.annotation.PostConstruct;
/**
* Java configuration for the Dandelion datatables component.
*
* @author Antoine Rey
*/
@Configuration
public class DandelionConfig {
@Autowired
private Environment environment;
@PostConstruct
public void init() {
if (environment.acceptsProfiles("production")) {
System.setProperty("dandelion.profile.active", "prod");
}
}
@Bean
@Description("Dandelion filter definition and mapping")
public FilterRegistrationBean filterRegistrationBean() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
filterRegistrationBean.setFilter(new DandelionFilter());
return filterRegistrationBean;
}
@Bean
@Description("Dandelion-Datatables filter, used for basic export")
public FilterRegistrationBean datatablesRegistrationBean() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
filterRegistrationBean.setFilter(new DatatablesFilter());
return filterRegistrationBean;
}
@Bean
public ServletRegistrationBean servletRegistrationBean() {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean();
servletRegistrationBean.setServlet(new DandelionServlet());
servletRegistrationBean.addUrlMappings("/dandelion-assets/*");
servletRegistrationBean.setName("dandelionServlet");
return servletRegistrationBean;
}
}
# ==================================
# Dandelion-Datatables configuration
# ==================================
# Disable the asset management of Dandelion-Core for all non-DataTable-related assets
main.standalone=true
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<!-- Fix Jetty 9 issue -->
<!-- http://stackoverflow.com/questions/32643530/classpath-issue-between-jetty-maven-plugin-and-tomcat-jdbc-8-0-9-leading-to-ser -->
<Set name="parentLoaderPriority">true</Set>
</Configure>
...@@ -3,31 +3,46 @@ ...@@ -3,31 +3,46 @@
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="datatables" uri="http://github.com/dandelion/datatables" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="owners"> <petclinic:layout pageName="owners">
<h2>Owners</h2> <h2>Owners</h2>
<datatables:table id="owners" data="${selections}" row="owner" <table id="vets" class="table table-striped">
cssClass="table table-striped" pageable="false" info="false" export="pdf"> <thead>
<datatables:column title="Name" cssStyle="width: 150px;" display="html"> <tr>
<spring:url value="/owners/{ownerId}.html" var="ownerUrl"> <th style="width: 150px;">Name</th>
<spring:param name="ownerId" value="${owner.id}"/> <th style="width: 200px;">Address</th>
</spring:url> <th>City</th>
<a href="${fn:escapeXml(ownerUrl)}"><c:out value="${owner.firstName} ${owner.lastName}"/></a> <th style="width: 120px">Telephone</th>
</datatables:column> <th>Pets</th>
<datatables:column title="Name" display="pdf"> </tr>
<c:out value="${owner.firstName} ${owner.lastName}"/> </thead>
</datatables:column> <tbody>
<datatables:column title="Address" property="address" cssStyle="width: 200px;"/> <c:forEach items="${selections}" var="owner">
<datatables:column title="City" property="city"/> <tr>
<datatables:column title="Telephone" property="telephone"/> <td>
<datatables:column title="Pets" cssStyle="width: 100px;"> <spring:url value="/owners/{ownerId}.html" var="ownerUrl">
<c:forEach var="pet" items="${owner.pets}"> <spring:param name="ownerId" value="${owner.id}"/>
<c:out value="${pet.name}"/> </spring:url>
</c:forEach> <a href="${fn:escapeXml(ownerUrl)}"><c:out value="${owner.firstName} ${owner.lastName}"/></a>
</datatables:column> </td>
<datatables:export type="pdf" cssClass="btn" cssStyle="height: 25px;"/> <td>
</datatables:table> <c:out value="${owner.address}"/>
</td>
<td>
<c:out value="${owner.city}"/>
</td>
<td>
<c:out value="${owner.telephone}"/>
</td>
<td>
<c:forEach var="pet" items="${owner.pets}">
<c:out value="${pet.name} "/>
</c:forEach>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</petclinic:layout> </petclinic:layout>
...@@ -2,24 +2,34 @@ ...@@ -2,24 +2,34 @@
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="datatables" uri="http://github.com/dandelion/datatables" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="vets"> <petclinic:layout pageName="vets">
<h2>Veterinarians</h2> <h2>Veterinarians</h2>
<datatables:table id="vets" data="${vets.vetList}" row="vet" cssClass="table table-striped" <table id="vets" class="table table-striped">
pageable="false" info="false"> <thead>
<datatables:column title="Name"> <tr>
<c:out value="${vet.firstName} ${vet.lastName}"/> <th>Name</th>
</datatables:column> <th>Specialties</th>
<datatables:column title="Specialties"> </tr>
<c:forEach var="specialty" items="${vet.specialties}"> </thead>
<c:out value="${specialty.name}"/> <tbody>
</c:forEach> <c:forEach items="${vets.vetList}" var="vet">
<c:if test="${vet.nrOfSpecialties == 0}">none</c:if> <tr>
</datatables:column> <td>
</datatables:table> <c:out value="${vet.firstName} ${vet.lastName}"/>
</td>
<td>
<c:forEach var="specialty" items="${vet.specialties}">
<c:out value="${specialty.name} "/>
</c:forEach>
<c:if test="${vet.nrOfSpecialties == 0}">none</c:if>
</td>
</tr>
</c:forEach>
</tbody>
</table>
<table class="table-buttons"> <table class="table-buttons">
<tr> <tr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment