Skip to content
Merged
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
6 changes: 2 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,7 @@ jobs:
echo "Running integration tests on Lucee ${{ matrix.lucee }}..."
FAILED=false
RESULTS=""
# test-session-access parked pending LDEV-6277 (wsClient.getSession() not exposed) —
# re-add once the Java fix lands
for test in test-websocket-client test-lifecycle-callbacks test-return-value-send test-wsclient-broadcast test-wsclients-plural test-binary-send test-close test-onfirstopen-rearm test-onopen-async test-request-timeout; do
for test in test-websocket-client test-lifecycle-callbacks test-return-value-send test-wsclient-broadcast test-wsclients-plural test-binary-send test-close test-session-access test-onfirstopen-rearm test-onopen-async test-request-timeout; do
echo ""
echo "=============================================="
echo "Running ${test}"
Expand Down Expand Up @@ -352,7 +350,7 @@ jobs:
echo '```' >> $GITHUB_STEP_SUMMARY
cat /tmp/integration-results.txt >> $GITHUB_STEP_SUMMARY || true
echo '```' >> $GITHUB_STEP_SUMMARY
for test in test-websocket-client test-lifecycle-callbacks test-return-value-send test-wsclient-broadcast test-wsclients-plural test-binary-send test-close test-onfirstopen-rearm test-onopen-async test-request-timeout; do
for test in test-websocket-client test-lifecycle-callbacks test-return-value-send test-wsclient-broadcast test-wsclients-plural test-binary-send test-close test-session-access test-onfirstopen-rearm test-onopen-async test-request-timeout; do
if [ -f /tmp/${test}.txt ] && grep -q "FAILED" /tmp/${test}.txt; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "#### ${test}" >> $GITHUB_STEP_SUMMARY
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 3.0.0.21 (unreleased)

- [LDEV-6277](https://luceeserver.atlassian.net/browse/LDEV-6277) — expose `wsClient.getSession()` so listeners can reach the underlying JSR-356 `Session` (`getId()`, `getUserProperties()`, `getRequestParameterMap()`)
- [LDEV-6221](https://luceeserver.atlassian.net/browse/LDEV-6221) — improve reflection fallback warning message to explain why and that a servlet engine restart is needed

## 3.0.0.20
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ LUCEE_EXTENSIONS=org.lucee:websocket-extension:3.0.0.20-SNAPSHOT

- **Listener components** — CFML components with `onOpen`, `onMessage`, `onClose`, `onError`, `onFirstOpen`, `onLastClose` lifecycle methods.
- **Async open handler** — optional `onOpenAsync` runs in parallel with `onOpen` for long-running init work.
- **JSR-356 Session access** — `wsClient.getSession()` exposes the underlying `javax.websocket.Session` / `jakarta.websocket.Session` for per-connection state (`getUserProperties()`), connection identity (`getId()`), and handshake data (`getRequestParameterMap()`).
- **`websocketInfo()` BIF** — returns `version`, `mapping`, `config`, `configFile`, `log`, and an `instances[]` array of active sessions with their component + session metadata.
- **Extension hot-upgrade** — upgrade the `.lex` in-place via `inject()` without restarting the servlet container.
- **Configurable timeouts** — `idleTimeout` and `requestTimeout` per web context via `websocket.json`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public abstract class AbsWSClient implements Objects {
protected Key IS_CLOSE;
protected Key SIZE;
protected Key GET_CLIENTS;
protected Key GET_SESSION;

protected final WebSocketEndpointFactory factory;
private String className;
Expand All @@ -61,6 +62,7 @@ public AbsWSClient(WebSocketEndpointFactory factory, String className) {
IS_CLOSE = caster.toKey("isClose");
SIZE = caster.toKey("size");
GET_CLIENTS = caster.toKey("getClients");
GET_SESSION = caster.toKey("getSession");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public final class WSClient extends AbsWSClient {
public WSClient(WebSocketEndpointFactory factory, Object session) {
super(factory, "WSClient");
this.session = session;
keys = new Key[] { BROADCAST_MESSAGE, CLOSE, IS_OPEN, SEND_MESSAGE };
keys = new Key[] { BROADCAST_MESSAGE, CLOSE, GET_SESSION, IS_OPEN, SEND_MESSAGE };
}

@Override
Expand Down Expand Up @@ -51,6 +51,10 @@ else if (CLOSE.equals(name)) {
throw caster.toPageException(e);
}
}
else if (GET_SESSION.equals(name)) {
checkArgs(name, args, 0);
return session;
}

throw exception.createExpressionException("WSClient does not have the function [" + name + "]");
}
Expand Down Expand Up @@ -78,6 +82,9 @@ else if (CLOSE.equals(name)) {
throw caster.toPageException(e);
}
}
else if (GET_SESSION.equals(name)) {
return session;
}
throw exception.createExpressionException("WSClient does not have the function [" + name + "]");
}

Expand All @@ -95,6 +102,8 @@ public String toString() {

+ "\n\tclose():void;"

+ "\n\tgetSession():Session;"

+ "\n}";
}

Expand Down