From ed6b8c699f1a0923ced3266dba7fe0f0abf18415 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Fri, 16 Jun 2023 15:37:10 -0500 Subject: [PATCH] Auto-initialize JAX-RS applications The web.xml files in most webapps (except ACME and EST) have been modified to drop the RESTEasy servlet declaration and let the JAX-RS applications be initialized automatically by resteasy-servlet-initializer. https://docs.jboss.org/resteasy/docs/3.0.24.Final/userguide/html_single/#d4e143 --- base/ca/shared/webapps/ca/WEB-INF/web.xml | 37 ------------------ .../server/ca/rest/CAApplication.java | 2 + base/kra/shared/webapps/kra/WEB-INF/web.xml | 38 ------------------- .../server/kra/rest/KRAApplication.java | 2 + base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml | 35 ----------------- .../server/ocsp/rest/OCSPApplication.java | 2 + .../dogtagpki/server/rest/PKIApplication.java | 2 + .../server-webapp/webapps/pki/WEB-INF/web.xml | 35 ----------------- base/tks/shared/webapps/tks/WEB-INF/web.xml | 35 ----------------- .../server/tks/rest/TKSApplication.java | 2 + base/tps/shared/webapps/tps/WEB-INF/web.xml | 33 ---------------- .../server/tps/rest/TPSApplication.java | 2 + 12 files changed, 12 insertions(+), 213 deletions(-) diff --git a/base/ca/shared/webapps/ca/WEB-INF/web.xml b/base/ca/shared/webapps/ca/WEB-INF/web.xml index 8d55f258552..ba184ee92bb 100644 --- a/base/ca/shared/webapps/ca/WEB-INF/web.xml +++ b/base/ca/shared/webapps/ca/WEB-INF/web.xml @@ -3,43 +3,6 @@ Certificate Authority - - - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - resteasy.servlet.mapping.prefix - /rest - - - - resteasy.role.based.security - true - - - - resteasy.resource.method-interceptors - - org.jboss.resteasy.core.ResourceMethodSecurityInterceptor - - - - - Resteasy - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - javax.ws.rs.Application - org.dogtagpki.server.ca.rest.CAApplication - - - - - Resteasy - /rest/* - - Account Services diff --git a/base/ca/src/main/java/org/dogtagpki/server/ca/rest/CAApplication.java b/base/ca/src/main/java/org/dogtagpki/server/ca/rest/CAApplication.java index 19ad67d64cb..12fd4a50378 100644 --- a/base/ca/src/main/java/org/dogtagpki/server/ca/rest/CAApplication.java +++ b/base/ca/src/main/java/org/dogtagpki/server/ca/rest/CAApplication.java @@ -3,6 +3,7 @@ import java.util.LinkedHashSet; import java.util.Set; +import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import org.dogtagpki.server.rest.ACLInterceptor; @@ -19,6 +20,7 @@ import org.dogtagpki.server.rest.SessionContextInterceptor; import org.dogtagpki.server.rest.UserService; +@ApplicationPath("/rest") public class CAApplication extends Application { public static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CAApplication.class); diff --git a/base/kra/shared/webapps/kra/WEB-INF/web.xml b/base/kra/shared/webapps/kra/WEB-INF/web.xml index cc5eb7f7006..8d5c76d9ee5 100644 --- a/base/kra/shared/webapps/kra/WEB-INF/web.xml +++ b/base/kra/shared/webapps/kra/WEB-INF/web.xml @@ -547,44 +547,6 @@ admin - - - - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - resteasy.servlet.mapping.prefix - /rest - - - - resteasy.role.based.security - true - - - - resteasy.resource.method-interceptors - - org.jboss.resteasy.core.ResourceMethodSecurityInterceptor - - - - - Resteasy - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - javax.ws.rs.Application - org.dogtagpki.server.kra.rest.KRAApplication - - - - - Resteasy - /rest/* - - kraserver /server diff --git a/base/kra/src/main/java/org/dogtagpki/server/kra/rest/KRAApplication.java b/base/kra/src/main/java/org/dogtagpki/server/kra/rest/KRAApplication.java index 4a6b84ea77e..fa3970e2cb5 100644 --- a/base/kra/src/main/java/org/dogtagpki/server/kra/rest/KRAApplication.java +++ b/base/kra/src/main/java/org/dogtagpki/server/kra/rest/KRAApplication.java @@ -3,6 +3,7 @@ import java.util.LinkedHashSet; import java.util.Set; +import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import org.dogtagpki.server.rest.ACLInterceptor; @@ -18,6 +19,7 @@ import org.dogtagpki.server.rest.SessionContextInterceptor; import org.dogtagpki.server.rest.UserService; +@ApplicationPath("/rest") public class KRAApplication extends Application { public static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(KRAApplication.class); diff --git a/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml b/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml index 06437c052ff..f8be9c55bb1 100644 --- a/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml +++ b/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml @@ -446,41 +446,6 @@ admin - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - resteasy.servlet.mapping.prefix - /rest - - - - resteasy.role.based.security - true - - - - resteasy.resource.method-interceptors - - org.jboss.resteasy.core.ResourceMethodSecurityInterceptor - - - - - Resteasy - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - javax.ws.rs.Application - org.dogtagpki.server.ocsp.rest.OCSPApplication - - - - - Resteasy - /rest/* - - ocspacl /acl diff --git a/base/ocsp/src/main/java/org/dogtagpki/server/ocsp/rest/OCSPApplication.java b/base/ocsp/src/main/java/org/dogtagpki/server/ocsp/rest/OCSPApplication.java index 27b62f3d06d..837f88da74b 100644 --- a/base/ocsp/src/main/java/org/dogtagpki/server/ocsp/rest/OCSPApplication.java +++ b/base/ocsp/src/main/java/org/dogtagpki/server/ocsp/rest/OCSPApplication.java @@ -3,6 +3,7 @@ import java.util.LinkedHashSet; import java.util.Set; +import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import org.dogtagpki.server.rest.ACLInterceptor; @@ -17,6 +18,7 @@ import org.dogtagpki.server.rest.SessionContextInterceptor; import org.dogtagpki.server.rest.UserService; +@ApplicationPath("/rest") public class OCSPApplication extends Application { public static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(OCSPApplication.class); diff --git a/base/server-webapp/src/main/java/org/dogtagpki/server/rest/PKIApplication.java b/base/server-webapp/src/main/java/org/dogtagpki/server/rest/PKIApplication.java index f3f71024d7c..db7d5e18f7d 100644 --- a/base/server-webapp/src/main/java/org/dogtagpki/server/rest/PKIApplication.java +++ b/base/server-webapp/src/main/java/org/dogtagpki/server/rest/PKIApplication.java @@ -21,8 +21,10 @@ import java.util.LinkedHashSet; import java.util.Set; +import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; +@ApplicationPath("/rest") public class PKIApplication extends Application { private Set singletons = new LinkedHashSet<>(); diff --git a/base/server-webapp/webapps/pki/WEB-INF/web.xml b/base/server-webapp/webapps/pki/WEB-INF/web.xml index cb9f5e6aee2..fe93b6c67c5 100644 --- a/base/server-webapp/webapps/pki/WEB-INF/web.xml +++ b/base/server-webapp/webapps/pki/WEB-INF/web.xml @@ -3,41 +3,6 @@ PKI - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - resteasy.servlet.mapping.prefix - /rest - - - - resteasy.role.based.security - true - - - - resteasy.resource.method-interceptors - - org.jboss.resteasy.core.ResourceMethodSecurityInterceptor - - - - - Resteasy - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - javax.ws.rs.Application - org.dogtagpki.server.rest.PKIApplication - - - - - Resteasy - /rest/* - - properties text/plain diff --git a/base/tks/shared/webapps/tks/WEB-INF/web.xml b/base/tks/shared/webapps/tks/WEB-INF/web.xml index eafecbb9c9a..87bccacff56 100644 --- a/base/tks/shared/webapps/tks/WEB-INF/web.xml +++ b/base/tks/shared/webapps/tks/WEB-INF/web.xml @@ -234,41 +234,6 @@ tksGetStatus - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - resteasy.servlet.mapping.prefix - /rest - - - - resteasy.role.based.security - true - - - - resteasy.resource.method-interceptors - - org.jboss.resteasy.core.ResourceMethodSecurityInterceptor - - - - - Resteasy - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - javax.ws.rs.Application - org.dogtagpki.server.tks.rest.TKSApplication - - - - - Resteasy - /rest/* - - tksug /ug diff --git a/base/tks/src/main/java/org/dogtagpki/server/tks/rest/TKSApplication.java b/base/tks/src/main/java/org/dogtagpki/server/tks/rest/TKSApplication.java index 2bdc9e06528..372822548d7 100644 --- a/base/tks/src/main/java/org/dogtagpki/server/tks/rest/TKSApplication.java +++ b/base/tks/src/main/java/org/dogtagpki/server/tks/rest/TKSApplication.java @@ -3,6 +3,7 @@ import java.util.LinkedHashSet; import java.util.Set; +import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import org.dogtagpki.server.rest.ACLInterceptor; @@ -17,6 +18,7 @@ import org.dogtagpki.server.rest.SessionContextInterceptor; import org.dogtagpki.server.rest.UserService; +@ApplicationPath("/rest") public class TKSApplication extends Application { private Set singletons = new LinkedHashSet<>(); diff --git a/base/tps/shared/webapps/tps/WEB-INF/web.xml b/base/tps/shared/webapps/tps/WEB-INF/web.xml index 23412ea73f8..7a07aa5de2f 100644 --- a/base/tps/shared/webapps/tps/WEB-INF/web.xml +++ b/base/tps/shared/webapps/tps/WEB-INF/web.xml @@ -88,39 +88,6 @@ org.dogtagpki.server.tps.TPSServlet - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - resteasy.servlet.mapping.prefix - /rest - - - - resteasy.role.based.security - true - - - - resteasy.resource.method-interceptors - org.jboss.resteasy.core.ResourceMethodSecurityInterceptor - - - - Resteasy - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - javax.ws.rs.Application - org.dogtagpki.server.tps.rest.TPSApplication - - - - - Resteasy - /rest/* - - tpsug /ug diff --git a/base/tps/src/main/java/org/dogtagpki/server/tps/rest/TPSApplication.java b/base/tps/src/main/java/org/dogtagpki/server/tps/rest/TPSApplication.java index 5b5ff8aea74..3feed1c547b 100644 --- a/base/tps/src/main/java/org/dogtagpki/server/tps/rest/TPSApplication.java +++ b/base/tps/src/main/java/org/dogtagpki/server/tps/rest/TPSApplication.java @@ -20,6 +20,7 @@ import java.util.LinkedHashSet; import java.util.Set; +import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import org.dogtagpki.server.rest.ACLInterceptor; @@ -38,6 +39,7 @@ /** * @author Endi S. Dewata */ +@ApplicationPath("/rest") public class TPSApplication extends Application { private Set singletons = new LinkedHashSet<>();