diff --git a/.dockerignore b/.dockerignore index 019da9380d61fc4fe96d081791d005f0618149c0..972b728930b4da57f3edf726cbfa8e2621a21a46 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,5 @@ .idea README.md docker-compose.yml +.gitignore +*.log diff --git a/.gitignore b/.gitignore index d0d28d2b45afd48fb7a11c892cda38b567641906..861db796b3ae4ae0c2e53c823d05f43ca3ae4c1e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,6 @@ utils/src/main/resources/* *.jks *.p12 target/ -.classpath -.project .settings/ Thumbs.db diff --git a/README.md b/README.md index c29f79612ea6e24ab473808399061977aa4ed1ae..4935b3ed090a4a651601537e02300697a8e38a92 100644 --- a/README.md +++ b/README.md @@ -2,71 +2,20 @@ ## Steps to run this project -1. ```COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose up --build -d``` +1. COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose up --build -d 2. Visit - 1. ```curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample``` - 2. ```curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/hello``` - 3. ```curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/main``` - 4. ```curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons``` - 5. ``` - curl -H "Content-Type: application/json" \ + 1. curl http://localhost:8080/restApp/sample + 2. curl http://localhost:8080/restApp/sample/hello + 3. curl http://localhost:8080/restApp/sample/main + 4. curl http://localhost:8080/restApp/sample/persons + 5. curl -H "Content-Type: application/json" \ -X POST \ -d '{"name":"Jeanne"}' \ - http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons - 6. ``` - curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons/843c8236-6c6b-450e-9aa3-211a9b897403``` - 7. ```curl -H "Accept: text/xml" http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons``` - - -## Use a "real" certificate -Récupérer le certificat du serveur -``` -echo quit | openssl s_client \ - -showcerts -servername localhost -connect localhost:8181 >! localhost.pem -``` - -Convertir en keystore java -``` -keytool -noprompt -storepass storepass -import \ - -trustcacerts -alias mycert -file localhost.pem -keystore mycert-pub.jks -``` - -Il est possible d'utiliser le certificat avec curl -``` -curl --cacert localhost.pem \ - https://localhost:8181/restApp-1.0-SNAPSHOT/resources/sample/persons/843c8236-6c6b-450e-9aa3-211a9b897403 -``` - -Avec un reverse proxy : -``` -echo quit | openssl s_client -showcerts \ - -servername localhost -connect localhost:8888 >! localhost.pem - -curl --cacert localhost.pem \ - https://localhost:8181/restApp-1.0-SNAPSHOT/resources/sample/persons/843c8236-6c6b-450e-9aa3-211a9b897403 - -keytool -noprompt -storepass storepass -import \ - -trustcacerts -alias mycert -file localhost.pem -keystore mycert-pub.jks -``` - - - - - - - - - - - - - - - - - - - - + http://localhost:8080/restApp/sample/persons + 6. curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons/843c8236-6c6b-450e-9aa3-211a9b897403 + 7. curl -H "Accept: text/xml" http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons +## Import "real" certificate + openssl x509 -outform der -in localhost.pem -out localhost.der + keytool -import -noprompt -trustcacerts -storepass storepass -alias localhost -keystore mycert-pub.jks -file localhost.der diff --git a/dao/src/main/resources/META-INF/beans.xml b/dao/src/main/resources/META-INF/beans.xml deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/docker/Dockerfile b/docker/Dockerfile index 5ae1c98638980baaf2941b88b67298809f095a24..b0fdff5d1f8422ef772a39fdc5667d5c02ea5780 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,14 +1,18 @@ -# syntax=docker/dockerfile:1 +# syntax=docker/dockerfile:1.3 ### First we build the application in docker in a controlled env -FROM maven:3.8.3-eclipse-temurin-11 as build +FROM maven:3.8.4-eclipse-temurin-11 as build WORKDIR /app -COPY ./ /app/ +# COPY pom.xml /app/pom.xml +COPY . /app/ + RUN --mount=type=cache,id=mvncache,target=/root/.m2/repository,rw \ - mvn -B clean package + mvn -B package ### Then we add the builded war to a JEE server. -FROM payara/server-full:5.2021.9-jdk11 as server +#FROM payara/server-full:5.2021.9-jdk11 as server +FROM brunoe/payara:jdk11-6 as server + ARG STORE_PASSWORD=changeit ## Download the JDBC driver USER root @@ -16,7 +20,9 @@ RUN apt-get update && \ apt-get install -y wget unzip && \ rm -rf /var/lib/apt/lists/* && \ wget https://repo1.maven.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar \ - -O /tmp/h2.jar + -O /tmp/h2.jar && \ + cp /tmp/h2.jar /opt/payara/appserver/glassfish/domains/domain1/lib/h2.jar + USER payara ## This script adds a jdbc connection pool and ressource COPY docker/post-boot-commands.asadmin $POSTBOOT_COMMANDS @@ -29,8 +35,16 @@ COPY --from=build /app/utils/src/main/resources/mycert-pub.p12 /app/utils/src/m RUN keytool -importkeystore -noprompt -destkeystore /opt/payara/appserver/glassfish/domains/domain1/config/keystore.jks -srckeystore /tmp/mycert.p12 -srcstoretype PKCS12 -alias mycert -srcstorepass storepass -deststorepass ${STORE_PASSWORD} -deststoretype pkcs12 && \ keytool -importcert -noprompt -trustcacerts -destkeystore /opt/payara/appserver/glassfish/domains/domain1/config/cacerts.jks -file /tmp/mycert.crt -alias mycert -srcstorepass storepass -deststorepass ${STORE_PASSWORD} -deststoretype pkcs12 +#RUN wget https://github.com/eclipse-ee4j/mojarra/releases/download/3.0.2-RELEASE/jakarta.faces-3.0.2.jar \ +# -O /opt/payara/appserver/glassfish/modules/jakarta.faces.jar +#RUN wget https://github.com/eclipse-ee4j/mojarra/releases/download/2.3.17-RELEASE/jakarta.faces-2.3.17.jar \ +# -O /opt/payara/appserver/glassfish/modules/jakarta.faces.jar FROM server as production -COPY --from=build /app/restApp/target/*.war \ - $DEPLOY_DIR -COPY --from=build /app/wsApp/target/*.war \ - $DEPLOY_DIR +#COPY --from=build /app/jee/restApp/target/*.war \ +# $DEPLOY_DIR +#COPY --from=build /app/jee/wsApp/target/*.war \ +# $DEPLOY_DIR +#COPY --from=build /app/jee/jsf/target/*.war \ +# $DEPLOY_DIR +COPY --from=build /app/jee/ear/target/*.ear \ + $DEPLOY_DIR \ No newline at end of file diff --git a/docker/payara/Dockerfile b/docker/payara/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..369243efef57261fdbf19a04e29b6bb2a7838a5f --- /dev/null +++ b/docker/payara/Dockerfile @@ -0,0 +1,98 @@ +# FROM azul/zulu-openjdk:8u222 as mypayara +#FROM eclipse-temurin:17-jdk +FROM eclipse-temurin:11.0.13_8-jdk-focal +# Default payara ports to expose +# 4848: admin console +# 9009: debug port (JPDA) +# 8080: http +# 8181: https +EXPOSE 4848 9009 8080 8181 8686 + +#ARG PAYARA_VERSION=5.2021.9 +#ARG PAYARA_SHA1=81c43f3c537ec74a813b48172758866615e1e792 + +ARG PAYARA_VERSION=6.2021.1.Alpha1 +ARG PAYARA_SHA1=0262f8af7e52b318109ed43f8a31a1e93f111bbf + +ARG PAYARA_PKG=https://search.maven.org/remotecontent?filepath=fish/payara/distributions/payara/${PAYARA_VERSION}/payara-${PAYARA_VERSION}.zip + + +ARG TINI_VERSION=v0.19.0 + +# Initialize the configurable environment variables +ENV HOME_DIR=/opt/payara\ + PAYARA_DIR=/opt/payara/appserver\ + SCRIPT_DIR=/opt/payara/scripts\ + CONFIG_DIR=/opt/payara/config\ + DEPLOY_DIR=/opt/payara/deployments\ + PASSWORD_FILE=/opt/payara/passwordFile\ + # Payara Server Domain options + DOMAIN_NAME=domain1\ + ADMIN_USER=admin\ + ADMIN_PASSWORD=admin\ + # Utility environment variables + JVM_ARGS=\ + PAYARA_ARGS=\ + DEPLOY_PROPS=\ + POSTBOOT_COMMANDS=/opt/payara/config/post-boot-commands.asadmin\ + PREBOOT_COMMANDS=/opt/payara/config/pre-boot-commands.asadmin +ENV PATH="${PATH}:${PAYARA_DIR}/bin" + +# Create and set the Payara user and working directory owned by the new user +RUN groupadd -g 1000 payara && \ + useradd -u 1000 -M -s /bin/bash -d ${HOME_DIR} payara -g payara && \ + echo payara:payara | chpasswd && \ + mkdir -p ${DEPLOY_DIR} && \ + mkdir -p ${CONFIG_DIR} && \ + mkdir -p ${SCRIPT_DIR} && \ + chown -R payara: ${HOME_DIR} && \ + # Install required packages + apt-get update && \ + apt-get install -y wget unzip gpg && \ + rm -rf /var/lib/apt/lists/* + +# Install tini as minimized init system +RUN wget --no-verbose -O /tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini && \ + wget --no-verbose -O /tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc && \ + gpg --batch --keyserver "keyserver.ubuntu.com" --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 && \ + gpg --batch --verify /tini.asc /tini && \ + chmod +x /tini + +USER payara +WORKDIR ${HOME_DIR} + +# Download and unzip the Payara distribution +RUN ulimit -n 1024 ; wget --no-verbose -O payara.zip ${PAYARA_PKG} && \ + echo "${PAYARA_SHA1} *payara.zip" | sha1sum -c - && \ + unzip -qq payara.zip -d ./ && \ + mv payara*/ appserver && \ + # Configure the password file for configuring Payara + echo "AS_ADMIN_PASSWORD=\nAS_ADMIN_NEWPASSWORD=${ADMIN_PASSWORD}" > /tmp/tmpfile && \ + echo "AS_ADMIN_PASSWORD=${ADMIN_PASSWORD}" >> ${PASSWORD_FILE} && \ + # Configure the payara domain + ${PAYARA_DIR}/bin/asadmin --user ${ADMIN_USER} --passwordfile=/tmp/tmpfile change-admin-password --domain_name=${DOMAIN_NAME} && \ + ${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} start-domain ${DOMAIN_NAME} && \ + ${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} enable-secure-admin && \ + for MEMORY_JVM_OPTION in $(${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} list-jvm-options | grep "Xm[sx]"); do\ + ${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} delete-jvm-options $MEMORY_JVM_OPTION;\ + done && \ + # FIXME: when upgrading this container to Java 10+, this needs to be changed to '-XX:+UseContainerSupport' and '-XX:MaxRAMPercentage' +# ${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} create-jvm-options '-XX\:+UnlockExperimentalVMOptions:-XX\:+UseCGroupMemoryLimitForHeap:-XX\:MaxRAMFraction=1' && \ + ${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} create-jvm-options '-XX\:+UseContainerSupport:-XX\:MaxRAMPercentage=100' && \ + ${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} set-log-attributes com.sun.enterprise.server.logging.GFFileHandler.logtoFile=false && \ + ${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} stop-domain ${DOMAIN_NAME} && \ + # Cleanup unused files + rm -rf \ + /tmp/tmpFile \ + payara.zip \ + ${PAYARA_DIR}/glassfish/domains/${DOMAIN_NAME}/osgi-cache \ + ${PAYARA_DIR}/glassfish/domains/${DOMAIN_NAME}/logs +# ${PAYARA_DIR}/glassfish/domains/domain1 + +# Copy across docker scripts +COPY --chown=payara:payara bin/*.sh ${SCRIPT_DIR}/ +RUN mkdir -p ${SCRIPT_DIR}/init.d && \ + chmod +x ${SCRIPT_DIR}/* + +ENTRYPOINT ["/tini", "--"] +CMD ${SCRIPT_DIR}/entrypoint.sh diff --git a/docker/payara/build.sh b/docker/payara/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..6ee1b511105493c2a4181dd967400f0fadc99ede --- /dev/null +++ b/docker/payara/build.sh @@ -0,0 +1 @@ +COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker build -t brunoe/payara:jdk11-6 . diff --git a/docker/payara/run.sh b/docker/payara/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..7103277cebf38945809bd712d796c05abe84ae20 --- /dev/null +++ b/docker/payara/run.sh @@ -0,0 +1 @@ +docker run -it -p 4848:4848 -p 8080 brunoe/payara diff --git a/docker/post-boot-commands.asadmin b/docker/post-boot-commands.asadmin index 2bd8a432084692826c01b01231f97a349baafb29..24fe032cbe721a38c1fad8f66bff3cefbce19a6d 100755 --- a/docker/post-boot-commands.asadmin +++ b/docker/post-boot-commands.asadmin @@ -1,7 +1,8 @@ set-hazelcast-configuration --enabled=true --dynamic=true add-library /tmp/h2.jar -create-jdbc-connection-pool --datasourceclassname org.h2.jdbcx.JdbcDataSource --restype javax.sql.ConnectionPoolDataSource --property password=password:user=user:url="jdbc:h2:tcp://db:9092/payara;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE" H2-pool -create-jdbc-resource --connectionpoolid H2-pool jdbc/h2-pool +create-jdbc-connection-pool --datasourceclassname org.h2.jdbcx.JdbcDataSource --restype javax.sql.ConnectionPoolDataSource --property password=password:user=user:url="jdbc:h2:tcp://db:9092/payara;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE" My-H2-pool +#create-jdbc-connection-pool --datasourceclassname org.h2.jdbcx.JdbcDataSource --restype javax.sql.ConnectionPoolDataSource --property password=password:user=user:url="jdbc:h2:tcp://db:9092/payara;MODE=PostgreSQL" My-H2-pool +create-jdbc-resource --connectionpoolid My-H2-pool jdbc/my-h2-pool # set configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.cert-nickname=mycert diff --git a/entites/pom.xml b/entites/pom.xml index f21f6b1e11046acc206068def224850aa9319697..6ad01bf0328715cf90e865f6c11f7e85620ef270 100644 --- a/entites/pom.xml +++ b/entites/pom.xml @@ -2,7 +2,7 @@ <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"> <parent> - <artifactId>jee9.1</artifactId> + <artifactId>parent</artifactId> <groupId>fr.univtln.bruno.samples.jee91</groupId> <version>1.0-SNAPSHOT</version> </parent> @@ -11,14 +11,15 @@ <artifactId>entites</artifactId> <dependencies> - <dependency> - <groupId>jakarta.platform</groupId> - <artifactId>jakarta.jakartaee-api</artifactId> - </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> + <dependency> + <groupId>jakarta.platform</groupId> + <artifactId>jakarta.jakartaee-api</artifactId> + <scope>provided</scope> + </dependency> </dependencies> </project> \ No newline at end of file diff --git a/entites/src/main/java/fr/univtln/bruno/samples/jee91/dao/Person.java b/entites/src/main/java/fr/univtln/bruno/samples/jee91/dao/Person.java index 2b85888364a51ab6761879e6b7e83f556a2fdd58..b3bdcf85113dbc5920c50e441cffee5c626fd594 100644 --- a/entites/src/main/java/fr/univtln/bruno/samples/jee91/dao/Person.java +++ b/entites/src/main/java/fr/univtln/bruno/samples/jee91/dao/Person.java @@ -2,40 +2,51 @@ package fr.univtln.bruno.samples.jee91.dao; import jakarta.json.bind.annotation.JsonbTransient; import jakarta.persistence.*; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Pattern; import jakarta.xml.bind.annotation.XmlRootElement; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; +import lombok.*; import lombok.experimental.FieldDefaults; +import java.io.Serializable; import java.util.UUID; +@AllArgsConstructor(staticName = "of") +@NoArgsConstructor +@ToString(onlyExplicitlyIncluded = true) @Table(name = "PERSON") @Entity @Getter @Setter -@NamedQueries({ - @NamedQuery(name = "Person.findAll", - query = "select p from Person p"), - @NamedQuery( - name = "Person.findAllOrderedByName", - query = "SELECT p FROM Person p ORDER BY p.name"), - @NamedQuery( - name = "Person.findByUUID", - query = "SELECT p FROM Person p WHERE p.uuid=:uuid") -}) +@NamedQuery(name = "Person.findAll", + query = "select p from Person p") +@NamedQuery( + name = "Person.findAllOrderedByName", + query = "SELECT p FROM Person p ORDER BY p.name") +@NamedQuery( + name = "Person.findByUUID", + query = "SELECT p FROM Person p WHERE p.uuid=:uuid") @XmlRootElement @FieldDefaults(level = AccessLevel.PRIVATE) -public class Person { +public class Person implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") @JsonbTransient long id; + @ToString.Include @Column(name = "NAME") + @NotBlank + @Pattern(regexp = "[A-Z][a-z]+", message = "Le nom doit commencer par une majuscule suivie de minuscules") String name; + @ToString.Include @Column(name = "UUID", updatable = false, nullable = false, unique = true) UUID uuid = UUID.randomUUID(); + + @Builder + public Person(String name) { + this.name = name; + } } diff --git a/entites/src/main/resources/META-INF/beans.xml b/entites/src/main/resources/META-INF/beans.xml index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..efd69bc2d38663ae2f69879265843f8ff04aac04 100644 --- a/entites/src/main/resources/META-INF/beans.xml +++ b/entites/src/main/resources/META-INF/beans.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans 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/beans_3_0.xsd" + bean-discovery-mode="all"> +</beans> \ No newline at end of file diff --git a/business/pom.xml b/jee/business/pom.xml similarity index 96% rename from business/pom.xml rename to jee/business/pom.xml index 076aab2e775d1432874bb8bf6c4a73f2d7360658..d0abff1d273ceb289b357595a067db18b9c07d71 100644 --- a/business/pom.xml +++ b/jee/business/pom.xml @@ -30,7 +30,7 @@ <artifactId>maven-ejb-plugin</artifactId> <version>3.1.0</version> <configuration> - <ejbVersion>3.0</ejbVersion> + <ejbVersion>3.1</ejbVersion> <generateClient>true</generateClient> </configuration> </plugin> diff --git a/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/Hello.java b/jee/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/Hello.java similarity index 100% rename from business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/Hello.java rename to jee/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/Hello.java diff --git a/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/HelloBean1.java b/jee/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/HelloBean1.java similarity index 100% rename from business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/HelloBean1.java rename to jee/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/HelloBean1.java diff --git a/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/HelloBean2.java b/jee/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/HelloBean2.java similarity index 100% rename from business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/HelloBean2.java rename to jee/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/HelloBean2.java diff --git a/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/qualifiers/SpokenLanguage.java b/jee/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/qualifiers/SpokenLanguage.java similarity index 100% rename from business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/qualifiers/SpokenLanguage.java rename to jee/business/src/main/java/fr/univtln/bruno/samples/jee91/ejb/qualifiers/SpokenLanguage.java diff --git a/jee/business/src/test/java/META-INF/beans.xml b/jee/business/src/test/java/META-INF/beans.xml new file mode 100644 index 0000000000000000000000000000000000000000..b8962f1bab4a8ebe5d3012b7b1e1245520a7b9c4 --- /dev/null +++ b/jee/business/src/test/java/META-INF/beans.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans 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/beans_3_0.xsd" + version="3.0" + bean-discovery-mode="all"> +</beans> \ No newline at end of file diff --git a/jee/common-persistence/pom.xml b/jee/common-persistence/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..42c65be118ee46406c5b66b7372a6cc4ca844915 --- /dev/null +++ b/jee/common-persistence/pom.xml @@ -0,0 +1,29 @@ +<?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"> + <parent> + <artifactId>jee9.1</artifactId> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <version>1.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>common-persistence</artifactId> + + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + </resources> + </build> + + <dependencies> + <dependency> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>entites</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + </dependencies> + +</project> \ No newline at end of file diff --git a/restApp/src/main/resources/META-INF/persistence.xml b/jee/common-persistence/src/main/resources/META-INF/persistence.xml similarity index 73% rename from restApp/src/main/resources/META-INF/persistence.xml rename to jee/common-persistence/src/main/resources/META-INF/persistence.xml index 50230cc5a2ed4c07f3146453bfd81a201697f389..e900259cf5ea473bb81e5f25c9f8716ceb87f03f 100644 --- a/restApp/src/main/resources/META-INF/persistence.xml +++ b/jee/common-persistence/src/main/resources/META-INF/persistence.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<persistence version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/persistence" +<persistence xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"> + xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd" + version="3.0"> <persistence-unit name="myappPU" transaction-type="JTA"> - <jta-data-source>jdbc/h2-pool</jta-data-source> + <jta-data-source>jdbc/my-h2-pool</jta-data-source> <class>fr.univtln.bruno.samples.jee91.dao.Person</class> - + <validation-mode>CALLBACK</validation-mode> <properties> <property name="jakarta.persistence.schema-generation.database.action" value="drop-and-create" /> <property name="jakarta.persistence.schema-generation.scripts.action" value="drop-and-create" /> diff --git a/restApp/src/main/resources/insert.sql b/jee/common-persistence/src/main/resources/insert.sql similarity index 95% rename from restApp/src/main/resources/insert.sql rename to jee/common-persistence/src/main/resources/insert.sql index e74e7ffef4c148ef8820cf85f012ce24599f7e1f..bc26cbec1c9e96c7327eff7d24737becf81e1455 100644 --- a/restApp/src/main/resources/insert.sql +++ b/jee/common-persistence/src/main/resources/insert.sql @@ -1,4 +1,4 @@ INSERT INTO "public"."person" ("name", "uuid") VALUES ('Yves', 'ACED00057372000E6A6176612E7574696C2E55554944BC9903F7986D852F0200024A000C6C65617374536967426974734A000B6D6F7374536967426974737870B25A000916801FE374FCFAC5DCF94C11'); INSERT INTO "public"."person" ("name", "uuid") VALUES ('Pierre', 'ACED00057372000E6A6176612E7574696C2E55554944BC9903F7986D852F0200024A000C6C65617374536967426974734A000B6D6F7374536967426974737870B8F28F7D3945291756DAC7325DF44938'); INSERT INTO "public"."person" ("name", "uuid") VALUES ('Marie', 'ACED00057372000E6A6176612E7574696C2E55554944BC9903F7986D852F0200024A000C6C65617374536967426974734A000B6D6F73745369674269747378709AA3211A9B897403843C82366C6B450E'); -INSERT INTO "public"."person" ("name", "uuid") VALUES ('Jeanne', 'ACED00057372000E6A6176612E7574696C2E55554944BC9903F7986D852F0200024A000C6C65617374536967426974734A000B6D6F7374536967426974737870BC1580AEB48C0F0C0B3C82E884AA4C3C'); \ No newline at end of file +INSERT INTO "public"."person" ("name", "uuid") VALUES ('Jeanne', 'ACED00057372000E6A6176612E7574696C2E55554944BC9903F7986D852F0200024A000C6C65617374536967426974734A000B6D6F7374536967426974737870BC1580AEB48C0F0C0B3C82E884AA4C3C'); diff --git a/dao/pom.xml b/jee/dao/pom.xml similarity index 100% rename from dao/pom.xml rename to jee/dao/pom.xml diff --git a/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/MainDAO.java b/jee/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/MainDAO.java similarity index 100% rename from dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/MainDAO.java rename to jee/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/MainDAO.java diff --git a/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/PersonDAO.java b/jee/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/PersonDAO.java similarity index 76% rename from dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/PersonDAO.java rename to jee/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/PersonDAO.java index f05f5a5ca1b4c59901d899a33eae690ed9409b71..87c8588218bea84ab9bd3168cc4089aa554b55b3 100644 --- a/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/PersonDAO.java +++ b/jee/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/PersonDAO.java @@ -8,7 +8,7 @@ import java.util.List; import java.util.UUID; public class PersonDAO { - private EntityManager entityManager; + private final EntityManager entityManager; @Inject public PersonDAO(@H2Database EntityManager entityManager) { @@ -16,7 +16,7 @@ public class PersonDAO { } public List<Person> findAll() { - return entityManager.createNamedQuery("Person.findAll").getResultList(); + return entityManager.createNamedQuery("Person.findAll", Person.class).getResultList(); } public UUID persist(Person person) { @@ -25,7 +25,7 @@ public class PersonDAO { } public Person findByUUID(UUID uuid) { - return entityManager.createNamedQuery("Person.findByUUID", Person.class).setParameter("uuid",uuid).getSingleResult(); + return entityManager.createNamedQuery("Person.findByUUID", Person.class).setParameter("uuid", uuid).getSingleResult(); } } diff --git a/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/EntityManagerProducer.java b/jee/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/EntityManagerProducer.java similarity index 100% rename from dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/EntityManagerProducer.java rename to jee/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/EntityManagerProducer.java diff --git a/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/H2Database.java b/jee/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/H2Database.java similarity index 100% rename from dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/H2Database.java rename to jee/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/H2Database.java diff --git a/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/PostgreSQLDatabase.java b/jee/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/PostgreSQLDatabase.java similarity index 100% rename from dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/PostgreSQLDatabase.java rename to jee/dao/src/main/java/fr/univtln/bruno/samples/jee91/dao/entitymanagersproducers/PostgreSQLDatabase.java diff --git a/jee/dao/src/main/resources/META-INF/beans.xml b/jee/dao/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000000000000000000000000000000000..efd69bc2d38663ae2f69879265843f8ff04aac04 --- /dev/null +++ b/jee/dao/src/main/resources/META-INF/beans.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans 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/beans_3_0.xsd" + bean-discovery-mode="all"> +</beans> \ No newline at end of file diff --git a/jee/ear/pom.xml b/jee/ear/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..be6d22619290563f3a78034fb65df23eb4b08edd --- /dev/null +++ b/jee/ear/pom.xml @@ -0,0 +1,106 @@ +<?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"> + <parent> + <artifactId>jee9.1</artifactId> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <version>1.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>ear</artifactId> + <packaging>ear</packaging> + + <dependencies> + <dependency> + <groupId>jakarta.platform</groupId> + <artifactId>jakarta.jakartaee-api</artifactId> + </dependency> + <dependency> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>restApp</artifactId> + <version>1.0-SNAPSHOT</version> + <type>war</type> + </dependency> + <dependency> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>wsApp</artifactId> + <version>1.0-SNAPSHOT</version> + <type>war</type> + </dependency> + <dependency> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>jsf</artifactId> + <version>1.0-SNAPSHOT</version> + <type>war</type> + </dependency> + <dependency> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>business</artifactId> + <version>1.0-SNAPSHOT</version> + <type>ejb</type> + </dependency> + + <dependency> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>dao</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>common-persistence</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + + + </dependencies> + + <build> + <finalName>personManager</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-ear-plugin</artifactId> + <version>3.2.0</version> + <configuration> + <version>8</version> + <displayName>Person manager</displayName> + <!-- If I want maven to generate the application.xml, set this to true --> + <generateApplicationXml>true</generateApplicationXml> + <defaultLibBundleDir>lib/</defaultLibBundleDir> + <skinnyWars>true</skinnyWars> + <modules> + <webModule> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>restApp</artifactId> + <!--bundleFileName>restApp.war</bundleFileName--> + </webModule> + <webModule> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>jsf</artifactId> + <!--bundleFileName>jsf.war</bundleFileName--> + </webModule> + <webModule> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>wsApp</artifactId> + <!--bundleFileName>wsApp.war</bundleFileName--> + </webModule> + <ejbModule> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>business</artifactId> + <!--bundleFileName>business.jar</bundleFileName--> + </ejbModule> + <jarModule> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>common-persistence</artifactId> + <bundleDir>lib</bundleDir> + </jarModule> + </modules> + </configuration> + </plugin> + </plugins> + </build> + + +</project> \ No newline at end of file diff --git a/jee/jsf/pom.xml b/jee/jsf/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..356170b0f809a433ea7696b913b7ba11078d0528 --- /dev/null +++ b/jee/jsf/pom.xml @@ -0,0 +1,58 @@ +<?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"> + <parent> + <artifactId>jee9.1</artifactId> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <version>1.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>jsf</artifactId> + <packaging>war</packaging> + + <properties> + <primefaces.version>11.0.0-RC2</primefaces.version> + <all-themes.version>1.0.10</all-themes.version> + </properties> + + <dependencies> + <dependency> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>business</artifactId> + <version>1.0-SNAPSHOT</version> + <type>ejb</type> + <!--type>ejb-client</type--> + </dependency> + + <dependency> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>dao</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + </dependency> + + <dependency> + <groupId>org.primefaces</groupId> + <artifactId>primefaces</artifactId> + <version>${primefaces.version}</version> + <classifier>jakarta</classifier> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>3.3.2</version> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file diff --git a/jee/jsf/src/main/java/fr/univtln/bruno/jee91/jsf/AddPersonView.java b/jee/jsf/src/main/java/fr/univtln/bruno/jee91/jsf/AddPersonView.java new file mode 100644 index 0000000000000000000000000000000000000000..8aa8588bc36b1147c0083ce86add2e80a5337349 --- /dev/null +++ b/jee/jsf/src/main/java/fr/univtln/bruno/jee91/jsf/AddPersonView.java @@ -0,0 +1,35 @@ +package fr.univtln.bruno.jee91.jsf; + +import fr.univtln.bruno.samples.jee91.dao.Person; +import fr.univtln.bruno.samples.jee91.dao.PersonDAO; +import jakarta.faces.application.FacesMessage; +import jakarta.faces.context.FacesContext; +import jakarta.faces.view.ViewScoped; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import jakarta.transaction.Transactional; +import lombok.Getter; + +import java.io.Serializable; + +@Named +@ViewScoped +public class AddPersonView implements Serializable { + + private static final long serialVersionUID = 1L; + + @Inject + private transient PersonDAO personDAO; + + @Getter + private final Person newPerson = new Person(); + @Getter + private Person addedPerson = new Person(); + + @Transactional + public void addPerson() { + addedPerson = Person.builder().name(newPerson.getName()).build(); + personDAO.persist(addedPerson); + FacesContext.getCurrentInstance().addMessage("growl-id", new FacesMessage(FacesMessage.SEVERITY_INFO, "Person added", addedPerson.getName() + "(" + addedPerson.getUuid() + ")")); + } +} diff --git a/jee/jsf/src/main/java/fr/univtln/bruno/jee91/jsf/ViewPersonBean.java b/jee/jsf/src/main/java/fr/univtln/bruno/jee91/jsf/ViewPersonBean.java new file mode 100644 index 0000000000000000000000000000000000000000..75dab8e96c45709abfd94b305504362bfcf67bc5 --- /dev/null +++ b/jee/jsf/src/main/java/fr/univtln/bruno/jee91/jsf/ViewPersonBean.java @@ -0,0 +1,28 @@ +package fr.univtln.bruno.jee91.jsf; + +import fr.univtln.bruno.samples.jee91.dao.Person; +import fr.univtln.bruno.samples.jee91.dao.PersonDAO; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; +import jakarta.inject.Named; + +import java.util.List; + +@Named +@RequestScoped +public class ViewPersonBean { + + @Inject + PersonDAO personDAO; + + private final String message = "Hello"; + + public String getMessage() { + return this.message; + } + + public List<Person> getPersons() { + return personDAO.findAll(); + } + +} diff --git a/wsApp/src/main/resources/META-INF/log4j.properties b/jee/jsf/src/main/resources/META-INF/log4j.properties similarity index 100% rename from wsApp/src/main/resources/META-INF/log4j.properties rename to jee/jsf/src/main/resources/META-INF/log4j.properties diff --git a/jee/jsf/src/main/webapp/WEB-INF/beans.xml b/jee/jsf/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000000000000000000000000000000000000..efd69bc2d38663ae2f69879265843f8ff04aac04 --- /dev/null +++ b/jee/jsf/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans 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/beans_3_0.xsd" + bean-discovery-mode="all"> +</beans> \ No newline at end of file diff --git a/jee/jsf/src/main/webapp/WEB-INF/faces-config.xml b/jee/jsf/src/main/webapp/WEB-INF/faces-config.xml new file mode 100644 index 0000000000000000000000000000000000000000..c573714301d239cada20b40e4393e9b1a863af81 --- /dev/null +++ b/jee/jsf/src/main/webapp/WEB-INF/faces-config.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faces-config + 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-facesconfig_3_0.xsd" + version="3.0" +> + <!-- Your faces config here. --> +</faces-config> \ No newline at end of file diff --git a/jee/jsf/src/main/webapp/WEB-INF/web.xml b/jee/jsf/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..cffeb3b2ed648e1cbc8628e1be4c1f1cf89594df --- /dev/null +++ b/jee/jsf/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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_5_0.xsd" + version="5.0"> + + <!--context-param> + <param-name>jakarta.faces.PROJECT_STAGE</param-name> + <param-value>Development</param-value> + </context-param--> + + <servlet> + <servlet-name>Faces Servlet</servlet-name> + <servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> + <!--La servlet de JSF est configurée pour répondre à toutes les requêtes de fichiers XHTML--> + <servlet-mapping> + <servlet-name>Faces Servlet</servlet-name> + <url-pattern>*.xhtml</url-pattern> + </servlet-mapping> + + <session-config> + <session-timeout>30</session-timeout> + </session-config> + + <welcome-file-list> + <welcome-file>index.xhtml</welcome-file> + </welcome-file-list> + + <mime-mapping> + <extension>woff</extension> + <mime-type>application/font-woff</mime-type> + </mime-mapping> + <mime-mapping> + <extension>ttf</extension> + <mime-type>application/x-font-ttf</mime-type> + </mime-mapping> + + <mime-mapping> + <extension>eot</extension> + <mime-type>application/vnd.ms-fontobject</mime-type> + </mime-mapping> + +</web-app> \ No newline at end of file diff --git a/jee/jsf/src/main/webapp/addPerson.xhtml b/jee/jsf/src/main/webapp/addPerson.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..8ce3f48169039f606000618a1f3fbb7532cc8517 --- /dev/null +++ b/jee/jsf/src/main/webapp/addPerson.xhtml @@ -0,0 +1,21 @@ +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:p="http://primefaces.org/ui"> + +<h:head></h:head> + +<h:body> + <div class="card"> + <h:form> + <h3 class="p-mt-0">Add a person</h3> + <p:growl id="growl" for="growl-id" showDetail="true" skipDetailIfEqualsSummary="true"/> + <h:panelGrid columns="3" cellpadding="7"> + <p:outputLabel for="fieldName" value="Name"/> + <p:inputText id="fieldName" value="#{addPersonView.newPerson.name}"/> + <p:message for="fieldName"/> + <p:commandButton value="Save" ajax="false" icon="pi pi-check" validateClient="true" styleClass="p-mr-3" action="#{addPersonView.addPerson}"/> + </h:panelGrid> + </h:form> + </div> +</h:body> +</html> diff --git a/jee/jsf/src/main/webapp/index.xhtml b/jee/jsf/src/main/webapp/index.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..7d188464dc239fab1b7379cc19f73e55ebf4ac6f --- /dev/null +++ b/jee/jsf/src/main/webapp/index.xhtml @@ -0,0 +1,28 @@ +<!DOCTYPE html> + +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:p="http://primefaces.org/ui" + xml:lang="en"> + +<h:head> + <title>Person list</title> +</h:head> + +<h:body> + <h3 style="text-align: center"><h:outputText value="#{viewPersonBean.message}"/></h3> + + <div class="card"> + <p:dataTable var="person" value="#{viewPersonBean.persons}" lazy="true"> + <p:column headerText="UUID"> + <h:outputText value="#{person.uuid}"/> + </p:column> + + <p:column headerText="Name"> + <h:outputText value="#{person.name}"/> + </p:column> + </p:dataTable> + </div> + +</h:body> +</html> diff --git a/jee/jsf/src/main/webapp/test.xhtml b/jee/jsf/src/main/webapp/test.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..c854dabea51d0a48ce87247a67f7eb11df8aa95c --- /dev/null +++ b/jee/jsf/src/main/webapp/test.xhtml @@ -0,0 +1,12 @@ +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui"> + +<h:head> +</h:head> + +<h:body> + <p:spinner /> +</h:body> +</html> \ No newline at end of file diff --git a/jee/pom.xml b/jee/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..dd29f03ee2c3631cb3e96f0cb95f64f832b6f429 --- /dev/null +++ b/jee/pom.xml @@ -0,0 +1,36 @@ +<?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"> + <parent> + <artifactId>parent</artifactId> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <version>1.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>jee9.1</artifactId> + <packaging>pom</packaging> + + <properties> + <failOnMissingWebXml>false</failOnMissingWebXml> + </properties> + + <modules> + <module>business</module> + <module>dao</module> + <module>jsf</module> + <module>restApp</module> + <module>wsApp</module> + <module>ear</module> + <module>common-persistence</module> + </modules> + + <dependencies> + <dependency> + <groupId>jakarta.platform</groupId> + <artifactId>jakarta.jakartaee-api</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> + +</project> \ No newline at end of file diff --git a/restApp/pom.xml b/jee/restApp/pom.xml similarity index 89% rename from restApp/pom.xml rename to jee/restApp/pom.xml index c642a31ed0c27f98aa14cab0463e65a50df8c288..a8195afc1b03a13f4234d2791eb157f79c69d729 100644 --- a/restApp/pom.xml +++ b/jee/restApp/pom.xml @@ -16,6 +16,7 @@ <groupId>fr.univtln.bruno.samples.jee91</groupId> <artifactId>business</artifactId> <version>1.0-SNAPSHOT</version> + <type>ejb</type> <!--type>ejb-client</type--> </dependency> @@ -29,11 +30,6 @@ <groupId>jakarta.platform</groupId> <artifactId>jakarta.jakartaee-api</artifactId> </dependency> - <dependency> - <groupId>org.eclipse.microprofile</groupId> - <artifactId>microprofile</artifactId> - <type>pom</type> - </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> diff --git a/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/JAXRSConfiguration.java b/jee/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/JAXRSConfiguration.java similarity index 85% rename from restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/JAXRSConfiguration.java rename to jee/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/JAXRSConfiguration.java index ece5bca64f1f17fcfebc60078f3ad54573fa6e56..5e8e933a80afc176a4784d0f0af77724005c9064 100644 --- a/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/JAXRSConfiguration.java +++ b/jee/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/JAXRSConfiguration.java @@ -4,7 +4,7 @@ package fr.univtln.bruno.samples.jee91.rs; import jakarta.ws.rs.ApplicationPath; import jakarta.ws.rs.core.Application; -@ApplicationPath("resources") +@ApplicationPath("/") public class JAXRSConfiguration extends Application { } \ No newline at end of file diff --git a/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/SampleResource.java b/jee/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/SampleResource.java similarity index 91% rename from restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/SampleResource.java rename to jee/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/SampleResource.java index d0feb963ef9d65a0055969cff4203d3647940060..63379567b154ea0efb082c7ac07bd825b713c8c8 100644 --- a/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/SampleResource.java +++ b/jee/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/SampleResource.java @@ -6,19 +6,19 @@ import fr.univtln.bruno.samples.jee91.dao.Person; import fr.univtln.bruno.samples.jee91.dao.PersonDAO; import fr.univtln.bruno.samples.jee91.ejb.Hello; import fr.univtln.bruno.samples.jee91.ejb.qualifiers.SpokenLanguage; +import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; import jakarta.transaction.Transactional; import jakarta.ws.rs.*; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; -import org.eclipse.microprofile.config.inject.ConfigProperty; import java.util.List; import java.util.Map; import java.util.UUID; +@RequestScoped @Path("sample") -//@Stateless @Produces({MediaType.APPLICATION_JSON,MediaType.TEXT_XML}) public class SampleResource { @@ -32,9 +32,7 @@ public class SampleResource { @Inject PersonDAO personDAO; - @Inject - @ConfigProperty(name = "message") - private String message; + private final String message = "Hello"; @GET public Response message() { diff --git a/jee/restApp/src/main/webapp/WEB-INF/beans.xml b/jee/restApp/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000000000000000000000000000000000000..efd69bc2d38663ae2f69879265843f8ff04aac04 --- /dev/null +++ b/jee/restApp/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans 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/beans_3_0.xsd" + bean-discovery-mode="all"> +</beans> \ No newline at end of file diff --git a/restApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java b/jee/restApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java similarity index 100% rename from restApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java rename to jee/restApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java diff --git a/wsApp/pom.xml b/jee/wsApp/pom.xml similarity index 98% rename from wsApp/pom.xml rename to jee/wsApp/pom.xml index 239ed116a5eda283c95616a6f747f52cff95b4a8..ef1b6d125d5964557defd92ff5b58db4f377b6c9 100644 --- a/wsApp/pom.xml +++ b/jee/wsApp/pom.xml @@ -16,6 +16,7 @@ <groupId>fr.univtln.bruno.samples.jee91</groupId> <artifactId>business</artifactId> <version>1.0-SNAPSHOT</version> + <type>ejb</type> <!--type>ejb-client</type--> </dependency> diff --git a/wsApp/src/main/java/fr/univtln/bruno/samples/jee91/ws/WSServer.java b/jee/wsApp/src/main/java/fr/univtln/bruno/samples/jee91/ws/WSServer.java similarity index 100% rename from wsApp/src/main/java/fr/univtln/bruno/samples/jee91/ws/WSServer.java rename to jee/wsApp/src/main/java/fr/univtln/bruno/samples/jee91/ws/WSServer.java diff --git a/wsClient/src/main/resources/log4j.properties b/jee/wsApp/src/main/resources/META-INF/log4j.properties similarity index 100% rename from wsClient/src/main/resources/log4j.properties rename to jee/wsApp/src/main/resources/META-INF/log4j.properties diff --git a/wsApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java b/jee/wsApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java similarity index 100% rename from wsApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java rename to jee/wsApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java diff --git a/pom.xml b/pom.xml index 9397a8411f6897eaa7fb395295c1f18dcee08078..2890842f2fbb5e8bc58e34827130fb38c12d4d60 100644 --- a/pom.xml +++ b/pom.xml @@ -3,31 +3,25 @@ <modelVersion>4.0.0</modelVersion> <groupId>fr.univtln.bruno.samples.jee91</groupId> - <artifactId>jee9.1</artifactId> + <artifactId>parent</artifactId> <version>1.0-SNAPSHOT</version> - + <packaging>pom</packaging> <modules> - <module>business</module> - <module>restApp</module> - <module>wsApp</module> - <module>dao</module> - <module>wsClient</module> <module>entites</module> <module>utils</module> + <module>jee</module> + <module>websocketClient</module> </modules> - <packaging>pom</packaging> + <properties> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> - <failOnMissingWebXml>false</failOnMissingWebXml> + <jakarta.jakartaee-api.version>9.0.0</jakarta.jakartaee-api.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - - <jakarta.jakartaee-api.version>9.1.0</jakarta.jakartaee-api.version> - <microprofile.version>3.0</microprofile.version> - <junit-jupiter.version>5.8.1</junit-jupiter.version> + <junit-jupiter.version>5.8.2</junit-jupiter.version> </properties> <dependencyManagement> @@ -38,13 +32,6 @@ <version>${jakarta.jakartaee-api.version}</version> <scope>provided</scope> </dependency> - <dependency> - <groupId>org.eclipse.microprofile</groupId> - <artifactId>microprofile</artifactId> - <version>${microprofile.version}</version> - <type>pom</type> - <scope>provided</scope> - </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> @@ -54,7 +41,7 @@ <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> - <version>1.18.20</version> + <version>1.18.22</version> <scope>compile</scope> </dependency> <dependency> @@ -68,15 +55,62 @@ <build> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> + <configuration> + <showDeprecation>true</showDeprecation> + <showWarnings>true</showWarnings> + </configuration> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.2</version> </plugin> - + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <version>3.0.0</version> + <executions> + <execution> + <id>enforce-maven</id> + <goals> + <goal>enforce</goal> + </goals> + <configuration> + <rules> + <requireMavenVersion> + <version>3.8</version> + </requireMavenVersion> + <dependencyConvergence/> + </rules> + </configuration> + </execution> + </executions> + </plugin> </plugins> + + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>3.1.0</version> + </plugin> + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <version>3.0.0-M1</version> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <version>3.0.0-M1</version> + </plugin> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <version>3.9.1</version> + </plugin> + </plugins> + </pluginManagement> </build> </project> \ No newline at end of file diff --git a/restApp/src/main/resources/META-INF/microprofile-config.properties b/restApp/src/main/resources/META-INF/microprofile-config.properties deleted file mode 100644 index 9ab849fb222baec06d45967782915033c1b18c24..0000000000000000000000000000000000000000 --- a/restApp/src/main/resources/META-INF/microprofile-config.properties +++ /dev/null @@ -1 +0,0 @@ -message=Hello World Jakarta EE 9.1 \ No newline at end of file diff --git a/restApp/src/main/webapp/WEB-INF/beans.xml b/restApp/src/main/webapp/WEB-INF/beans.xml deleted file mode 100644 index f8e254275530a1d3ce18bae65334cd014bf184c4..0000000000000000000000000000000000000000 --- a/restApp/src/main/webapp/WEB-INF/beans.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans 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/beans_2_0.xsd" - bean-discovery-mode="all"> -</beans> \ No newline at end of file diff --git a/rules.xml b/rules.xml new file mode 100644 index 0000000000000000000000000000000000000000..571d5df6f2f051ffa7b30b47be2bde00e3cdc54f --- /dev/null +++ b/rules.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ruleset xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" comparisonMethod="maven" xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd"> + <ignoreVersions> + <!-- Ignore Alpha's, Beta's, release candidates and milestones --> + <ignoreVersion type="regex">(?i).*Alpha(?:-?\d+)?</ignoreVersion> + <ignoreVersion type="regex">(?i).*a(?:-?\d+)?</ignoreVersion> + <ignoreVersion type="regex">(?i).*Beta(?:-?\d+)?</ignoreVersion> + <ignoreVersion type="regex">(?i).*-B(?:-?\d+)?</ignoreVersion> + <ignoreVersion type="regex">(?i).*RC(?:-?\d+)?</ignoreVersion> + <ignoreVersion type="regex">(?i).*CR(?:-?\d+)?</ignoreVersion> + <ignoreVersion type="regex">(?i).*M(?:-?\d+)?</ignoreVersion> + <ignoreVersion type="regex">.*jre[0-9]+$</ignoreVersion> + </ignoreVersions> + <rules> + </rules> +</ruleset> diff --git a/server.xml b/server.xml deleted file mode 100644 index 7882a0fb550ebc84e56b0825f8ad6464e6b86537..0000000000000000000000000000000000000000 --- a/server.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<server description="new server"> - - <featureManager> - <feature>javaee-9.1</feature> - <feature>microProfile-3.0</feature> - </featureManager> - - <httpEndpoint id="defaultHttpEndpoint" httpPort="9080" httpsPort="9443"/> - - <quickStartSecurity userName="duke" userPassword="dukeduke"/> -</server> \ No newline at end of file diff --git a/utils/pom.xml b/utils/pom.xml index 16c46ecd64bc9ce00a4d30d5c01e68ee5ff5dce3..db2f4057da4f9738636357dcda2fd5f9540fee04 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -2,7 +2,7 @@ <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"> <parent> - <artifactId>jee9.1</artifactId> + <artifactId>parent</artifactId> <groupId>fr.univtln.bruno.samples.jee91</groupId> <version>1.0-SNAPSHOT</version> </parent> diff --git a/wsClient/pom.xml b/websocketClient/pom.xml similarity index 78% rename from wsClient/pom.xml rename to websocketClient/pom.xml index e09ffbe737e4ef75ace4864b58689ff5c8af4cbc..2773146a4ec0d48fd10395e72fee1c763165a829 100644 --- a/wsClient/pom.xml +++ b/websocketClient/pom.xml @@ -2,7 +2,7 @@ <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"> <parent> - <artifactId>jee9.1</artifactId> + <artifactId>parent</artifactId> <groupId>fr.univtln.bruno.samples.jee91</groupId> <version>1.0-SNAPSHOT</version> </parent> @@ -25,12 +25,6 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </dependency> - <dependency> - <groupId>fr.univtln.bruno.samples.jee91</groupId> - <artifactId>utils</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>provided</scope> - </dependency> </dependencies> </project> \ No newline at end of file diff --git a/wsClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java b/websocketClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java similarity index 68% rename from wsClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java rename to websocketClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java index 71ab0208648b55c1563ae275a2e53273e1e0e559..3ed86072a8b712266064df3c3a186a1b4103f61f 100644 --- a/wsClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java +++ b/websocketClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java @@ -12,7 +12,6 @@ import java.util.Map; @ClientEndpoint @Slf4j public class WsClient { - Session userSession = null; private MessageHandler messageHandler; private Map<String, Object> properties; @@ -20,18 +19,18 @@ public class WsClient { public WsClient(URI endpointURI) { try { WebSocketContainer container = ContainerProvider.getWebSocketContainer(); - - String pathtoCert = getClass().getClassLoader().getResource("mycert-pub.jks").toURI().getPath(); - + var url = getClass().getClassLoader().getResource("mycert-pub.jks"); System.getProperties().put("javax.net.debug", "ssl"); - System.getProperties().put(SSLContextConfigurator.KEY_STORE_FILE, pathtoCert); - System.getProperties().put(SSLContextConfigurator.KEY_STORE_TYPE, "JKS"); - System.getProperties().put(SSLContextConfigurator.TRUST_STORE_FILE, pathtoCert); - System.getProperties().put(SSLContextConfigurator.TRUST_STORE_TYPE, "JKS"); - System.getProperties().put(SSLContextConfigurator.KEY_STORE_PASSWORD, "storepass"); - System.getProperties().put(SSLContextConfigurator.TRUST_STORE_PASSWORD, "storepass"); + if (url != null) { + String pathtoCert = url.toURI().getPath(); + System.getProperties().put(SSLContextConfigurator.KEY_STORE_FILE, pathtoCert); + System.getProperties().put(SSLContextConfigurator.KEY_STORE_TYPE, "JKS"); + System.getProperties().put(SSLContextConfigurator.TRUST_STORE_FILE, pathtoCert); + System.getProperties().put(SSLContextConfigurator.TRUST_STORE_TYPE, "JKS"); + System.getProperties().put(SSLContextConfigurator.KEY_STORE_PASSWORD, "storepass"); + System.getProperties().put(SSLContextConfigurator.TRUST_STORE_PASSWORD, "storepass"); + } final SSLContextConfigurator defaultConfig = new SSLContextConfigurator(); - defaultConfig.retrieve(System.getProperties()); container.connectToServer(this, endpointURI); } catch (Exception e) { @@ -41,10 +40,8 @@ public class WsClient { public static void main(String[] args) { try { - URI uri = new URI("ws://localhost:8686/wsApp-1.0-SNAPSHOT/hellows"); - //URI uri = new URI("wss://localhost:8888/wsapp/wsApp-1.0-SNAPSHOT/hellows"); - log.info("Connecting to "+uri); - final WsClient clientEndPoint = new WsClient(uri); + + final WsClient clientEndPoint = new WsClient(new URI("ws://localhost:8686/wsApp/hellows")); clientEndPoint.sendMessage("Hello 1 !"); Thread.sleep(5000); clientEndPoint.sendMessage("Hello 2 !"); diff --git a/websocketClient/src/main/resources/log4j.properties b/websocketClient/src/main/resources/log4j.properties new file mode 100644 index 0000000000000000000000000000000000000000..c667f1b0a54f2545b984f7bcfa4370762ee732e6 --- /dev/null +++ b/websocketClient/src/main/resources/log4j.properties @@ -0,0 +1,17 @@ +log4j.rootLogger=debug, stdout, R + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout + +# Pattern to output the caller's file name and line number. +log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n + +log4j.appender.R=org.apache.log4j.RollingFileAppender +log4j.appender.R.File=wsClient.log + +log4j.appender.R.MaxFileSize=100KB +# Keep one backup file +log4j.appender.R.MaxBackupIndex=1 + +log4j.appender.R.layout=org.apache.log4j.PatternLayout +log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n \ No newline at end of file diff --git a/websocketClient/src/main/resources/updateKeystore.sh b/websocketClient/src/main/resources/updateKeystore.sh new file mode 100644 index 0000000000000000000000000000000000000000..afa03d8055a0d3c40bc588b713b61d6685b42a95 --- /dev/null +++ b/websocketClient/src/main/resources/updateKeystore.sh @@ -0,0 +1,3 @@ +#!/bin/bash +openssl s_client -showcerts -servername localhost -connect localhost:8181 </dev/null | openssl x509 -outform DER > localhost.der +keytool -import -noprompt -trustcacerts -storepass storepass -alias localhost -keystore mycert-pub.jks -file localhost.der diff --git a/wsApp/src/main/resources/META-INF/beans.xml b/wsApp/src/main/resources/META-INF/beans.xml deleted file mode 100644 index f8e254275530a1d3ce18bae65334cd014bf184c4..0000000000000000000000000000000000000000 --- a/wsApp/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans 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/beans_2_0.xsd" - bean-discovery-mode="all"> -</beans> \ No newline at end of file diff --git a/wsApp/src/main/resources/META-INF/microprofile-config.properties b/wsApp/src/main/resources/META-INF/microprofile-config.properties deleted file mode 100644 index 9ab849fb222baec06d45967782915033c1b18c24..0000000000000000000000000000000000000000 --- a/wsApp/src/main/resources/META-INF/microprofile-config.properties +++ /dev/null @@ -1 +0,0 @@ -message=Hello World Jakarta EE 9.1 \ No newline at end of file diff --git a/wsApp/src/main/resources/META-INF/persistence.xml b/wsApp/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index e285a5f2e096fbcdae9923f731058155bdd13655..0000000000000000000000000000000000000000 --- a/wsApp/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<persistence version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/persistence" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"> - <persistence-unit name="myappPU" transaction-type="JTA"> - <jta-data-source>jdbc/h2-pool</jta-data-source> - <exclude-unlisted-classes>false</exclude-unlisted-classes> - </persistence-unit> -</persistence> \ No newline at end of file diff --git a/wsApp/src/main/webapp/WEB-INF/beans.xml b/wsApp/src/main/webapp/WEB-INF/beans.xml deleted file mode 100644 index f8e254275530a1d3ce18bae65334cd014bf184c4..0000000000000000000000000000000000000000 --- a/wsApp/src/main/webapp/WEB-INF/beans.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans 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/beans_2_0.xsd" - bean-discovery-mode="all"> -</beans> \ No newline at end of file diff --git a/wsClient/src/main/resources/localhost.pem b/wsClient/src/main/resources/localhost.pem deleted file mode 100644 index f5cf4d6816ae3f848362ca5d4a374bdbf789f43c..0000000000000000000000000000000000000000 --- a/wsClient/src/main/resources/localhost.pem +++ /dev/null @@ -1,76 +0,0 @@ -CONNECTED(00000003) ---- -Certificate chain - 0 s:C = CA, ST = QC, O = "Company, Inc.", CN = localhost - i:C = CA, ST = QC, O = "Company, Inc.", CN = localhost ------BEGIN CERTIFICATE----- -MIIDgzCCAmugAwIBAgIUHdOJDnnUPDhGWmol/SrWtsAQ/XwwDQYJKoZIhvcNAQEL -BQAwRjELMAkGA1UEBhMCQ0ExCzAJBgNVBAgMAlFDMRYwFAYDVQQKDA1Db21wYW55 -LCBJbmMuMRIwEAYDVQQDDAlsb2NhbGhvc3QwHhcNMjExMTMwMTUxNzI3WhcNMjIx -MTMwMTUxNzI3WjBGMQswCQYDVQQGEwJDQTELMAkGA1UECAwCUUMxFjAUBgNVBAoM -DUNvbXBhbnksIEluYy4xEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcN -AQEBBQADggEPADCCAQoCggEBAMP3bZcCPEgm+ruuz4VE7tFDnPk2ptDtZ4G/X6Mz -iYd9mlWirZNIfNOH1JKyhhSBD1UBKDFLZpReAeFAcoKhf1HThhJbWV8lQnT0ZDcy -DqdcSnc8uJou61QoInFGEChxl0auuJO0SvHH/nb2TfI6C5f0j01T4zc5xQ8BxM6t -liGvEO1FVfKSjti4RfK2xy6Ehe0Kd1RFu9pQGZjnRfso070R19QnXidynMFMaCWL -KVEkfkLYhJ3iLvot64kGoP1h9rwGTBQ1eNmW7i3VIexDlH+/l+iDUsifjYneWL8w -aAS0qMeDDVolcI67ZzgIs0EOm6RrJSG3hg9ymFY/p2ILKqcCAwEAAaNpMGcwHQYD -VR0OBBYEFDThVYdMf8xMlkh5yH/1DEs9/ix+MB8GA1UdIwQYMBaAFDThVYdMf8xM -lkh5yH/1DEs9/ix+MA8GA1UdEwEB/wQFMAMBAf8wFAYDVR0RBA0wC4IJbG9jYWxo -b3N0MA0GCSqGSIb3DQEBCwUAA4IBAQCqCVLMdT7DlHdeSa3ChNL42ZeM3V78kJ+a -W6VF8yQFTAMUJTrc+A7UJAxme52+Rcpo6DkS2GnyD2DKBiYdlIB8a+MQw6bF0PLK -wGnEoshUiiuG9n3VqKbNbm9xwhpfWFGtB++zhsuZoRPJwqkNEU3bnHLFIlkQw6V/ -k2jARehe0pmb6sllW0Xt89KKeTgkM4EJ+KwOxbTBVgmFMluST56m+PTScri7uEEw -U4ePM/EkpyNBK7GNWad9QT/6eqfq9yygmZrWMCCYbXl9eC0ReCvS4u/FNBO1XFRS -sgHzI2qFpGtD2lwj9NfS6GmHXj+eZ5qcbZ1bky7fa2byD4z3CFWy ------END CERTIFICATE----- ---- -Server certificate -subject=C = CA, ST = QC, O = "Company, Inc.", CN = localhost - -issuer=C = CA, ST = QC, O = "Company, Inc.", CN = localhost - ---- -No client certificate CA names sent -Peer signing digest: SHA256 -Peer signature type: RSA-PSS -Server Temp Key: X25519, 253 bits ---- -SSL handshake has read 1564 bytes and written 404 bytes -Verification error: self signed certificate ---- -New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384 -Server public key is 2048 bit -Secure Renegotiation IS supported -Compression: NONE -Expansion: NONE -No ALPN negotiated -SSL-Session: - Protocol : TLSv1.2 - Cipher : ECDHE-RSA-AES256-GCM-SHA384 - Session-ID: 00887A0141C1783E84BEA155C250CB175BA288FB7B6274395D1198B9ECF7E4B3 - Session-ID-ctx: - Master-Key: DABD1C15F909CB7054212775001ADBEF58A3F5ECDDA8F79E88DB09123AE80E36A5EBC56434C76584996814E9B37BD40E - PSK identity: None - PSK identity hint: None - SRP username: None - TLS session ticket lifetime hint: 300 (seconds) - TLS session ticket: - 0000 - a6 b0 1a a6 bc 96 3b 4f-73 33 f5 c7 82 d4 3a 1c ......;Os3....:. - 0010 - 01 39 52 47 af 83 b6 95-d7 df fa 38 2e 18 37 f0 .9RG.......8..7. - 0020 - 69 1a 34 e1 c7 68 06 1d-2c 45 90 c6 85 96 30 c0 i.4..h..,E....0. - 0030 - 6b fe 82 3f d5 b8 95 71-15 33 b2 50 3a f7 e6 20 k..?...q.3.P:.. - 0040 - 0d 55 b7 35 1b 81 58 aa-b6 61 c7 19 73 0c 9c d6 .U.5..X..a..s... - 0050 - fe 30 1c 08 52 78 96 1d-3b fa a7 5b d7 19 c7 66 .0..Rx..;..[...f - 0060 - a7 5f f8 44 5b 07 65 bf-28 a6 ed 59 6a 4e f3 38 ._.D[.e.(..YjN.8 - 0070 - 23 1a 4e e9 0c ac c9 a8-3f 2e 1f 5b c4 67 e2 b8 #.N.....?..[.g.. - 0080 - cb b6 47 8d f2 98 32 9e-11 d1 00 ea dd d5 39 06 ..G...2.......9. - 0090 - 2e 5e 69 56 14 7a 68 da-0b c5 87 6f 97 79 d7 f9 .^iV.zh....o.y.. - 00a0 - 19 bd 6a 3b 29 f2 85 0d-e0 f5 9f ae 10 9b 1e de ..j;)........... - 00b0 - 64 a9 b6 73 2a 42 f7 4e-fb 48 3d 2b 66 04 99 c6 d..s*B.N.H=+f... - - Start Time: 1638285476 - Timeout : 7200 (sec) - Verify return code: 18 (self signed certificate) - Extended master secret: yes ---- diff --git a/wsClient/src/main/resources/nginx.pem b/wsClient/src/main/resources/nginx.pem deleted file mode 100644 index 4eee8769b7a785a12f8a5395226ee2532af24527..0000000000000000000000000000000000000000 --- a/wsClient/src/main/resources/nginx.pem +++ /dev/null @@ -1,76 +0,0 @@ -CONNECTED(00000003) ---- -Certificate chain - 0 s:C = CA, ST = QC, O = "Company, Inc.", CN = mydomain.com - i:C = CA, ST = QC, O = "Company, Inc.", CN = mydomain.com ------BEGIN CERTIFICATE----- -MIIDjDCCAnSgAwIBAgIUJan3Qt3PXOYD3BzfDTC5lRNwhn8wDQYJKoZIhvcNAQEL -BQAwSTELMAkGA1UEBhMCQ0ExCzAJBgNVBAgMAlFDMRYwFAYDVQQKDA1Db21wYW55 -LCBJbmMuMRUwEwYDVQQDDAxteWRvbWFpbi5jb20wHhcNMjExMTMwMTQ0MjIzWhcN -MjIxMTMwMTQ0MjIzWjBJMQswCQYDVQQGEwJDQTELMAkGA1UECAwCUUMxFjAUBgNV -BAoMDUNvbXBhbnksIEluYy4xFTATBgNVBAMMDG15ZG9tYWluLmNvbTCCASIwDQYJ -KoZIhvcNAQEBBQADggEPADCCAQoCggEBAL85ZcUiF5UMY1CFlrr3kDuejriRcMRz -0CCo7qXecSzBX8qKa2yJi5z/nXebODdf6Nx1F9lAWqGKro8ADplWTe/H5GnOccgp -DvAcYoa3GZt1T26aLXISkF4ebPoEwMS+8Dgo/IOdgXct+ZydSCIER0RBSQmCDSWi -khOc3rk+yLHwDpjdFPgOA/XCJ7DFLceeoBv9xPr1uVgQC7iS5CHhG+FRSQUH0dVW -eAeXar0wimynb3YNMaFWrctiJcgQjJV8DoUqpOSGGcdApFTqizG+Xf3aGpDLnI/z -lQx55VeC+qHWG/vtC3Qf8aZpKrrEjHr+wGQ0hk5aRvdxJxhM7eTmpR0CAwEAAaNs -MGowHQYDVR0OBBYEFHWFv4j2EKNN/CTcO2Ifij7urVt6MB8GA1UdIwQYMBaAFHWF -v4j2EKNN/CTcO2Ifij7urVt6MA8GA1UdEwEB/wQFMAMBAf8wFwYDVR0RBBAwDoIM -bXlkb21haW4uY29tMA0GCSqGSIb3DQEBCwUAA4IBAQA0qjLx0XqNvVqAM4W/R1CQ -GSwDb5enOxmOuv9TTxHWOAPKBPTz1Uucpx4PZwOqGKzJj0XmwE3zNT+ciaalZPWE -46vz98ACOUaZXkDO4/f0b8vzEORHHn96PFsrYlGqf4GNeQ3R3hzcXwz2Mr94oknF -fz6roe1mda/j3bIG1FGX2xpEkobhCYm6Gy579wx61R1vfwcMrVJjaECWlVkuQh0z -lmAdfIt909j5dgoem77DnhLFsSQgP6rS6EPcdXJ8Sv3YUy2BMZqFZVwsG9mQ0ogz -Xo8pRHAo65fdY9ovNNZZPqUGL5C27KEkzoVxQsV8E19Ugy3EulttTKFxCiTNVJZa ------END CERTIFICATE----- ---- -Server certificate -subject=C = CA, ST = QC, O = "Company, Inc.", CN = mydomain.com - -issuer=C = CA, ST = QC, O = "Company, Inc.", CN = mydomain.com - ---- -No client certificate CA names sent -Peer signing digest: SHA256 -Peer signature type: RSA-PSS -Server Temp Key: X25519, 253 bits ---- -SSL handshake has read 1573 bytes and written 404 bytes -Verification error: self signed certificate ---- -New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384 -Server public key is 2048 bit -Secure Renegotiation IS supported -Compression: NONE -Expansion: NONE -No ALPN negotiated -SSL-Session: - Protocol : TLSv1.2 - Cipher : ECDHE-RSA-AES256-GCM-SHA384 - Session-ID: E46AEBDBFB0B64A0073F313F3CC30BE529584156F41385B98AE98F6FEA483681 - Session-ID-ctx: - Master-Key: 3FC2662A594E3D5A6293903BE0C8F7FCF45C993B2BF679D4309A9857C35082558D100A7379E73ACFF4A84AE2BEEDAD87 - PSK identity: None - PSK identity hint: None - SRP username: None - TLS session ticket lifetime hint: 300 (seconds) - TLS session ticket: - 0000 - 76 1a 1b 15 00 e0 cb 71-0a 27 de 9c f4 03 17 a4 v......q.'...... - 0010 - b5 12 bc f1 ec a1 a6 b6-0d ee 12 af 1e 1d 9e 99 ................ - 0020 - 84 ec ce 6b e3 77 1a 5a-f4 35 d6 bb 7e c5 5b 0e ...k.w.Z.5..~.[. - 0030 - 40 6e 78 04 22 96 01 43-e2 18 f6 62 f3 d9 21 0c @nx."..C...b..!. - 0040 - 0c 07 5c da e5 07 ec a5-f2 fe 0b de db 9c 80 5d ..\............] - 0050 - 16 26 dd e5 62 da e0 8a-6f 05 13 bc 78 8c 6a 10 .&..b...o...x.j. - 0060 - 41 32 5d c9 c6 d1 75 38-34 9e 33 98 79 24 68 10 A2]...u84.3.y$h. - 0070 - ed e6 f6 3a 94 af ae 99-de d7 57 0d f4 40 26 36 ...:......W..@&6 - 0080 - 92 75 45 ae 85 9e 8e b9-07 63 60 df 24 bd a3 28 .uE......c`.$..( - 0090 - 19 3f 86 03 01 50 38 eb-2c 96 12 9c 3a b2 dc 9e .?...P8.,...:... - 00a0 - d8 ec 43 a8 d6 27 c3 e0-32 da 35 ee 9c fa 71 e3 ..C..'..2.5...q. - 00b0 - f6 e8 b7 59 04 42 19 f7-29 78 73 47 7e 55 66 c1 ...Y.B..)xsG~Uf. - - Start Time: 1638285012 - Timeout : 7200 (sec) - Verify return code: 18 (self signed certificate) - Extended master secret: yes ----