Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 38 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<log4j-version>2.24.3</log4j-version>
<spring-version>5.3.39</spring-version>
<spring-version>6.1.11</spring-version>
<gt-version>31.6</gt-version>
<pdfbox-version>2.0.33</pdfbox-version>
<metrics-version>4.2.30</metrics-version>
<metrics-version>4.2.26</metrics-version>
<jackson2.version>2.18.2</jackson2.version>
</properties>

Expand Down Expand Up @@ -116,9 +116,14 @@
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>javax.media</groupId>
Expand Down Expand Up @@ -192,7 +197,7 @@
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-servlet</artifactId>
<artifactId>metrics-jakarta-servlet</artifactId>
<version>${metrics-version}</version>
</dependency>
<dependency>
Expand All @@ -202,7 +207,7 @@
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-servlets</artifactId>
<artifactId>metrics-jakarta-servlets</artifactId>
<version>${metrics-version}</version>
</dependency>
<dependency>
Expand Down Expand Up @@ -245,10 +250,21 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.servlet</groupId>
<artifactId>servlet</artifactId>
<classifier>jakarta</classifier>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
Expand Down Expand Up @@ -339,7 +355,7 @@
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-servlet</artifactId>
<artifactId>metrics-jakarta-servlet</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -349,7 +365,7 @@
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-servlets</artifactId>
<artifactId>metrics-jakarta-servlets</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -379,14 +395,23 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>11</source> <!-- The -source argument for the Java compiler. -->
<target>11</target> <!-- The -target argument for the Java compiler. -->
<source>17</source> <!-- The -source argument for the Java compiler. -->
<target>17</target> <!-- The -target argument for the Java compiler. -->
<debug>true</debug> <!-- Whether to include debugging information. -->
<encoding>UTF-8</encoding> <!-- The -encoding argument for the Java compiler. -->
<fork>${fork.javac}</fork>
<maxmem>${javac.maxHeapSize}</maxmem>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
</plugins>

</build>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/mapfish/print/MapPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import java.util.Map;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import javax.annotation.PreDestroy;
import jakarta.annotation.PreDestroy;

/**
* The main class for printing maps. Will parse the spec, create the PDF
Expand Down Expand Up @@ -89,7 +89,7 @@ public class MapPrinter {
private MetricRegistry metricRegistry;

private volatile boolean fontsInitialized = false;

private int usages = 0;

static {
Expand Down Expand Up @@ -214,7 +214,7 @@ public synchronized void stop() {
config = null;
}
}

public synchronized void start() {
usages++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/mapfish/print/ShellMapPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void run() throws IOException, JSONException, DocumentException, Interrup
}
} finally {
if(outFile != null) outFile.close();
if(context != null) context.destroy();
if(context != null) context.close();
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/mapfish/print/ThreadResources.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.mapfish.print.map.MapTileTask;
import org.pvalsecc.concurrent.OrderedResultsExecutor;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;

/**
* Encapsulates resources that start and stop threads and need to be disposed and controlled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
package org.mapfish.print.metrics;

import com.codahale.metrics.health.HealthCheckRegistry;
import com.codahale.metrics.servlets.HealthCheckServlet;

import io.dropwizard.metrics.servlets.HealthCheckServlet;

import org.springframework.web.context.WebApplicationContext;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletContextEvent;

import static org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import com.codahale.metrics.MetricRegistry;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;

/**
* This bean will enable JMX reporting when added to application context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.codahale.metrics.jvm.ThreadStatesGaugeSet;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;

/**
* A bean that will add several gauges and metric sets for tracking the JVM stats.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.apache.logging.log4j.core.config.Configuration;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;

/**
* Utility class for adding metrics instrumentation to logging framework.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
package org.mapfish.print.metrics;

import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.servlet.InstrumentedFilterContextListener;

import io.dropwizard.metrics.servlet.InstrumentedFilterContextListener;
import org.springframework.web.context.WebApplicationContext;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletContextEvent;

import static org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
package org.mapfish.print.metrics;

import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.servlets.MetricsServlet;

import io.dropwizard.metrics.servlets.MetricsServlet;
import org.springframework.web.context.WebApplicationContext;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletContextEvent;

import static org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/mapfish/print/output/OutputFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.apache.logging.log4j.LogManager;
import org.mapfish.print.config.Config;
import org.mapfish.print.utils.PJsonObject;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.beans.factory.annotation.Autowired;

/**
* User: jeichar
Expand All @@ -45,7 +45,7 @@ public class OutputFactory {
*
* @param formatFactories
*/
@Required
@Autowired
public void setFormatFactories(List<OutputFormatFactory> formatFactories) {
this.formatFactories = formatFactories;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/mapfish/print/servlet/BaseMapServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;

/**
* Base class for MapPrinter servlets (deals with the configuration loading)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -72,7 +72,7 @@ public class MapPrinterServlet extends BaseMapServlet {
protected static final String TEMP_FILE_PREFIX = "mapfish-print";
protected static final String TEMP_FILE_METADATA_PREFIX = "mapfish-print-metadata";
private static final long serialVersionUID = -4706371598927161642L;
private static final String CONTEXT_TEMPDIR = "javax.servlet.context.tempdir";
private static final String CONTEXT_TEMPDIR = "jakarta.servlet.context.tempdir";
private static final String INFO_URL = "/info.json";
private static final String PRINT_URL = "/print.pdf";
private static final String CREATE_URL = "/create.json";
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/classes/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ log4j.appender.R.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %30.30c - %m%n

log4j.logger.org.mapfish=DEBUG
log4j.logger.org.pvalsecc=DEBUG
log4j.logger.org.springframework=INFO, R
log4j.logger.org.springframework=INFO, R
6 changes: 4 additions & 2 deletions src/main/webapp/WEB-INF/classes/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ appenders= R
appender.R.type = RollingFile
appender.R.name = File
appender.R.fileName = /tmp/logs/mapfish-print.log
appender.R.layout.type = PatternLayout
#appender.R.fileName=${sys:catalina.home}/logs/mapfish-print.log
appender.R.layout.type=PatternLayout
appender.R.layout.pattern = %d{ISO8601} [%t] %-5p %30.30c - %m%n
appender.R.filePattern = %d{ISO8601} [%t] %-5p %30.30c - %m%n
appender.R.policies.type = Policies
appender.R.policies.time.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 5

rootLogger.appenderRefs = R
rootLogger.appenderRefs = R
rootLogger.appenderRef.R.ref = File

logger.mapfish.name= org.mapfish
Expand Down
11 changes: 8 additions & 3 deletions src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<listener-class>org.mapfish.print.metrics.MapfishPrintInstrumentedFilterContextListener</listener-class>
</listener>

<!-- ImageIO service provider loader/unloader -->
<listener>
<listener-class>com.twelvemonkeys.servlet.image.IIOProviderContextListener</listener-class>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:mapfish-spring-application-context.xml,classpath:*-mapfish-spring-application-context-override.xml</param-value>
Expand All @@ -26,7 +31,7 @@

<filter>
<filter-name>instrumentedFilter</filter-name>
<filter-class>com.codahale.metrics.servlet.InstrumentedFilter</filter-class>
<filter-class>io.dropwizard.metrics.servlet.InstrumentedFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>instrumentedFilter</filter-name>
Expand All @@ -35,7 +40,7 @@

<servlet>
<servlet-name>metrics-servlet</servlet-name>
<servlet-class>com.codahale.metrics.servlets.AdminServlet</servlet-class>
<servlet-class>io.dropwizard.metrics.servlets.AdminServlet</servlet-class>
</servlet>

<!-- single mapping to spring, this only works properly if the advanced dispatch filter is
Expand Down Expand Up @@ -81,4 +86,4 @@
<servlet-name>mapfish.print2</servlet-name>
<url-pattern>/pdf2/*</url-pattern>
</servlet-mapping-->
</web-app>
</web-app>