Skip to content

Commit

Permalink
Add server-webapp module
Browse files Browse the repository at this point in the history
The PKIApplication class and the services in it are supposed to
be deployed under /pki webapp only, but currently these classes
are included in pki-server.jar so they are also distributed in
all other webapps although they are not actually used there.

In Servlet 3.0 framework all application classes in the webapp
will be initialized automatically, so the current packaging
could become a problem.

To avoid the problem the files for /pki webapp need to be moved
into a new server-webapp module, and the PKIApplication with the
services in it need to be moved into pki-server-webapp.jar which
will only be deployed under /pki webapp.
  • Loading branch information
edewata committed May 3, 2023
1 parent 844818d commit afd6365
Show file tree
Hide file tree
Showing 76 changed files with 405 additions and 20 deletions.
1 change: 1 addition & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<classpathentry kind="src" path="base/tomcat-9.0/src/main/java"/>
<classpathentry kind="src" path="base/server/src/main/java"/>
<classpathentry kind="src" path="base/server/src/test/java"/>
<classpathentry kind="src" path="base/server-webapp/src/main/java"/>
<classpathentry kind="src" path="base/ca/src/main/java"/>
<classpathentry kind="src" path="base/ca/src/test/java"/>
<classpathentry kind="src" path="base/kra/src/main/java"/>
Expand Down
1 change: 1 addition & 0 deletions base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ if(WITH_SERVER OR WITH_CA OR WITH_KRA OR WITH_OCSP OR WITH_TKS OR WITH_TPS OR WI

add_subdirectory(${APP_SERVER})
add_subdirectory(server)
add_subdirectory(server-webapp)

list(APPEND PKI_JAVADOC_SOURCEPATH
${CMAKE_SOURCE_DIR}/base/server/src/main/java)
Expand Down
1 change: 1 addition & 0 deletions base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<module>tomcat</module>
<module>tomcat-9.0</module>
<module>server</module>
<module>server-webapp</module>
<module>ca</module>
<module>kra</module>
<module>ocsp</module>
Expand Down
76 changes: 76 additions & 0 deletions base/server-webapp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
project(server-webapp)

# build server-webapp classes
javac(pki-server-webapp-classes
DEPENDS
pki-server-jar
SOURCES
src/main/java/*.java
CLASSPATH
${SERVLET_JAR}
${JAXRS_API_JAR}
${SLF4J_API_JAR}
${JACKSON2_CORE_JAR}
${PKI_COMMON_JAR}
${PKI_SERVER_JAR}
OUTPUT_DIR
${CMAKE_CURRENT_BINARY_DIR}/classes
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/main/resources/META-INF/MANIFEST.MF
${CMAKE_CURRENT_BINARY_DIR}/MANIFEST.MF
)

# build pki-server-webapp.jar
jar(pki-server-webapp-jar
DEPENDS
pki-server-webapp-classes
CREATE
${CMAKE_BINARY_DIR}/dist/pki-server-webapp.jar
OPTIONS
m
PARAMS
${CMAKE_CURRENT_BINARY_DIR}/MANIFEST.MF
INPUT_DIR
${CMAKE_CURRENT_BINARY_DIR}/classes
INPUT_DIR
${CMAKE_CURRENT_SOURCE_DIR}/src/main/resources
)

set(PKI_SERVER_WEBAPP_JAR ${CMAKE_BINARY_DIR}/dist/pki-server-webapp.jar CACHE INTERNAL "pki-server-webapp jar file")

# Create /usr/share/pki/server/webapps/pki/WEB-INF/lib. This can be customized for different platforms in RPM spec.

add_custom_target(pki-server-webapp-lib ALL
COMMENT "Creating links for PKI server webapp library")

add_custom_command(
TARGET pki-server-webapp-lib
COMMAND ${CMAKE_COMMAND} -E make_directory webapp/lib
COMMAND ln -sf ../../../../../../../..${SLF4J_API_JAR} webapp/lib/slf4j-api.jar
COMMAND ln -sf ../../../../../../../..${SLF4J_JDK14_JAR} webapp/lib/slf4j-jdk14.jar
COMMAND ln -sf ../../../../../../../..${JAVA_JAR_INSTALL_DIR}/pki/pki-server.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-server.jar
COMMAND ln -sf ../../../../../../../..${JAVA_JAR_INSTALL_DIR}/pki/pki-server-webapp.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-server-webapp.jar
)

install(
DIRECTORY
webapps
DESTINATION
${DATA_INSTALL_DIR}/server
)

install(
FILES
${CMAKE_BINARY_DIR}/dist/pki-server-webapp.jar
DESTINATION
${JAVA_JAR_INSTALL_DIR}/pki
)

install(
DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/
DESTINATION
${DATA_INSTALL_DIR}/server/webapps/pki/WEB-INF/lib
)
291 changes: 291 additions & 0 deletions base/server-webapp/LICENSE

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions base/server-webapp/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.dogtagpki.pki</groupId>
<artifactId>pki-base-parent</artifactId>
<version>${revision}</version>
</parent>

<artifactId>pki-server-webapp</artifactId>
<packaging>jar</packaging>

<dependencies>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pki-server</artifactId>
<version>${project.version}</version>
</dependency>

</dependencies>

<build>
<finalName>pki-server-webapp</finalName>
</build>

</project>
3 changes: 3 additions & 0 deletions base/server-webapp/src/main/resources/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Name: pki-server-webapp
Specification-Version: ${APPLICATION_VERSION}
Implementation-Version: ${IMPL_VERSION}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 0 additions & 20 deletions base/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,6 @@ add_custom_command(
COMMAND ln -sf ../../../../../..${TOMCATJSS_JAR} common/lib/tomcatjss.jar
)

# Create /usr/share/pki/server/webapps/pki/WEB-INF/lib. This can be customized for different platforms in RPM spec.

add_custom_target(pki-server-webapp-lib ALL
COMMENT "Creating links for PKI webapp library")

add_custom_command(
TARGET pki-server-webapp-lib
COMMAND ${CMAKE_COMMAND} -E make_directory webapp/lib
COMMAND ln -sf ../../../../../../../..${SLF4J_API_JAR} webapp/lib/slf4j-api.jar
COMMAND ln -sf ../../../../../../../..${SLF4J_JDK14_JAR} webapp/lib/slf4j-jdk14.jar
COMMAND ln -sf ../../../../../../../..${JAVA_JAR_INSTALL_DIR}/pki/pki-server.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-server.jar
)

add_custom_target(pki-server-man ALL
COMMENT "Creating PKI server manuals")

Expand Down Expand Up @@ -266,13 +253,6 @@ install(
${DATA_INSTALL_DIR}/server/common/lib
)

install(
DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/
DESTINATION
${DATA_INSTALL_DIR}/server/webapps/pki/WEB-INF/lib
)

install(
DIRECTORY
../../docs/
Expand Down
1 change: 1 addition & 0 deletions pki.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@ fi
%attr(644,-,-) %{_unitdir}/[email protected]
%attr(644,-,-) %{_unitdir}/pki-tomcatd-nuxwdog.target
%{_javadir}/pki/pki-server.jar
%{_javadir}/pki/pki-server-webapp.jar
%{_javadir}/pki/pki-tomcat.jar
%dir %{_sharedstatedir}/pki
%{_mandir}/man1/pkidaemon.1.gz
Expand Down

0 comments on commit afd6365

Please sign in to comment.