Merge branch 'main' into SERVLET60
# Conflicts: # .github/dependabot.yml # README.md # pom.xml
This commit is contained in:
commit
7cfcfb374f
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
@ -11,4 +11,4 @@ updates:
|
|||||||
interval: "daily"
|
interval: "daily"
|
||||||
target-branch: "SERVLET60"
|
target-branch: "SERVLET60"
|
||||||
labels:
|
labels:
|
||||||
- "servlet60"
|
- "servlet60"
|
||||||
|
|||||||
31
README.md
31
README.md
@ -5,47 +5,66 @@ Servlet for Oracle APEX to run PDF Reports based on Apache FOP
|
|||||||
Fahrdienst-Anwendung / Kostenblatt
|
Fahrdienst-Anwendung / Kostenblatt
|
||||||
|
|
||||||
* Uses Apache FOP for rendering
|
* Uses Apache FOP for rendering
|
||||||
https://xmlgraphics.apache.org/fop/
|
<https://xmlgraphics.apache.org/fop/>
|
||||||
* Uses JavaMelody for monitoring
|
* Uses JavaMelody for monitoring
|
||||||
https://github.com/javamelody/javamelody/wiki
|
<https://github.com/javamelody/javamelody/wiki>
|
||||||
* Use Java 17 LTS (also tested with Java 21 LTS)
|
* Use Java 17 LTS (also tested with Java 21 LTS)
|
||||||
* Use Tomcat 10.1.x+ (Jakarta EE / Servlet 6.0) or Jetty 12
|
* Use Tomcat 10.1.x+ (Jakarta EE / Servlet 6.0) or Jetty 12
|
||||||
|
|
||||||
## Run tests
|
## Run tests
|
||||||
|
|
||||||
`mvn test`
|
`mvn test`
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
`mvn package verify`
|
`mvn package verify`
|
||||||
|
|
||||||
## Upgrade
|
## Upgrade
|
||||||
|
|
||||||
* set new version in pom.xml
|
* set new version in pom.xml
|
||||||
* check dependent libraries for updates
|
* check dependent libraries for updates
|
||||||
* run tests and build
|
* run tests and build
|
||||||
|
|
||||||
## Release
|
## Release
|
||||||
|
|
||||||
* create a tag with version number
|
* create a tag with version number
|
||||||
* create a github release
|
* create a github release
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
* rename target/fop4apex*.war to fop4apex.war
|
* rename target/fop4apex*.war to fop4apex.war
|
||||||
* copy fop4apex.war to tomcat webapps folder
|
* copy fop4apex.war to tomcat webapps folder
|
||||||
* Oracle APEX - Sample Settings
|
* Oracle APEX - Sample Settings
|
||||||
* PrintServer External (Apache FOP)
|
* PrintServer External (Apache FOP)
|
||||||
* Protocol HTTP / HTTPS
|
* Protocol HTTP / HTTPS
|
||||||
* Host 127.0.0.1
|
* Host 127.0.0.1
|
||||||
* Port 8080
|
* Port 8080
|
||||||
* Script: /fop4apex/pdf
|
* Script: /fop4apex/pdf
|
||||||
* Timeout 300
|
* Timeout 300
|
||||||
|
|
||||||
### Debugging
|
### Debugging
|
||||||
|
|
||||||
Add to Tomcat logging.properties:
|
Add to Tomcat logging.properties:
|
||||||
```
|
```
|
||||||
org.apache.tomcat.util.http.Parameters.level = ALL
|
org.apache.tomcat.util.http.Parameters.level = ALL
|
||||||
de.pdv.apex.level = ALL
|
de.pdv.apex.level = ALL
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploy to tomcat 10.1.x+ or Jetty 12 (IntelliJ / Netbeans)
|
### Deploy to tomcat 9.x (IntelliJ / Netbeans) / Jetty 10.x
|
||||||
|
|
||||||
Run http://localhost:port/
|
Run http://localhost:port/
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
* http://localhost:8080/fop4apex_war_exploded/
|
* http://localhost:8080/fop4apex_war_exploded/
|
||||||
* http://localhost:8080/fop4apex_war_exploded/monitoring
|
* http://localhost:8080/fop4apex_war_exploded/monitoring
|
||||||
|
|
||||||
|
## Conversion using Apache fop (windows powershell)
|
||||||
|
|
||||||
|
```
|
||||||
|
$env:PATH="c:\Users\oliver1\Downloads\_tools\fop-2.9\fop;$env:PATH"
|
||||||
|
cd src\test\ressources\samples
|
||||||
|
fop.cmd -xsl kostenblatt_2014.xsl -xml kostenblatt_2014.xml -pdf Result2014.pdf
|
||||||
|
fop.cmd -xsl kostenblatt_2023_vh.xsl -xml kostenblatt_2023_vh.xml -pdf Result2023_vh.pdf
|
||||||
|
fop.cmd -xsl kostenblatt_2023_e.xsl -xml kostenblatt_2023_e.xml -pdf Result2023_e.pdf
|
||||||
|
start Result.pdf
|
||||||
|
```
|
||||||
40
pom.xml
40
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>de.pdv.apex</groupId>
|
<groupId>de.pdv.apex</groupId>
|
||||||
<artifactId>fop4apex</artifactId>
|
<artifactId>fop4apex</artifactId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.1-SNAPSHOT</version>
|
||||||
<name>fop4apex</name>
|
<name>fop4apex</name>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<url>https://www.pdv.de</url>
|
<url>https://www.pdv.de</url>
|
||||||
@ -24,12 +24,28 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jakarta.servlet</groupId>
|
<groupId>jakarta.servlet</groupId>
|
||||||
<artifactId>jakarta.servlet-api</artifactId>
|
<artifactId>jakarta.servlet-api</artifactId>
|
||||||
<version>6.1.0</version>
|
<version>6.1.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/jakarta.servlet.jsp.jstl/jakarta.servlet.jsp.jstl-api -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.servlet.jsp.jstl</groupId>
|
||||||
|
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.glassfish.web/jakarta.servlet.jsp.jstl -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.web</groupId>
|
||||||
|
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
@ -96,6 +112,16 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.github.librepdf/openpdf -->
|
||||||
|
<!-- updates to 1.4 and 2.x currently not possible https://github.com/javamelody/javamelody/pull/1182 -->
|
||||||
|
<!-- Optional: support pdf export for javamelody
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.librepdf</groupId>
|
||||||
|
<artifactId>openpdf</artifactId>
|
||||||
|
<version>1.3.43</version>
|
||||||
|
</dependency>
|
||||||
|
-->
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -143,6 +169,17 @@
|
|||||||
<outputName>bom</outputName>
|
<outputName>bom</outputName>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<!-- Avoid plugin validation warnings -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.13.0</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>3.3.1</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.cloud.tools/jib-maven-plugin -->
|
<!-- https://mvnrepository.com/artifact/com.google.cloud.tools/jib-maven-plugin -->
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -209,6 +246,7 @@
|
|||||||
<artifactId>dependency-check-maven</artifactId>
|
<artifactId>dependency-check-maven</artifactId>
|
||||||
<version>10.0.3</version>
|
<version>10.0.3</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<nvdApiServerId>nvd</nvdApiServerId>
|
||||||
<formats>
|
<formats>
|
||||||
<format>html</format>
|
<format>html</format>
|
||||||
<format>json</format>
|
<format>json</format>
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
<web-app
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
version="4.0">
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
|
||||||
|
version="6.0">
|
||||||
|
|
||||||
<filter>
|
<filter>
|
||||||
<filter-name>javamelody</filter-name>
|
<filter-name>javamelody</filter-name>
|
||||||
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
|
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
|
||||||
@ -22,4 +24,4 @@
|
|||||||
<listener-class>net.bull.javamelody.SessionListener</listener-class>
|
<listener-class>net.bull.javamelody.SessionListener</listener-class>
|
||||||
</listener>
|
</listener>
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
|||||||
@ -1,10 +1,16 @@
|
|||||||
|
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
||||||
|
<%@ page import="java.util.Map" %>
|
||||||
|
<%@ page import="java.util.LinkedHashMap" %>
|
||||||
|
<%@ taglib prefix="c" uri="jakarta.tags.core" %>
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en" data-theme="dark">
|
<html lang="en" data-theme="dark">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
<meta name="description" content="Apache Formatting Objects Processor integration for Oracle Application Express, converts xml and fop to pdf">
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link rel="stylesheet" href="webjars/pico/css/pico.min.css">
|
<meta name="description" content="Apache Formatting Objects Processor integration for Oracle Application Express, converts xml and fop to pdf" />
|
||||||
|
<link rel="stylesheet" href="webjars/pico/css/pico.min.css" />
|
||||||
<title>Apache FOP for Oracle APEX</title>
|
<title>Apache FOP for Oracle APEX</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -42,11 +48,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Port</th>
|
<th scope="row">Port</th>
|
||||||
<td>8080</td>
|
<td><c:out value="${pageContext.request.serverPort}"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Script</th>
|
<th scope="row">Script</th>
|
||||||
<td>${pageContext.request.contextPath}/pdf</td>
|
<td><c:out value="${pageContext.request.contextPath}"/>/pdf</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Timeout</td>
|
<td>Timeout</td>
|
||||||
@ -61,24 +67,42 @@
|
|||||||
<pre>org.apache.tomcat.util.http.Parameters.level = ALL
|
<pre>org.apache.tomcat.util.http.Parameters.level = ALL
|
||||||
de.pdv.apex.level = ALL</pre>
|
de.pdv.apex.level = ALL</pre>
|
||||||
|
|
||||||
<h2>Server Info / Environment</h2>
|
|
||||||
<%--@elvariable id="System" type=""--%>
|
<%--@elvariable id="System" type=""--%>
|
||||||
<pre>
|
<%
|
||||||
Server Version: <%= application.getServerInfo() %>
|
Map<String,String> systemProperties = new LinkedHashMap<>();
|
||||||
Servlet Version: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %>
|
systemProperties.put("Server Version",application.getServerInfo());
|
||||||
JSP Version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %>
|
systemProperties.put("Servlet Version",String.format("%d.%d",application.getMajorVersion(),application.getMinorVersion()));
|
||||||
Context Path: ${pageContext.request.contextPath}
|
systemProperties.put("JSP Version",JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion());
|
||||||
|
systemProperties.put("Context Path", request.getContextPath() );
|
||||||
|
systemProperties.put("","");
|
||||||
|
systemProperties.put("java.version",System.getProperty("java.version"));
|
||||||
|
systemProperties.put("java.vm.vendor",System.getProperty("java.vm.vendor"));
|
||||||
|
systemProperties.put("user.country",System.getProperty("user.country"));
|
||||||
|
systemProperties.put("user.language",System.getProperty("user.language"));
|
||||||
|
systemProperties.put("user.name",System.getProperty("user.name"));
|
||||||
|
systemProperties.put("user.timezone",System.getProperty("user.timezone"));
|
||||||
|
systemProperties.put("os.name",System.getProperty("os.name"));
|
||||||
|
systemProperties.put("os.version",System.getProperty("os.version"));
|
||||||
|
systemProperties.put("file.encoding",System.getProperty("file.encoding"));
|
||||||
|
systemProperties.put("sun.jnu.encoding",System.getProperty("sun.jnu.encoding"));
|
||||||
|
request.setAttribute("systemProperties",systemProperties);
|
||||||
|
%>
|
||||||
|
|
||||||
java.version: ${System.getProperty("java.version")}
|
<h2>Server Info / Environment</h2>
|
||||||
java.vm.vendor: ${System.getProperty("java.vm.vendor")}
|
<table role="grid">
|
||||||
user.country: ${System.getProperty("user.country")}
|
<thead>
|
||||||
user.language: ${System.getProperty("user.language")}
|
<tr>
|
||||||
user.name: ${System.getProperty("user.name")}
|
<th scope="col">Parameter</th>
|
||||||
user.timezone: ${System.getProperty("user.timezone")}
|
<th scope="col">Value</th>
|
||||||
os.name: ${System.getProperty("os.name")}
|
</tr>
|
||||||
os.version: ${System.getProperty("os.version")}
|
</thead>
|
||||||
file.encoding: ${System.getProperty("file.encoding")}
|
<c:forEach var="property" items="${systemProperties}">
|
||||||
sun.jnu.encoding: ${System.getProperty("sun.jnu.encoding")}</pre>
|
<tr>
|
||||||
|
<th scope="row"><c:out value="${property.key}"/></th>
|
||||||
|
<td><c:out value="${property.value}"/></td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</table>
|
||||||
<p>page built with <a href="https://picocss.com/">Pico.css</a>, fop conversion with <a href="https://xmlgraphics.apache.org/fop/">Apache FOP</a> </p>
|
<p>page built with <a href="https://picocss.com/">Pico.css</a>, fop conversion with <a href="https://xmlgraphics.apache.org/fop/">Apache FOP</a> </p>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -109,8 +109,7 @@ class ExampleFO2PDFTest {
|
|||||||
|
|
||||||
app.convertFO2PDFHelper(inputStream, pdfFile);
|
app.convertFO2PDFHelper(inputStream, pdfFile);
|
||||||
|
|
||||||
if (!pdfFile.exists())
|
Assertions.assertTrue(pdfFile.exists(), "Error: result file missing");
|
||||||
throw new Exception("result file missing");
|
|
||||||
|
|
||||||
try (PDDocument document = Loader.loadPDF(new RandomAccessReadBufferedFile(pdfFile)))
|
try (PDDocument document = Loader.loadPDF(new RandomAccessReadBufferedFile(pdfFile)))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -84,8 +84,7 @@ class ExampleXML2PDFTest {
|
|||||||
//close
|
//close
|
||||||
out.close();
|
out.close();
|
||||||
|
|
||||||
if (!pdfFile.exists())
|
Assertions.assertTrue(pdfFile.exists(), "Error: result file missing");
|
||||||
throw new Exception("result file missing");
|
|
||||||
try (PDDocument document = Loader.loadPDF(new RandomAccessReadBufferedFile(pdfFile))) {
|
try (PDDocument document = Loader.loadPDF(new RandomAccessReadBufferedFile(pdfFile))) {
|
||||||
System.out.println("Pages: " + document.getNumberOfPages());
|
System.out.println("Pages: " + document.getNumberOfPages());
|
||||||
System.out.println("Filesize (Bytes): " + Files.size(pdfFile.toPath()));
|
System.out.println("Filesize (Bytes): " + Files.size(pdfFile.toPath()));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user