diff --git a/leshan-tl-javacoap-client/src/main/java/org/eclipse/leshan/transport/javacoap/client/endpoint/AbstractJavaCoapClientEndpointsProvider.java b/leshan-tl-javacoap-client/src/main/java/org/eclipse/leshan/transport/javacoap/client/endpoint/AbstractJavaCoapClientEndpointsProvider.java index 3c0502439a..4f98f45128 100644 --- a/leshan-tl-javacoap-client/src/main/java/org/eclipse/leshan/transport/javacoap/client/endpoint/AbstractJavaCoapClientEndpointsProvider.java +++ b/leshan-tl-javacoap-client/src/main/java/org/eclipse/leshan/transport/javacoap/client/endpoint/AbstractJavaCoapClientEndpointsProvider.java @@ -149,15 +149,10 @@ public void add(CoapRequest observeRequest) { // Create notification handler NotificationHandler notificationHandler = new NotificationHandler( // use router but change Observe request in Read request and also flag request as notification - req -> { - TransportContext extendedContext = req.getTransContext() // - .with(LwM2mKeys.LESHAN_NOTIFICATION, true); - - CoapRequest newReq = new CoapRequest(req.getMethod(), req.getToken(), req.options(), - req.getPayload(), req.getPeerAddress(), extendedContext); - - return router.apply(newReq.withOptions(coapOptionsBuilder -> coapOptionsBuilder.observe(null))); - } // + req -> router.apply(req.modify() // + .addContext(LwM2mKeys.LESHAN_NOTIFICATION, true) // + .options(coapOptionsBuilder -> coapOptionsBuilder.observe(null)) // + .build()) // , observersManager); objectTree.addListener(notificationHandler); } diff --git a/leshan-tl-javacoap-server/src/main/java/org/eclipse/leshan/transport/javacoap/server/request/CoapRequestBuilder.java b/leshan-tl-javacoap-server/src/main/java/org/eclipse/leshan/transport/javacoap/server/request/CoapRequestBuilder.java index 95241f24cd..45f616bd8c 100644 --- a/leshan-tl-javacoap-server/src/main/java/org/eclipse/leshan/transport/javacoap/server/request/CoapRequestBuilder.java +++ b/leshan-tl-javacoap-server/src/main/java/org/eclipse/leshan/transport/javacoap/server/request/CoapRequestBuilder.java @@ -229,8 +229,8 @@ public void visit(ObserveCompositeRequest request) { // Add Observation to request context coapRequestBuilder // - .context(LwM2mKeys.LESHAN_OBSERVATION, observation) // - .context(LwM2mKeys.LESHAN_REGISTRATION, registration) // + .addContext(LwM2mKeys.LESHAN_OBSERVATION, observation) // + .addContext(LwM2mKeys.LESHAN_REGISTRATION, registration) // .token(token); } diff --git a/pom.xml b/pom.xml index 6798f3b65f..65f9ca2036 100644 --- a/pom.xml +++ b/pom.xml @@ -124,9 +124,9 @@ Contributors: 3.10.0 1.3.12 - 6.19.0 + 6.21.0 4.1.109.Final - 2.0.9 + 2.0.13 9.4.53.v20231009 2.15.3