From e08455a078472dd4e9005fc2167ecbe447229b17 Mon Sep 17 00:00:00 2001
From: Paul Gregoire <mondain@gmail.com>
Date: Mon, 23 Oct 2023 14:19:04 -0700
Subject: [PATCH] Add get/set for WebSocket user props via javax API to skip
 need for dep/import in projects

---
 client/pom.xml                                    |  2 +-
 .../src/main/java/org/red5/client/Red5Client.java |  2 +-
 common/pom.xml                                    |  4 ++--
 .../src/main/java/org/red5/server/api/Red5.java   |  4 ++--
 io/pom.xml                                        |  2 +-
 pom.xml                                           |  2 +-
 server/pom.xml                                    |  2 +-
 .../red5/net/websocket/WebSocketConnection.java   | 15 +++++++++++++++
 service/pom.xml                                   |  2 +-
 9 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/client/pom.xml b/client/pom.xml
index 66a23f7a..9943deb6 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -3,7 +3,7 @@
     <parent>
         <groupId>org.red5</groupId>
         <artifactId>red5-parent</artifactId>
-        <version>1.3.22</version>
+        <version>1.3.24</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>red5-client</artifactId>
diff --git a/client/src/main/java/org/red5/client/Red5Client.java b/client/src/main/java/org/red5/client/Red5Client.java
index 2f45950d..7dd7445a 100644
--- a/client/src/main/java/org/red5/client/Red5Client.java
+++ b/client/src/main/java/org/red5/client/Red5Client.java
@@ -18,7 +18,7 @@ public final class Red5Client {
     /**
      * Current server version with revision
      */
-    public static final String VERSION = "Red5 Client 1.3.22";
+    public static final String VERSION = "Red5 Client 1.3.24";
 
     /**
      * Create a new Red5Client object using the connection local to the current thread A bit of magic that lets you access the red5 scope
diff --git a/common/pom.xml b/common/pom.xml
index 8eb6ef3f..fa564a76 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -3,7 +3,7 @@
     <parent>
         <groupId>org.red5</groupId>
         <artifactId>red5-parent</artifactId>
-        <version>1.3.22</version>
+        <version>1.3.24</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>red5-server-common</artifactId>
@@ -124,7 +124,7 @@
         <dependency>
             <groupId>net.engio</groupId>
             <artifactId>mbassador</artifactId>
-            <version>1.3.22</version>
+            <version>1.3.24</version>
         </dependency> -->
         <dependency>
             <groupId>junit</groupId>
diff --git a/common/src/main/java/org/red5/server/api/Red5.java b/common/src/main/java/org/red5/server/api/Red5.java
index 50d19349..96e15719 100644
--- a/common/src/main/java/org/red5/server/api/Red5.java
+++ b/common/src/main/java/org/red5/server/api/Red5.java
@@ -55,12 +55,12 @@ public final class Red5 {
     /**
      * Server version with revision
      */
-    public static final String VERSION = "Red5 Server 1.3.22";
+    public static final String VERSION = "Red5 Server 1.3.24";
 
     /**
      * Server version for fmsVer requests
      */
-    public static final String FMS_VERSION = "RED5/1,3,22,0";
+    public static final String FMS_VERSION = "RED5/1,3,24,0";
 
     /**
      * Server capabilities
diff --git a/io/pom.xml b/io/pom.xml
index f1314518..95de6544 100644
--- a/io/pom.xml
+++ b/io/pom.xml
@@ -3,7 +3,7 @@
     <parent>
         <groupId>org.red5</groupId>
         <artifactId>red5-parent</artifactId>
-        <version>1.3.22</version>
+        <version>1.3.24</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>red5-io</artifactId>
diff --git a/pom.xml b/pom.xml
index a364ed93..bf44f115 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <name>Red5</name>
     <description>The Red5 server</description>
     <groupId>org.red5</groupId>
-    <version>1.3.22</version>
+    <version>1.3.24</version>
     <url>https://github.com/Red5/red5-server</url>
     <inceptionYear>2005</inceptionYear>
     <organization>
diff --git a/server/pom.xml b/server/pom.xml
index e7795bcb..8b2b7f41 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -3,7 +3,7 @@
     <parent>
         <groupId>org.red5</groupId>
         <artifactId>red5-parent</artifactId>
-        <version>1.3.22</version>
+        <version>1.3.24</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>red5-server</artifactId>
diff --git a/server/src/main/java/org/red5/net/websocket/WebSocketConnection.java b/server/src/main/java/org/red5/net/websocket/WebSocketConnection.java
index 4fdb23bc..a991f5aa 100644
--- a/server/src/main/java/org/red5/net/websocket/WebSocketConnection.java
+++ b/server/src/main/java/org/red5/net/websocket/WebSocketConnection.java
@@ -659,6 +659,21 @@ public class WebSocketConnection extends AttributeStore implements Comparable<We
         WebSocketConnection.readTimeout = readTimeout;
     }
 
+    public void setUserProperty(String key, Object value) {
+        WsSession wsSession = getWsSession();
+        if (wsSession != null) {
+            wsSession.getUserProperties().put(key, value);
+        }
+    }
+
+    public Object getUserProperty(String key) {
+        WsSession wsSession = getWsSession();
+        if (wsSession.getUserProperties().get(key) != null) {
+            return wsSession.getUserProperties().get(key);
+        }
+        return null;
+    }
+
     public void setWsSessionTimeout(long idleTimeout) {
         if (wsSession != null) {
             wsSession.get().setMaxIdleTimeout(idleTimeout);
diff --git a/service/pom.xml b/service/pom.xml
index bcdc53d4..a53a7408 100644
--- a/service/pom.xml
+++ b/service/pom.xml
@@ -3,7 +3,7 @@
     <parent>
         <groupId>org.red5</groupId>
         <artifactId>red5-parent</artifactId>
-        <version>1.3.22</version>
+        <version>1.3.24</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>red5-service</artifactId>
-- 
GitLab