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"
|
||||
target-branch: "SERVLET60"
|
||||
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
|
||||
|
||||
* Uses Apache FOP for rendering
|
||||
https://xmlgraphics.apache.org/fop/
|
||||
<https://xmlgraphics.apache.org/fop/>
|
||||
* 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 Tomcat 10.1.x+ (Jakarta EE / Servlet 6.0) or Jetty 12
|
||||
|
||||
## Run tests
|
||||
|
||||
`mvn test`
|
||||
|
||||
## Build
|
||||
|
||||
`mvn package verify`
|
||||
|
||||
## Upgrade
|
||||
|
||||
* set new version in pom.xml
|
||||
* check dependent libraries for updates
|
||||
* run tests and build
|
||||
|
||||
## Release
|
||||
|
||||
* create a tag with version number
|
||||
* create a github release
|
||||
|
||||
## Installation
|
||||
|
||||
* rename target/fop4apex*.war to fop4apex.war
|
||||
* copy fop4apex.war to tomcat webapps folder
|
||||
* Oracle APEX - Sample Settings
|
||||
* PrintServer External (Apache FOP)
|
||||
* Protocol HTTP / HTTPS
|
||||
* Host 127.0.0.1
|
||||
* Port 8080
|
||||
* Protocol HTTP / HTTPS
|
||||
* Host 127.0.0.1
|
||||
* Port 8080
|
||||
* Script: /fop4apex/pdf
|
||||
* Timeout 300
|
||||
|
||||
### Debugging
|
||||
|
||||
Add to Tomcat logging.properties:
|
||||
```
|
||||
org.apache.tomcat.util.http.Parameters.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/
|
||||
|
||||
Example:
|
||||
* http://localhost:8080/fop4apex_war_exploded/
|
||||
* 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>
|
||||
<artifactId>fop4apex</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<version>2.0.1-SNAPSHOT</version>
|
||||
<name>fop4apex</name>
|
||||
<packaging>war</packaging>
|
||||
<url>https://www.pdv.de</url>
|
||||
@ -24,12 +24,28 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</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>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
@ -96,6 +112,16 @@
|
||||
<scope>compile</scope>
|
||||
</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>
|
||||
|
||||
<build>
|
||||
@ -143,6 +169,17 @@
|
||||
<outputName>bom</outputName>
|
||||
</configuration>
|
||||
</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 -->
|
||||
<plugin>
|
||||
@ -209,6 +246,7 @@
|
||||
<artifactId>dependency-check-maven</artifactId>
|
||||
<version>10.0.3</version>
|
||||
<configuration>
|
||||
<nvdApiServerId>nvd</nvdApiServerId>
|
||||
<formats>
|
||||
<format>html</format>
|
||||
<format>json</format>
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
|
||||
version="4.0">
|
||||
<web-app
|
||||
xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
|
||||
version="6.0">
|
||||
|
||||
<filter>
|
||||
<filter-name>javamelody</filter-name>
|
||||
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
|
||||
@ -22,4 +24,4 @@
|
||||
<listener-class>net.bull.javamelody.SessionListener</listener-class>
|
||||
</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>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<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">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
@ -42,11 +48,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Port</th>
|
||||
<td>8080</td>
|
||||
<td><c:out value="${pageContext.request.serverPort}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Script</th>
|
||||
<td>${pageContext.request.contextPath}/pdf</td>
|
||||
<td><c:out value="${pageContext.request.contextPath}"/>/pdf</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Timeout</td>
|
||||
@ -61,24 +67,42 @@
|
||||
<pre>org.apache.tomcat.util.http.Parameters.level = ALL
|
||||
de.pdv.apex.level = ALL</pre>
|
||||
|
||||
<h2>Server Info / Environment</h2>
|
||||
<%--@elvariable id="System" type=""--%>
|
||||
<pre>
|
||||
Server Version: <%= application.getServerInfo() %>
|
||||
Servlet Version: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %>
|
||||
JSP Version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %>
|
||||
Context Path: ${pageContext.request.contextPath}
|
||||
<%
|
||||
Map<String,String> systemProperties = new LinkedHashMap<>();
|
||||
systemProperties.put("Server Version",application.getServerInfo());
|
||||
systemProperties.put("Servlet Version",String.format("%d.%d",application.getMajorVersion(),application.getMinorVersion()));
|
||||
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")}
|
||||
java.vm.vendor: ${System.getProperty("java.vm.vendor")}
|
||||
user.country: ${System.getProperty("user.country")}
|
||||
user.language: ${System.getProperty("user.language")}
|
||||
user.name: ${System.getProperty("user.name")}
|
||||
user.timezone: ${System.getProperty("user.timezone")}
|
||||
os.name: ${System.getProperty("os.name")}
|
||||
os.version: ${System.getProperty("os.version")}
|
||||
file.encoding: ${System.getProperty("file.encoding")}
|
||||
sun.jnu.encoding: ${System.getProperty("sun.jnu.encoding")}</pre>
|
||||
<h2>Server Info / Environment</h2>
|
||||
<table role="grid">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Parameter</th>
|
||||
<th scope="col">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<c:forEach var="property" items="${systemProperties}">
|
||||
<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>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
@ -109,8 +109,7 @@ class ExampleFO2PDFTest {
|
||||
|
||||
app.convertFO2PDFHelper(inputStream, pdfFile);
|
||||
|
||||
if (!pdfFile.exists())
|
||||
throw new Exception("result file missing");
|
||||
Assertions.assertTrue(pdfFile.exists(), "Error: result file missing");
|
||||
|
||||
try (PDDocument document = Loader.loadPDF(new RandomAccessReadBufferedFile(pdfFile)))
|
||||
{
|
||||
|
||||
@ -84,8 +84,7 @@ class ExampleXML2PDFTest {
|
||||
//close
|
||||
out.close();
|
||||
|
||||
if (!pdfFile.exists())
|
||||
throw new Exception("result file missing");
|
||||
Assertions.assertTrue(pdfFile.exists(), "Error: result file missing");
|
||||
try (PDDocument document = Loader.loadPDF(new RandomAccessReadBufferedFile(pdfFile))) {
|
||||
System.out.println("Pages: " + document.getNumberOfPages());
|
||||
System.out.println("Filesize (Bytes): " + Files.size(pdfFile.toPath()));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user