Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Jetty 12 #1667

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up JDK 11
- name: Set up JDK 17
jvermillard marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: maven

Expand Down
2 changes: 1 addition & 1 deletion .jenkins/ci.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pipeline {
agent any
tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk11-latest'
jdk 'temurin-jdk17-latest'
}
options {
timeout (time: 30, unit: 'MINUTES')
Expand Down
2 changes: 1 addition & 1 deletion .jenkins/nightly.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pipeline {
agent any
tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk11-latest'
jdk 'temurin-jdk17-latest'
}
options {
timeout (time: 60, unit: 'MINUTES')
Expand Down
2 changes: 1 addition & 1 deletion .jenkins/release.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pipeline {
}
tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk11-latest'
jdk 'temurin-jdk17-latest'
}
options {
timeout (time: 30, unit: 'MINUTES')
Expand Down
2 changes: 1 addition & 1 deletion .jenkins/test.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pipeline {
}
tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk11-latest'
jdk 'temurin-jdk17-latest'
}
options {
timeout (time: 30, unit: 'MINUTES')
Expand Down
2 changes: 1 addition & 1 deletion .jenkins/weekly.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pipeline {
agent any
tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk11-latest'
jdk 'temurin-jdk17-latest'
}
options {
timeout (time: 30, unit: 'MINUTES')
Expand Down
7 changes: 0 additions & 7 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
# About Servers Demos
# =========================

# Backend
# ------------
# No affected by this vulnerability as we don't use HttpUri component directly
# See : https://github.com/jetty/jetty.project/pull/12012#issuecomment-2427097199
# Could be remove after : https://github.com/eclipse-leshan/leshan/issues/1662
CVE-2024-6763

# Frontend
# ------------
# No affected by this vulnerability : we don't use parseHTML and close tag correctly.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
Leshan provides libraries which help people to develop their own Lightweight M2M server and client.
The project also provides a client, a server and a bootstrap server demonstration as an example of the Leshan API and for testing purpose.

| LWM2M Version <br> Targeted | Leshan <br> Version | Minimal <br> Java Version | Development <br> State | Build Status | Standalone <br> Demos |
| LWM2M Version <br> Targeted | Leshan <br> Version | Minimal <br> Java Version | Development <br> State | Build Status | Standalone <br> Demos |
| - | - | - | - | - | - |
| [v1.0.x](https://github.com/eclipse/leshan/wiki/Lightweight-M2M-Specification#lightweight-m2m-v10x) | [v1.x](https://github.com/eclipse/leshan/tree/1.x) <br/> [Supported features](https://github.com/eclipse/leshan/wiki/LWM2M-Supported-features) | Java 7 | stable released | [jenkins-1.x](https://ci.eclipse.org/leshan/job/leshan-ci/job/1.x/) | [server-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/1.x/lastSuccessfulBuild/artifact/leshan-demo-server.jar)<br/> [client-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/1.x/lastSuccessfulBuild/artifact/leshan-demo-client.jar) <br/> [bsserver-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/1.x/lastSuccessfulBuild/artifact/leshan-demo-bsserver.jar) |
| [**v1.1.x**](https://github.com/eclipse/leshan/wiki/Lightweight-M2M-Specification#lightweight-m2m-v11x)| [**v2.x** (master)](https://github.com/eclipse/leshan/tree/master) <br/> [Supported features](https://github.com/eclipse/leshan/wiki/LWM2M-1.1-supported-features) | Java 8 | **in development** |[jenkins-master](https://ci.eclipse.org/leshan/job/leshan-ci/job/master/) | [server-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/master/lastSuccessfulBuild/artifact/leshan-demo-server.jar)<br/> [client-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/master/lastSuccessfulBuild/artifact/leshan-demo-client.jar) <br/> [bsserver-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/master/lastSuccessfulBuild/artifact/leshan-demo-bsserver.jar) |
| [v1.0.x](https://github.com/eclipse/leshan/wiki/Lightweight-M2M-Specification#lightweight-m2m-v10x) | [v1.x](https://github.com/eclipse/leshan/tree/1.x) <br/> [Supported features](https://github.com/eclipse/leshan/wiki/LWM2M-Supported-features) | Java 7 ([more details](https://github.com/eclipse-leshan/leshan/tree/1.x/documentation/Requirement.md)) | stable released | [jenkins-1.x](https://ci.eclipse.org/leshan/job/leshan-ci/job/1.x/) | [server-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/1.x/lastSuccessfulBuild/artifact/leshan-demo-server.jar)<br/> [client-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/1.x/lastSuccessfulBuild/artifact/leshan-demo-client.jar) <br/> [bsserver-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/1.x/lastSuccessfulBuild/artifact/leshan-demo-bsserver.jar) |
| [**v1.1.x**](https://github.com/eclipse/leshan/wiki/Lightweight-M2M-Specification#lightweight-m2m-v11x)| [**v2.x** (master)](https://github.com/eclipse/leshan/tree/master) <br/> [Supported features](https://github.com/eclipse/leshan/wiki/LWM2M-1.1-supported-features) | Java 8 ([more details](./documentation/Requirement.md)) | **in development** |[jenkins-master](https://ci.eclipse.org/leshan/job/leshan-ci/job/master/) | [server-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/master/lastSuccessfulBuild/artifact/leshan-demo-server.jar)<br/> [client-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/master/lastSuccessfulBuild/artifact/leshan-demo-client.jar) <br/> [bsserver-demo](https://ci.eclipse.org/leshan/job/leshan-ci/job/master/lastSuccessfulBuild/artifact/leshan-demo-bsserver.jar) |


Release (stable and milestones) are available on [maven central](https://search.maven.org/search?q=org.eclipse.leshan).
Expand Down
14 changes: 14 additions & 0 deletions documentation/Requirement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Minimal Requirement for Leshan.

## Leshan 2.x

| Component | Minimal Requirement |
| - | - |
| Maven Build | Maven 3.6.0 </br> Java 17|
| Leshan library | Java 8 |
| Leshan client demo | Java 8 |
| Leshan server demo | Java 17 (because of [jetty 12](https://jetty.org/docs/jetty/12/index.html) dependency) |
| Leshan bsserver demo | Java 17 (because of [jetty 12](https://jetty.org/docs/jetty/12/index.html) dependency) |

## Leshan 1.x
see [Leshan 1.x documentation](https://github.com/eclipse-leshan/leshan/tree/1.x/documentation/Requirement.md).
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import org.eclipse.californium.core.config.CoapConfig;
import org.eclipse.californium.elements.config.Configuration;
import org.eclipse.californium.scandium.config.DtlsConfig;
import org.eclipse.jetty.ee10.servlet.DefaultServlet;
import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.leshan.bsserver.EditableBootstrapConfigStore;
import org.eclipse.leshan.bsserver.LeshanBootstrapServer;
import org.eclipse.leshan.bsserver.LeshanBootstrapServerBuilder;
Expand Down Expand Up @@ -217,18 +217,17 @@ private static Server createJettyServer(LeshanBsServerDemoCLI cli, LeshanBootstr
jettyAddr = new InetSocketAddress(cli.main.webhost, cli.main.webPort);
}
Server server = new Server(jettyAddr);
ServletContextHandler root = new ServletContextHandler(null, "/", true, false);
ServletContextHandler root = new ServletContextHandler("/", true, false);
server.setHandler(root);

// Create static Servlet
DefaultServlet staticServelt = new DefaultServlet();
ServletHolder staticHolder = new ServletHolder(staticServelt);
staticHolder.setInitParameter("resourceBase",
staticHolder.setInitParameter("baseResource",
LeshanBootstrapServerDemo.class.getClassLoader().getResource("webapp").toExternalForm());
staticHolder.setInitParameter("pathInfoOnly", "true");
staticHolder.setInitParameter("gzip", "true");
staticHolder.setInitParameter("cacheControl", "public, max-age=31536000");
root.addServlet(staticHolder, "/*");
root.addServlet(staticHolder, "/");

// Create REST API Servlets
ServletHolder bsServletHolder = new ServletHolder(new BootstrapServlet(bsStore));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
import java.nio.charset.StandardCharsets;
import java.util.EnumSet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.eclipse.leshan.bsserver.BootstrapConfig;
import org.eclipse.leshan.bsserver.EditableBootstrapConfigStore;
Expand All @@ -42,6 +37,11 @@
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.type.CollectionType;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

/**
* Servlet for REST API in charge of adding bootstrap information to the bootstrap server.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import javax.servlet.http.HttpServletRequest;

import org.eclipse.jetty.servlets.EventSource;
import org.eclipse.jetty.servlets.EventSourceServlet;
import org.eclipse.jetty.ee10.servlets.EventSource;
import org.eclipse.jetty.ee10.servlets.EventSourceServlet;
import org.eclipse.leshan.bsserver.BootstrapFailureCause;
import org.eclipse.leshan.bsserver.BootstrapSession;
import org.eclipse.leshan.bsserver.BootstrapSessionListener;
Expand All @@ -44,6 +42,8 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import jakarta.servlet.http.HttpServletRequest;

public class EventServlet extends EventSourceServlet {
private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
import java.security.PublicKey;
import java.security.cert.X509Certificate;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.eclipse.leshan.bsserver.LeshanBootstrapServer;
import org.eclipse.leshan.bsserver.endpoint.LwM2mBootstrapServerEndpoint;
Expand All @@ -36,6 +31,11 @@
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

public class ServerServlet extends HttpServlet {

private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
import org.eclipse.californium.elements.util.CertPathUtil;
import org.eclipse.californium.scandium.config.DtlsConfig;
import org.eclipse.californium.scandium.config.DtlsConfig.DtlsRole;
import org.eclipse.jetty.ee10.servlet.DefaultServlet;
import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.leshan.core.endpoint.DefaultEndPointUriHandler;
import org.eclipse.leshan.core.endpoint.EndPointUriHandler;
import org.eclipse.leshan.core.endpoint.Protocol;
Expand Down Expand Up @@ -290,18 +290,17 @@ private static Server createJettyServer(LeshanServerDemoCLI cli, LeshanServer lw
jettyAddr = new InetSocketAddress(cli.main.webhost, cli.main.webPort);
}
Server server = new Server(jettyAddr);
ServletContextHandler root = new ServletContextHandler(null, "/", true, false);
ServletContextHandler root = new ServletContextHandler("/", true, false);
server.setHandler(root);

// Create static Servlet
DefaultServlet staticServelt = new DefaultServlet();
ServletHolder staticHolder = new ServletHolder(staticServelt);
staticHolder.setInitParameter("resourceBase",
staticHolder.setInitParameter("baseResource",
LeshanServerDemo.class.getClassLoader().getResource("webapp").toExternalForm());
staticHolder.setInitParameter("pathInfoOnly", "true");
staticHolder.setInitParameter("gzip", "true");
staticHolder.setInitParameter("cacheControl", "public, max-age=31536000");
root.addServlet(staticHolder, "/*");
root.addServlet(staticHolder, "/");

// Create REST API Servlets
EventServlet eventServlet = new EventServlet(lwServer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.eclipse.leshan.core.link.Link;
Expand Down Expand Up @@ -92,6 +87,11 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

/**
* Service HTTP REST API calls.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import javax.servlet.http.HttpServletRequest;

import org.eclipse.jetty.servlets.EventSource;
import org.eclipse.jetty.servlets.EventSourceServlet;
import org.eclipse.jetty.ee10.servlets.EventSource;
import org.eclipse.jetty.ee10.servlets.EventSourceServlet;
import org.eclipse.leshan.core.LwM2m.Version;
import org.eclipse.leshan.core.link.Link;
import org.eclipse.leshan.core.node.LwM2mNode;
Expand Down Expand Up @@ -66,6 +64,7 @@
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.node.ObjectNode;

import jakarta.servlet.http.HttpServletRequest;
import jline.internal.Log;

public class EventServlet extends EventSourceServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
import java.util.Comparator;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.eclipse.leshan.core.model.LwM2mModel;
import org.eclipse.leshan.core.model.ObjectModel;
Expand All @@ -35,6 +30,11 @@
import org.eclipse.leshan.server.registration.Registration;
import org.eclipse.leshan.server.registration.RegistrationService;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

public class ObjectSpecServlet extends HttpServlet {

private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
import java.security.PublicKey;
import java.security.cert.X509Certificate;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.eclipse.leshan.demo.servers.json.PublicKeySerDes;
import org.eclipse.leshan.demo.servers.json.X509CertificateSerDes;
Expand All @@ -36,6 +31,11 @@
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

public class ServerServlet extends HttpServlet {

private static final long serialVersionUID = 1L;
Expand Down
8 changes: 4 additions & 4 deletions leshan-demo-servers-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ Contributors:
<artifactId>leshan-demo-shared</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-servlets</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
import java.security.cert.X509Certificate;
import java.util.Collection;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.eclipse.leshan.demo.servers.json.JacksonSecurityDeserializer;
import org.eclipse.leshan.demo.servers.json.JacksonSecuritySerializer;
Expand All @@ -46,6 +41,11 @@
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

/**
* Service HTTP REST API calls for security information.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
/**
* Since LWM2M v1.1, endpoint name is optional in REGISTER and BOOTSTRAP request. An {@link ClientEndpointNameProvider}
* is determine the endpoint name value which should be used in Register/BootstrapRequest.
* <p>
*
* @see <a href="https://github.com/eclipse-leshan/leshan/issues/1457"></a>
* @see DefaultClientEndpointNameProvider
Expand Down
Loading