[jira] [Commented] (WICKET-6969) allow to process web socket push messages in an asynchronous way.
[ https://issues.apache.org/jira/browse/WICKET-6969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17520920#comment-17520920 ] ASF GitHub Bot commented on WICKET-6969: martin-g commented on code in PR #509: URL: https://github.com/apache/wicket/pull/509#discussion_r847987046 ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java: ## @@ -87,13 +98,27 @@ public void close() { if (text != null) { - connection.sendMessage(text.toString()); + if (asynchronous) + { + connection.sendMessageAsync(text.toString(), timeout); + } + else + { + connection.sendMessage(text.toString()); + } text = null; } else if (binary != null) { byte[] bytes = binary.toByteArray(); - connection.sendMessage(bytes, 0, bytes.length); + if (asynchronous) + { + connection.sendMessageAsync(bytes, 0, bytes.length, timeout); Review Comment: indentation issue ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketConnection.java: ## @@ -130,6 +130,31 @@ */ void sendMessage(IWebSocketPushMessage message); + /** +* Broadcasts a push message to the wicket page (and it's components) associated with this +* connection. The components can then send messages or component updates to client by adding +* them to the target. Pushing to client is done asynchronously. +* +* @param message +* the push message to send +* +*/ + void sendMessageAsync(IWebSocketPushMessage message); Review Comment: Looking at the code it won't be easy ... ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketConnection.java: ## @@ -130,6 +130,31 @@ */ void sendMessage(IWebSocketPushMessage message); + /** +* Broadcasts a push message to the wicket page (and it's components) associated with this +* connection. The components can then send messages or component updates to client by adding +* them to the target. Pushing to client is done asynchronously. +* +* @param message +* the push message to send +* +*/ + void sendMessageAsync(IWebSocketPushMessage message); Review Comment: The earlier methods return `Future`. Can we do the same here too ? > allow to process web socket push messages in an asynchronous way. > - > > Key: WICKET-6969 > URL: https://issues.apache.org/jira/browse/WICKET-6969 > Project: Wicket > Issue Type: Improvement >Reporter: Ernesto Reinaldo Barreiro >Priority: Major > > Currently web socket push messages are always processed in a synchronous > way. Allow to configure applications to use by default asynchronous messages. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [wicket] martin-g commented on a diff in pull request #509: {WICKET-6969} allow asynchronous pushing of messages.
martin-g commented on code in PR #509: URL: https://github.com/apache/wicket/pull/509#discussion_r847987046 ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java: ## @@ -87,13 +98,27 @@ public void close() { if (text != null) { - connection.sendMessage(text.toString()); + if (asynchronous) + { + connection.sendMessageAsync(text.toString(), timeout); + } + else + { + connection.sendMessage(text.toString()); + } text = null; } else if (binary != null) { byte[] bytes = binary.toByteArray(); - connection.sendMessage(bytes, 0, bytes.length); + if (asynchronous) + { + connection.sendMessageAsync(bytes, 0, bytes.length, timeout); Review Comment: indentation issue ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketConnection.java: ## @@ -130,6 +130,31 @@ */ void sendMessage(IWebSocketPushMessage message); + /** +* Broadcasts a push message to the wicket page (and it's components) associated with this +* connection. The components can then send messages or component updates to client by adding +* them to the target. Pushing to client is done asynchronously. +* +* @param message +* the push message to send +* +*/ + void sendMessageAsync(IWebSocketPushMessage message); Review Comment: Looking at the code it won't be easy ... ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketConnection.java: ## @@ -130,6 +130,31 @@ */ void sendMessage(IWebSocketPushMessage message); + /** +* Broadcasts a push message to the wicket page (and it's components) associated with this +* connection. The components can then send messages or component updates to client by adding +* them to the target. Pushing to client is done asynchronously. +* +* @param message +* the push message to send +* +*/ + void sendMessageAsync(IWebSocketPushMessage message); Review Comment: The earlier methods return `Future`. Can we do the same here too ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@wicket.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (WICKET-6969) allow to process web socket push messages in an asynchronous way.
[ https://issues.apache.org/jira/browse/WICKET-6969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17520917#comment-17520917 ] ASF GitHub Bot commented on WICKET-6969: martin-g commented on PR #509: URL: https://github.com/apache/wicket/pull/509#issuecomment-1096089723 Please do not force-push between reviews! This way the reviewer(s) have to start from the beginning. It is much easier to review just the new commits and to "Squash and merge" at the end. > allow to process web socket push messages in an asynchronous way. > - > > Key: WICKET-6969 > URL: https://issues.apache.org/jira/browse/WICKET-6969 > Project: Wicket > Issue Type: Improvement >Reporter: Ernesto Reinaldo Barreiro >Priority: Major > > Currently web socket push messages are always processed in a synchronous > way. Allow to configure applications to use by default asynchronous messages. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [wicket] martin-g commented on pull request #509: {WICKET-6969} allow asynchronous pushing of messages.
martin-g commented on PR #509: URL: https://github.com/apache/wicket/pull/509#issuecomment-1096089723 Please do not force-push between reviews! This way the reviewer(s) have to start from the beginning. It is much easier to review just the new commits and to "Squash and merge" at the end. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@wicket.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (WICKET-6970) Unnecessary string building in AssociatedMarkupSourcingStrategy
[ https://issues.apache.org/jira/browse/WICKET-6970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17520852#comment-17520852 ] ASF subversion and git services commented on WICKET-6970: - Commit ec87f5f09f5a844017e81f663c07305f924d6283 in wicket's branch refs/heads/feature/reiern70/WICKET-6969 from Emond Papegaaij [ https://gitbox.apache.org/repos/asf?p=wicket.git;h=ec87f5f09f ] WICKET-6970: do not build error message for every render for every panel > Unnecessary string building in AssociatedMarkupSourcingStrategy > --- > > Key: WICKET-6970 > URL: https://issues.apache.org/jira/browse/WICKET-6970 > Project: Wicket > Issue Type: Bug > Components: wicket-core >Affects Versions: 10.0.0, 9.9.0 >Reporter: Emond Papegaaij >Assignee: Emond Papegaaij >Priority: Major > Fix For: 10.0.0, 9.10.0 > > > {{AssociatedMarkupSourcingStrategy.renderAssociatedMarkup}} builds a string > just for an exception message. The method > {{MarkupContainer.renderAssociatedMarkup}} is only called from this single > location and is not really meant for public consumption. I suggest we inline > the message and only build it when it's actually needed. For 9.x we must keep > the parameter, but we can call it with {{null.}} -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (WICKET-6969) allow to process web socket push messages in an asynchronous way.
[ https://issues.apache.org/jira/browse/WICKET-6969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17520853#comment-17520853 ] ASF subversion and git services commented on WICKET-6969: - Commit 8bb5553d94b62dfd26ad2f507b178cdb9b25a782 in wicket's branch refs/heads/feature/reiern70/WICKET-6969 from reiern70 [ https://gitbox.apache.org/repos/asf?p=wicket.git;h=8bb5553d94 ] {WICKET-6969} allow asynchronous pushing of messages. > allow to process web socket push messages in an asynchronous way. > - > > Key: WICKET-6969 > URL: https://issues.apache.org/jira/browse/WICKET-6969 > Project: Wicket > Issue Type: Improvement >Reporter: Ernesto Reinaldo Barreiro >Priority: Major > > Currently web socket push messages are always processed in a synchronous > way. Allow to configure applications to use by default asynchronous messages. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[wicket] branch feature/reiern70/WICKET-6969 updated (0986f18ee2 -> 8bb5553d94)
This is an automated email from the ASF dual-hosted git repository. reiern70 pushed a change to branch feature/reiern70/WICKET-6969 in repository https://gitbox.apache.org/repos/asf/wicket.git omit 0986f18ee2 Update wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java omit 81aeb3a7ee Update wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java omit 093d8224f1 Update wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketRequestHandler.java omit 907df03c89 Update wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java omit 493c186e98 {WICKET-6969} use asynchronous messages for charts omit 330aace333 {WICKET-6969} allow asynchronous pushing of messages. omit 3ae2f76baf {WICKET-6969} allow asynchronous pushing of messages. omit e0bb247381 {WICKET-6969} allow asynchronous pushing of messages. omit 835ff5953f {WICKET-6969} allow asynchronous pushing of messages. add 8188f702bd Added CHANGELOG for release 9.9.1 add ec87f5f09f WICKET-6970: do not build error message for every render for every panel add 8bb5553d94 {WICKET-6969} allow asynchronous pushing of messages. This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (0986f18ee2) \ N -- N -- N refs/heads/feature/reiern70/WICKET-6969 (8bb5553d94) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: CHANGELOG-9.x | 13 +++ .../java/org/apache/wicket/MarkupContainer.java| 25 ++ .../panel/AssociatedMarkupSourcingStrategy.java| 3 +-- .../wicket/protocol/ws/WebSocketSettings.java | 4 .../wicket/protocol/ws/api/WebSocketResponse.java | 15 +++-- 5 files changed, 42 insertions(+), 18 deletions(-)
[jira] [Commented] (WICKET-6969) allow to process web socket push messages in an asynchronous way.
[ https://issues.apache.org/jira/browse/WICKET-6969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17520846#comment-17520846 ] ASF GitHub Bot commented on WICKET-6969: reiern70 commented on code in PR #509: URL: https://github.com/apache/wicket/pull/509#discussion_r847826337 ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java: ## @@ -305,7 +320,20 @@ public IWebSocketConnectionFilter getConnectionFilter() */ public WebResponse newWebSocketResponse(IWebSocketConnection connection) { - return new WebSocketResponse(connection); + return new WebSocketResponse(connection, isAsynchronousPush(), getAsynchronousPushTimeout()); + } + + /** +* A factory method for the {@link org.apache.wicket.request.http.WebResponse} +* that should be used to write the response back to the client/browser +* +* @param connection +* The active web socket connection Review Comment: Done. > allow to process web socket push messages in an asynchronous way. > - > > Key: WICKET-6969 > URL: https://issues.apache.org/jira/browse/WICKET-6969 > Project: Wicket > Issue Type: Improvement >Reporter: Ernesto Reinaldo Barreiro >Priority: Major > > Currently web socket push messages are always processed in a synchronous > way. Allow to configure applications to use by default asynchronous messages. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [wicket] reiern70 commented on a diff in pull request #509: {WICKET-6969} allow asynchronous pushing of messages.
reiern70 commented on code in PR #509: URL: https://github.com/apache/wicket/pull/509#discussion_r847826337 ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java: ## @@ -305,7 +320,20 @@ public IWebSocketConnectionFilter getConnectionFilter() */ public WebResponse newWebSocketResponse(IWebSocketConnection connection) { - return new WebSocketResponse(connection); + return new WebSocketResponse(connection, isAsynchronousPush(), getAsynchronousPushTimeout()); + } + + /** +* A factory method for the {@link org.apache.wicket.request.http.WebResponse} +* that should be used to write the response back to the client/browser +* +* @param connection +* The active web socket connection Review Comment: Done. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@wicket.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (WICKET-6969) allow to process web socket push messages in an asynchronous way.
[ https://issues.apache.org/jira/browse/WICKET-6969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17520844#comment-17520844 ] ASF GitHub Bot commented on WICKET-6969: reiern70 commented on code in PR #509: URL: https://github.com/apache/wicket/pull/509#discussion_r847824514 ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java: ## @@ -47,9 +47,22 @@ private boolean isRedirect = false; + private final boolean asynchronous; + + private final long timeout; + public WebSocketResponse(final IWebSocketConnection conn) { this.connection = conn; Review Comment: Done > allow to process web socket push messages in an asynchronous way. > - > > Key: WICKET-6969 > URL: https://issues.apache.org/jira/browse/WICKET-6969 > Project: Wicket > Issue Type: Improvement >Reporter: Ernesto Reinaldo Barreiro >Priority: Major > > Currently web socket push messages are always processed in a synchronous > way. Allow to configure applications to use by default asynchronous messages. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [wicket] reiern70 commented on a diff in pull request #509: {WICKET-6969} allow asynchronous pushing of messages.
reiern70 commented on code in PR #509: URL: https://github.com/apache/wicket/pull/509#discussion_r847824514 ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java: ## @@ -47,9 +47,22 @@ private boolean isRedirect = false; + private final boolean asynchronous; + + private final long timeout; + public WebSocketResponse(final IWebSocketConnection conn) { this.connection = conn; Review Comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@wicket.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (WICKET-6969) allow to process web socket push messages in an asynchronous way.
[ https://issues.apache.org/jira/browse/WICKET-6969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17520795#comment-17520795 ] ASF GitHub Bot commented on WICKET-6969: reiern70 commented on code in PR #509: URL: https://github.com/apache/wicket/pull/509#discussion_r847694761 ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java: ## @@ -87,13 +100,34 @@ public void close() { if (text != null) { - connection.sendMessage(text.toString()); + if (asynchronous) + { + if (timeout > 0) + { + connection.sendMessageAsync(text.toString(), timeout); + } + else + { + connection.sendMessageAsync(text.toString()); + } + } + else + { + connection.sendMessage(text.toString()); + } text = null; } else if (binary != null) { byte[] bytes = binary.toByteArray(); - connection.sendMessage(bytes, 0, bytes.length); + if (asynchronous) + { + connection.sendMessageAsync(bytes, 0, bytes.length); Review Comment: Overlooked. Fixing, Thanks! > allow to process web socket push messages in an asynchronous way. > - > > Key: WICKET-6969 > URL: https://issues.apache.org/jira/browse/WICKET-6969 > Project: Wicket > Issue Type: Improvement >Reporter: Ernesto Reinaldo Barreiro >Priority: Major > > Currently web socket push messages are always processed in a synchronous > way. Allow to configure applications to use by default asynchronous messages. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[wicket] branch feature/reiern70/WICKET-6969 updated (093d8224f1 -> 81aeb3a7ee)
This is an automated email from the ASF dual-hosted git repository. reiern70 pushed a change to branch feature/reiern70/WICKET-6969 in repository https://gitbox.apache.org/repos/asf/wicket.git from 093d8224f1 Update wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketRequestHandler.java add 81aeb3a7ee Update wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java No new revisions were added by this update. Summary of changes: .../src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[wicket] branch feature/reiern70/WICKET-6969 updated (81aeb3a7ee -> 0986f18ee2)
This is an automated email from the ASF dual-hosted git repository. reiern70 pushed a change to branch feature/reiern70/WICKET-6969 in repository https://gitbox.apache.org/repos/asf/wicket.git from 81aeb3a7ee Update wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java add 0986f18ee2 Update wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java No new revisions were added by this update. Summary of changes: .../src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[GitHub] [wicket] reiern70 commented on a diff in pull request #509: {WICKET-6969} allow asynchronous pushing of messages.
reiern70 commented on code in PR #509: URL: https://github.com/apache/wicket/pull/509#discussion_r847694761 ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java: ## @@ -87,13 +100,34 @@ public void close() { if (text != null) { - connection.sendMessage(text.toString()); + if (asynchronous) + { + if (timeout > 0) + { + connection.sendMessageAsync(text.toString(), timeout); + } + else + { + connection.sendMessageAsync(text.toString()); + } + } + else + { + connection.sendMessage(text.toString()); + } text = null; } else if (binary != null) { byte[] bytes = binary.toByteArray(); - connection.sendMessage(bytes, 0, bytes.length); + if (asynchronous) + { + connection.sendMessageAsync(bytes, 0, bytes.length); Review Comment: Overlooked. Fixing, Thanks! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@wicket.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[wicket] branch feature/reiern70/WICKET-6969 updated (907df03c89 -> 093d8224f1)
This is an automated email from the ASF dual-hosted git repository. reiern70 pushed a change to branch feature/reiern70/WICKET-6969 in repository https://gitbox.apache.org/repos/asf/wicket.git from 907df03c89 Update wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java add 093d8224f1 Update wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketRequestHandler.java No new revisions were added by this update. Summary of changes: .../java/org/apache/wicket/protocol/ws/api/WebSocketRequestHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[wicket] branch feature/reiern70/WICKET-6969 updated (493c186e98 -> 907df03c89)
This is an automated email from the ASF dual-hosted git repository. reiern70 pushed a change to branch feature/reiern70/WICKET-6969 in repository https://gitbox.apache.org/repos/asf/wicket.git from 493c186e98 {WICKET-6969} use asynchronous messages for charts add 907df03c89 Update wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java No new revisions were added by this update. Summary of changes: .../src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[jira] [Commented] (WICKET-6969) allow to process web socket push messages in an asynchronous way.
[ https://issues.apache.org/jira/browse/WICKET-6969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17520764#comment-17520764 ] ASF GitHub Bot commented on WICKET-6969: martin-g commented on code in PR #509: URL: https://github.com/apache/wicket/pull/509#discussion_r847619483 ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java: ## @@ -158,11 +158,24 @@ public void configureSession(IWebSocketSession webSocketSession) { */ private Function notifyOnCloseEvent = (code) -> true; - public boolean shouldNotifyOnCloseEvent(int closeCode) { + /** +* Flag that allows to use asynchronous push. By default, it is set to false. +*/ + private boolean asynchronousPush = false; + + /** +* The timeout to use for asynchronous push. By default, it is -1 which means use timeout configured by +* sever implementation. Review Comment: ```suggestion * server implementation. ``` ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java: ## @@ -158,11 +158,24 @@ public void configureSession(IWebSocketSession webSocketSession) { */ private Function notifyOnCloseEvent = (code) -> true; - public boolean shouldNotifyOnCloseEvent(int closeCode) { + /** +* Flag that allows to use asynchronous push. By default, it is set to false. Review Comment: ```suggestion * Flag that allows to use asynchronous push. By default, it is set to false. ``` ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java: ## @@ -305,7 +320,20 @@ public IWebSocketConnectionFilter getConnectionFilter() */ public WebResponse newWebSocketResponse(IWebSocketConnection connection) { - return new WebSocketResponse(connection); + return new WebSocketResponse(connection, isAsynchronousPush(), getAsynchronousPushTimeout()); Review Comment: ```suggestion return newWebSocketResponse(connection, isAsynchronousPush(), getAsynchronousPushTimeout()); ``` ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java: ## @@ -305,7 +320,20 @@ public IWebSocketConnectionFilter getConnectionFilter() */ public WebResponse newWebSocketResponse(IWebSocketConnection connection) { - return new WebSocketResponse(connection); + return new WebSocketResponse(connection, isAsynchronousPush(), getAsynchronousPushTimeout()); + } + + /** +* A factory method for the {@link org.apache.wicket.request.http.WebResponse} +* that should be used to write the response back to the client/browser +* +* @param connection +* The active web socket connection Review Comment: missing `@param`s for `asynchronousPush` and `timeout` ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketRequestHandler.java: ## @@ -97,6 +119,27 @@ public void push(byte[] message, int offset, int length) } } + @Override + public Future pushAsync(byte[] message, int offset, int length) + { + return pushAsync(message, offset, length, -1); + } + + @Override + public Future pushAsync(byte[] message, int offset, int length, long timeout) + { + if (connection.isOpen()) + { + Args.notNull(message, "message"); + return connection.sendMessageAsync(message, offset, length, timeout); + } + else + { + LOG.warn("The websocket connection is already closed. Cannot push the binary message '{}'", message); + } + return null; Review Comment: ```suggestion return java.util.concurrent.CompletableFuture.completedFuture(null); ``` ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java: ## @@ -87,13 +100,34 @@ public void close() { if (text != null) { - connection.sendMessage(text.toString()); + if (asynchronous) + { + if (timeout > 0) + { +
[GitHub] [wicket] martin-g commented on a diff in pull request #509: {WICKET-6969} allow asynchronous pushing of messages.
martin-g commented on code in PR #509: URL: https://github.com/apache/wicket/pull/509#discussion_r847619483 ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java: ## @@ -158,11 +158,24 @@ public void configureSession(IWebSocketSession webSocketSession) { */ private Function notifyOnCloseEvent = (code) -> true; - public boolean shouldNotifyOnCloseEvent(int closeCode) { + /** +* Flag that allows to use asynchronous push. By default, it is set to false. +*/ + private boolean asynchronousPush = false; + + /** +* The timeout to use for asynchronous push. By default, it is -1 which means use timeout configured by +* sever implementation. Review Comment: ```suggestion * server implementation. ``` ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java: ## @@ -158,11 +158,24 @@ public void configureSession(IWebSocketSession webSocketSession) { */ private Function notifyOnCloseEvent = (code) -> true; - public boolean shouldNotifyOnCloseEvent(int closeCode) { + /** +* Flag that allows to use asynchronous push. By default, it is set to false. Review Comment: ```suggestion * Flag that allows to use asynchronous push. By default, it is set to false. ``` ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java: ## @@ -305,7 +320,20 @@ public IWebSocketConnectionFilter getConnectionFilter() */ public WebResponse newWebSocketResponse(IWebSocketConnection connection) { - return new WebSocketResponse(connection); + return new WebSocketResponse(connection, isAsynchronousPush(), getAsynchronousPushTimeout()); Review Comment: ```suggestion return newWebSocketResponse(connection, isAsynchronousPush(), getAsynchronousPushTimeout()); ``` ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java: ## @@ -305,7 +320,20 @@ public IWebSocketConnectionFilter getConnectionFilter() */ public WebResponse newWebSocketResponse(IWebSocketConnection connection) { - return new WebSocketResponse(connection); + return new WebSocketResponse(connection, isAsynchronousPush(), getAsynchronousPushTimeout()); + } + + /** +* A factory method for the {@link org.apache.wicket.request.http.WebResponse} +* that should be used to write the response back to the client/browser +* +* @param connection +* The active web socket connection Review Comment: missing `@param`s for `asynchronousPush` and `timeout` ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketRequestHandler.java: ## @@ -97,6 +119,27 @@ public void push(byte[] message, int offset, int length) } } + @Override + public Future pushAsync(byte[] message, int offset, int length) + { + return pushAsync(message, offset, length, -1); + } + + @Override + public Future pushAsync(byte[] message, int offset, int length, long timeout) + { + if (connection.isOpen()) + { + Args.notNull(message, "message"); + return connection.sendMessageAsync(message, offset, length, timeout); + } + else + { + LOG.warn("The websocket connection is already closed. Cannot push the binary message '{}'", message); + } + return null; Review Comment: ```suggestion return java.util.concurrent.CompletableFuture.completedFuture(null); ``` ## wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java: ## @@ -87,13 +100,34 @@ public void close() { if (text != null) { - connection.sendMessage(text.toString()); + if (asynchronous) + { + if (timeout > 0) + { + connection.sendMessageAsync(text.toString(), timeout); + } + else + { +
[jira] [Created] (WICKET-6972) Add Resource key to be logged on Warning in Localizer.java
Johannes Renoth created WICKET-6972: --- Summary: Add Resource key to be logged on Warning in Localizer.java Key: WICKET-6972 URL: https://issues.apache.org/jira/browse/WICKET-6972 Project: Wicket Issue Type: Improvement Components: wicket-core Reporter: Johannes Renoth For better Errorfinding -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Created] (WICKET-6971) NullPointerException in ModificationWatcher
Ryo Tsunoda created WICKET-6971: --- Summary: NullPointerException in ModificationWatcher Key: WICKET-6971 URL: https://issues.apache.org/jira/browse/WICKET-6971 Project: Wicket Issue Type: Bug Environment: * Eclipse Version: 2021-12 (4.22.0) Build id: 20211202-1639 * Tomcat 9.0.44 * Java11(amazon-corretto-11.0.10.9.1-windows-x64-jdk) Reporter: Ryo Tsunoda Sometimes this exception occurs after I edit the CSS. ``` 2022-04-09 19:28:48.252 | ERROR | [ModificationWatcher Task] | org.apache.wicket.util.thread.Task | Unhandled exception thrown by user code in task ModificationWatcher java.lang.NullPointerException: null at org.apache.wicket.util.io.Connections.close(Connections.java:133) ~[wicket-util-8.14.0.jar:8.14.0] at org.apache.wicket.core.util.resource.UrlResourceStream.updateContentLength(UrlResourceStream.java:247) ~[wicket-core-8.14.0.jar:8.14.0] at org.apache.wicket.core.util.resource.UrlResourceStream.lastModifiedTime(UrlResourceStream.java:224) ~[wicket-core-8.14.0.jar:8.14.0] at org.apache.wicket.markup.MarkupResourceStream.lastModifiedTime(MarkupResourceStream.java:148) ~[wicket-core-8.14.0.jar:8.14.0] at org.apache.wicket.util.watch.ModificationWatcher.checkModified(ModificationWatcher.java:157) ~[wicket-util-8.14.0.jar:8.14.0] at org.apache.wicket.util.watch.ModificationWatcher$1.run(ModificationWatcher.java:143) ~[wicket-util-8.14.0.jar:8.14.0] at org.apache.wicket.util.thread.Task$1.run(Task.java:116) [wicket-util-8.14.0.jar:8.14.0] at java.lang.Thread.run(Thread.java:829) [?:?] ``` connection.getInputStream() returns null. Wicket can check null here. [https://github.com/apache/wicket/blob/wicket-8.x/wicket-util/src/main/java/org/apache/wicket/util/io/Connections.java#L133] Tomcat's CachedResourceURLConnection#getInputStream() sometimes returns a WebResource instance with no stream. [https://github.com/apache/tomcat/blob/9.0.x/java/org/apache/catalina/webresources/CachedResource.java#L516] I don't know the conditions under which it can be reproduced. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [wicket] martin-g commented on pull request #508: Add Resource key to be logged on Warning in Localizer.java
martin-g commented on PR #508: URL: https://github.com/apache/wicket/pull/508#issuecomment-1094736272 @renoth Thanks for the PR! I think it is safe to log the key. We also need a ticket in JIRA for the release changelog. Once you have a ticket id please update the PR title and the commit message with it. Thanks! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@wicket.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Resolved] (WICKET-6970) Unnecessary string building in AssociatedMarkupSourcingStrategy
[ https://issues.apache.org/jira/browse/WICKET-6970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Emond Papegaaij resolved WICKET-6970. - Fix Version/s: 10.0.0 9.10.0 Resolution: Fixed > Unnecessary string building in AssociatedMarkupSourcingStrategy > --- > > Key: WICKET-6970 > URL: https://issues.apache.org/jira/browse/WICKET-6970 > Project: Wicket > Issue Type: Bug > Components: wicket-core >Affects Versions: 10.0.0, 9.9.0 >Reporter: Emond Papegaaij >Assignee: Emond Papegaaij >Priority: Major > Fix For: 10.0.0, 9.10.0 > > > {{AssociatedMarkupSourcingStrategy.renderAssociatedMarkup}} builds a string > just for an exception message. The method > {{MarkupContainer.renderAssociatedMarkup}} is only called from this single > location and is not really meant for public consumption. I suggest we inline > the message and only build it when it's actually needed. For 9.x we must keep > the parameter, but we can call it with {{null.}} -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (WICKET-6970) Unnecessary string building in AssociatedMarkupSourcingStrategy
[ https://issues.apache.org/jira/browse/WICKET-6970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17520434#comment-17520434 ] ASF subversion and git services commented on WICKET-6970: - Commit ec87f5f09f5a844017e81f663c07305f924d6283 in wicket's branch refs/heads/wicket-9.x from Emond Papegaaij [ https://gitbox.apache.org/repos/asf?p=wicket.git;h=ec87f5f09f ] WICKET-6970: do not build error message for every render for every panel > Unnecessary string building in AssociatedMarkupSourcingStrategy > --- > > Key: WICKET-6970 > URL: https://issues.apache.org/jira/browse/WICKET-6970 > Project: Wicket > Issue Type: Bug > Components: wicket-core >Affects Versions: 10.0.0, 9.9.0 >Reporter: Emond Papegaaij >Assignee: Emond Papegaaij >Priority: Major > > {{AssociatedMarkupSourcingStrategy.renderAssociatedMarkup}} builds a string > just for an exception message. The method > {{MarkupContainer.renderAssociatedMarkup}} is only called from this single > location and is not really meant for public consumption. I suggest we inline > the message and only build it when it's actually needed. For 9.x we must keep > the parameter, but we can call it with {{null.}} -- This message was sent by Atlassian Jira (v8.20.1#820001)
[wicket] branch wicket-9.x updated: WICKET-6970: do not build error message for every render for every panel
This is an automated email from the ASF dual-hosted git repository. papegaaij pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new ec87f5f09f WICKET-6970: do not build error message for every render for every panel ec87f5f09f is described below commit ec87f5f09f5a844017e81f663c07305f924d6283 Author: Emond Papegaaij AuthorDate: Mon Apr 11 10:31:08 2022 +0200 WICKET-6970: do not build error message for every render for every panel --- .../java/org/apache/wicket/MarkupContainer.java| 25 ++ .../panel/AssociatedMarkupSourcingStrategy.java| 3 +-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java index 5893186a4c..44d953f096 100644 --- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java +++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java @@ -762,9 +762,25 @@ public abstract class MarkupContainer extends Component implements Iterable'"); } // Check for required open tag name ComponentTag associatedMarkupOpenTag = (ComponentTag)elem; if (!(associatedMarkupOpenTag.isOpen() && (associatedMarkupOpenTag instanceof WicketTag))) { - associatedMarkupStream.throwMarkupException(exceptionMessage); + associatedMarkupStream.throwMarkupException("Markup for a " + openTagName + + " component must begin a tag like ''"); } try diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java index 3e4daced88..58d70135d1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java @@ -74,8 +74,7 @@ public abstract class AssociatedMarkupSourcingStrategy extends AbstractMarkupSou */ protected final void renderAssociatedMarkup(final Component component) { - ((MarkupContainer)component).renderAssociatedMarkup(tagName, "Markup for a " + tagName + - " component must begin a tag like ''"); + ((MarkupContainer)component).renderAssociatedMarkup(tagName); } /**
[jira] [Commented] (WICKET-6970) Unnecessary string building in AssociatedMarkupSourcingStrategy
[ https://issues.apache.org/jira/browse/WICKET-6970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17520424#comment-17520424 ] ASF subversion and git services commented on WICKET-6970: - Commit 2a6ae40b023bc828a3c5a0d9b480040d6eab6e0e in wicket's branch refs/heads/master from Emond Papegaaij [ https://gitbox.apache.org/repos/asf?p=wicket.git;h=2a6ae40b02 ] WICKET-6970: do not build error message for every render for every panel > Unnecessary string building in AssociatedMarkupSourcingStrategy > --- > > Key: WICKET-6970 > URL: https://issues.apache.org/jira/browse/WICKET-6970 > Project: Wicket > Issue Type: Bug > Components: wicket-core >Affects Versions: 10.0.0, 9.9.0 >Reporter: Emond Papegaaij >Assignee: Emond Papegaaij >Priority: Major > > {{AssociatedMarkupSourcingStrategy.renderAssociatedMarkup}} builds a string > just for an exception message. The method > {{MarkupContainer.renderAssociatedMarkup}} is only called from this single > location and is not really meant for public consumption. I suggest we inline > the message and only build it when it's actually needed. For 9.x we must keep > the parameter, but we can call it with {{null.}} -- This message was sent by Atlassian Jira (v8.20.1#820001)
[wicket] branch master updated: WICKET-6970: do not build error message for every render for every panel
This is an automated email from the ASF dual-hosted git repository. papegaaij pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 2a6ae40b02 WICKET-6970: do not build error message for every render for every panel 2a6ae40b02 is described below commit 2a6ae40b023bc828a3c5a0d9b480040d6eab6e0e Author: Emond Papegaaij AuthorDate: Mon Apr 11 10:31:08 2022 +0200 WICKET-6970: do not build error message for every render for every panel --- .../src/main/java/org/apache/wicket/MarkupContainer.java | 11 +-- .../markup/html/panel/AssociatedMarkupSourcingStrategy.java | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java index 3011999a28..8703c61635 100644 --- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java +++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java @@ -762,10 +762,8 @@ public abstract class MarkupContainer extends Component implements Iterable'"); } // Check for required open tag name ComponentTag associatedMarkupOpenTag = (ComponentTag)elem; if (!(associatedMarkupOpenTag.isOpen() && (associatedMarkupOpenTag instanceof WicketTag))) { - associatedMarkupStream.throwMarkupException(exceptionMessage); + associatedMarkupStream.throwMarkupException("Markup for a " + openTagName + + " component must begin a tag like ''"); } try diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java index 3e4daced88..58d70135d1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java @@ -74,8 +74,7 @@ public abstract class AssociatedMarkupSourcingStrategy extends AbstractMarkupSou */ protected final void renderAssociatedMarkup(final Component component) { - ((MarkupContainer)component).renderAssociatedMarkup(tagName, "Markup for a " + tagName + - " component must begin a tag like ''"); + ((MarkupContainer)component).renderAssociatedMarkup(tagName); } /**