Skip to content

Commit

Permalink
Auto-initialize JAX-RS applications
Browse files Browse the repository at this point in the history
The web.xml in all webapps has been modified to drop the
RESTEasy servlet declaration and let JAX-RS applications be
initialized automatically by resteasy-servlet-initializer.

https://docs.jboss.org/resteasy/docs/3.0.24.Final/userguide/html_single/#d4e143
  • Loading branch information
edewata committed Jun 16, 2023
1 parent 4269779 commit c762c38
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 329 deletions.
93 changes: 0 additions & 93 deletions base/acme/webapps/acme/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,99 +8,6 @@ SPDX-License-Identifier: GPL-2.0-or-later

<display-name>ACME Responder</display-name>

<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>

<context-param>
<param-name>resteasy.role.based.security</param-name>
<param-value>true</param-value>
</context-param>

<context-param>
<param-name>resteasy.resource.method-interceptors</param-name>
<param-value>org.jboss.resteasy.core.ResourceMethodSecurityInterceptor</param-value>
</context-param>

<servlet>
<servlet-name>ACME</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.dogtagpki.acme.server.ACMEApplication</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/logout</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/enable</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/disable</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/directory</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/new-nonce</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/new-account</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/new-order</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/authz/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/chall/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/order/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/acct/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/cert/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACME</servlet-name>
<url-pattern>/revoke-cert</url-pattern>
</servlet-mapping>

<security-constraint>
<display-name>Allow somebody with credentials to log in</display-name>
<web-resource-collection>
Expand Down
37 changes: 0 additions & 37 deletions base/ca/shared/webapps/ca/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,6 @@

<display-name>Certificate Authority</display-name>

<!-- ==================== RESTEasy Configuration =============== -->

<listener>
<listener-class> org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap </listener-class>
</listener>

<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>

<context-param>
<param-name>resteasy.role.based.security</param-name>
<param-value>true</param-value>
</context-param>

<context-param>
<param-name>resteasy.resource.method-interceptors</param-name>
<param-value>
org.jboss.resteasy.core.ResourceMethodSecurityInterceptor
</param-value>
</context-param>

<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.dogtagpki.server.ca.rest.CAApplication</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

<security-constraint>
<web-resource-collection>
<web-resource-name>Account Services</web-resource-name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
23 changes: 0 additions & 23 deletions base/est/webapps/est/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,6 @@ SPDX-License-Identifier: GPL-2.0-or-later

<display-name>EST service</display-name>

<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>

<context-param>
<param-name>resteasy.resource.method-interceptors</param-name>
<param-value>org.jboss.resteasy.core.ResourceMethodSecurityInterceptor</param-value>
</context-param>

<servlet>
<servlet-name>EST</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.dogtagpki.est.ESTApplication</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>EST</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

<!-- all GET methods are public -->
<security-constraint>
<display-name>Require TLS for all resources</display-name>
Expand Down
38 changes: 0 additions & 38 deletions base/kra/shared/webapps/kra/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -547,44 +547,6 @@
<param-value> admin </param-value> </init-param>
</servlet>


<!-- ==================== RESTEasy Configuration =============== -->

<listener>
<listener-class> org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap </listener-class>
</listener>

<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>

<context-param>
<param-name>resteasy.role.based.security</param-name>
<param-value>true</param-value>
</context-param>

<context-param>
<param-name>resteasy.resource.method-interceptors</param-name>
<param-value>
org.jboss.resteasy.core.ResourceMethodSecurityInterceptor
</param-value>
</context-param>

<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.dogtagpki.server.kra.rest.KRAApplication</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name> kraserver </servlet-name>
<url-pattern> /server </url-pattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
35 changes: 0 additions & 35 deletions base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -446,41 +446,6 @@
<param-value> admin </param-value> </init-param>
</servlet>

<listener>
<listener-class> org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap </listener-class>
</listener>

<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>

<context-param>
<param-name>resteasy.role.based.security</param-name>
<param-value>true</param-value>
</context-param>

<context-param>
<param-name>resteasy.resource.method-interceptors</param-name>
<param-value>
org.jboss.resteasy.core.ResourceMethodSecurityInterceptor
</param-value>
</context-param>

<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.dogtagpki.server.ocsp.rest.OCSPApplication</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name> ocspacl </servlet-name>
<url-pattern> /acl </url-pattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object> singletons = new LinkedHashSet<>();
Expand Down
35 changes: 0 additions & 35 deletions base/server-webapp/webapps/pki/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,6 @@

<display-name>PKI</display-name>

<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>

<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>

<context-param>
<param-name>resteasy.role.based.security</param-name>
<param-value>true</param-value>
</context-param>

<context-param>
<param-name>resteasy.resource.method-interceptors</param-name>
<param-value>
org.jboss.resteasy.core.ResourceMethodSecurityInterceptor
</param-value>
</context-param>

<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.dogtagpki.server.rest.PKIApplication</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

<mime-mapping>
<extension>properties</extension>
<mime-type>text/plain</mime-type>
Expand Down
Loading

0 comments on commit c762c38

Please sign in to comment.