Jetty embedding in progress

This commit is contained in:
Claude Brisson
2023-05-13 08:28:28 +02:00
parent a28f623eee
commit 1bba7a11f1
7 changed files with 31 additions and 17 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
target
docker/data
.idea
docker/.env

View File

@@ -18,21 +18,30 @@
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
</dependency>
<!--
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-javax-server</artifactId>
<version>${jetty.version}</version>
</dependency>
-->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jndi</artifactId>
<version>${jetty.version}</version>
</dependency>
<!--
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
-->
</dependencies>
<build>
<plugins>

View File

@@ -21,6 +21,7 @@ package org.jeudego.pairgoth.container;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -54,7 +55,13 @@ public class ServerMain
{
Server server = new Server(8080);
WebAppContext context = new WebAppContext();
WebAppContext context = new WebAppContext() {
@Override
public boolean isServerResource(String name, URL url)
{
return super.isServerResource(name, url) || url.getFile().contains("/WEB-INF/jetty-server/");
}
};
context.setContextPath("/");
switch (getOperationalMode())

View File

@@ -1,8 +1,2 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
org.eclipse.jetty.LEVEL=INFO
# Squelch noisy logging
org.eclipse.jetty.websocket.jsr356.JsrBasicRemote.LEVEL=WARN
# org.eclipse.jetty.annotations.LEVEL=DEBUG
# org.eclipse.jetty.websocket.LEVEL=DEBUG

View File

@@ -30,9 +30,8 @@
<license.plugin.version>4.2</license.plugin.version>
<servlet.api.version>4.0.4</servlet.api.version>
<websocket.api.version>1.1.2</websocket.api.version>
<jetty.version>10.0.15</jetty.version>
<slf4j.version>2.0.0-alpha3</slf4j.version>
<slf4j.version>2.0.7</slf4j.version>
</properties>
<modules>

View File

@@ -111,7 +111,7 @@
<dependency>
<groupId>com.republicate</groupId>
<artifactId>webapp-slf4j-logger</artifactId>
<version>1.6</version>
<version>3.0</version>
<scope>runtime</scope>
</dependency>
<!--

View File

@@ -4,9 +4,11 @@ import com.republicate.mailer.SmtpLoop
import org.apache.commons.lang3.tuple.Pair
import org.slf4j.LoggerFactory
import java.io.IOException
import java.lang.IllegalAccessError
import java.security.SecureRandom
import java.security.cert.X509Certificate
import java.util.*
import java.util.IllegalFormatCodePointException
import javax.net.ssl.*
import javax.servlet.*
import javax.servlet.annotation.WebListener
@@ -48,8 +50,7 @@ class WebappManager : ServletContextListener, ServletContextAttributeListener, H
/* ServletContextListener interface */
override fun contextInitialized(sce: ServletContextEvent) {
// overcome a Jetty's bug (v9.4.10.v20180503) whereas if a @WebListener is also listed in the descriptor
// it will be instanciated twice...
if (1==1) throw IllegalAccessError("sgdfgsdfg");
context = sce.servletContext
logger.info("---------- Starting Web Application ----------")
context.setAttribute("manager", this)