Repository: tipsy/javalin (kotlin)

Issue:
Fix sessionId accessors in WsContext
It's `sessionId` in Kotlin and `getSessionId()` in Java, should be `sessionId()` in both.

Pull request description:
Should be like this?
Closes #1915

Patch:
diff --git a/javalin/src/main/java/io/javalin/plugin/bundled/DevLoggerPlugin.kt b/javalin/src/main/java/io/javalin/plugin/bundled/DevLoggerPlugin.kt
index b758c8cef..a3ae8686b 100644
--- a/javalin/src/main/java/io/javalin/plugin/bundled/DevLoggerPlugin.kt
+++ b/javalin/src/main/java/io/javalin/plugin/bundled/DevLoggerPlugin.kt
@@ -90,7 +90,7 @@ private fun WsContext.logEvent(event: String, additionalInfo: String = "") {
     JavalinLogger.info(
         """|JAVALIN WEBSOCKET DEBUG LOG
            |WebSocket Event: $event
-           |Session Id: ${this.sessionId}
+           |Session Id: ${this.sessionId()}
            |Host: ${this.host()}
            |Matched Path: ${this.matchedPath()}
            |PathParams: ${this.pathParamMap()}
diff --git a/javalin/src/main/java/io/javalin/websocket/WsContext.kt b/javalin/src/main/java/io/javalin/websocket/WsContext.kt
index 45f4a36aa..404830385 100644
--- a/javalin/src/main/java/io/javalin/websocket/WsContext.kt
+++ b/javalin/src/main/java/io/javalin/websocket/WsContext.kt
@@ -24,7 +24,7 @@ import kotlin.reflect.typeOf
  * It adds functionality similar to the API found in [io.javalin.http.Context].
  * It also adds a [send] method, which calls [RemoteEndpoint.sendString] on [Session.getRemote]
  */
-abstract class WsContext(val sessionId: String, @JvmField val session: Session) {
+abstract class WsContext(private val sessionId: String, @JvmField val session: Session) {
 
     internal val upgradeReq by lazy { session.jettyUpgradeRequest() }
     internal val upgradeCtx by lazy { upgradeReq.httpServletRequest.getAttribute(upgradeContextKey) as Context }
@@ -87,6 +87,9 @@ abstract class WsContext(val sessionId: String, @JvmField val session: Session)
     /** Returns a [Map] of all the path parameters */
     fun pathParamMap(): Map<String, String> = upgradeCtx.pathParamMap()
 
+    /** Returns a [String] of the session id */
+    fun sessionId(): String = sessionId
+
     /** Returns a path param by name (ex: pathParam("param")).
      *
      * Ex: If the handler path is /users/{user-id}, and a browser GETs /users/123, pathParam("user-id") will return "123"
diff --git a/mvnw b/mvnw
old mode 100644
new mode 100755


Test patch:
diff --git a/javalin/src/test/java/io/javalin/TestWebSocket.kt b/javalin/src/test/java/io/javalin/TestWebSocket.kt
index 9c3169963..85b74ca26 100644
--- a/javalin/src/test/java/io/javalin/TestWebSocket.kt
+++ b/javalin/src/test/java/io/javalin/TestWebSocket.kt
@@ -75,13 +75,13 @@ class TestWebSocket {
     @Test
     fun `each connection receives a unique id`() = TestUtil.test(contextPathJavalin()) { app, _ ->
         app.ws("/test-websocket-1") { ws ->
-            ws.onConnect { ctx -> app.logger().log.add(ctx.sessionId) }
-            ws.onClose { ctx -> app.logger().log.add(ctx.sessionId) }
+            ws.onConnect { ctx -> app.logger().log.add(ctx.sessionId()) }
+            ws.onClose { ctx -> app.logger().log.add(ctx.sessionId()) }
         }
         app.routes {
             ws("/test-websocket-2") { ws ->
-                ws.onConnect { ctx -> app.logger().log.add(ctx.sessionId) }
-                ws.onClose { ctx -> app.logger().log.add(ctx.sessionId) }
+                ws.onConnect { ctx -> app.logger().log.add(ctx.sessionId()) }
+                ws.onClose { ctx -> app.logger().log.add(ctx.sessionId()) }
             }
         }
         TestClient(app, "/websocket/test-websocket-1").connectAndDisconnect()