From 4999c6783c6638af7f82f04626e1c9d3a7284483 Mon Sep 17 00:00:00 2001 From: reiern70 Date: Thu, 17 Aug 2023 11:58:20 -0500 Subject: [PATCH] [WICKET-7067] WebSocketResponse does not allow setting a header thus, disableCaching fails with an UnsupportedOperationException --- .../main/java/org/apache/wicket/DefaultExceptionMapper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/DefaultExceptionMapper.java b/wicket-core/src/main/java/org/apache/wicket/DefaultExceptionMapper.java index a26a882c43e..54346d587ef 100644 --- a/wicket-core/src/main/java/org/apache/wicket/DefaultExceptionMapper.java +++ b/wicket-core/src/main/java/org/apache/wicket/DefaultExceptionMapper.java @@ -54,10 +54,11 @@ public IRequestHandler map(Exception e) try { Response response = RequestCycle.get().getResponse(); - if (response instanceof WebResponse) + // WICKET-7067 WebSocketResponse doesn't allow setting headers + if (response instanceof WebResponse && ((WebResponse) response).isHeaderSupported()) { // we don't want to cache an exceptional reply in the browser - ((WebResponse)response).disableCaching(); + ((WebResponse) response).disableCaching(); } return internalMap(e); }