diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2013-05-20 15:08:48 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-05-21 07:35:04 +0000 |
commit | 42c4b2097bc955ca18107c449e04f0d5d5683ca3 (patch) | |
tree | 2b441ac94efff0b0b4671d3b673d208efdf4b8b9 /shared/src/com/vaadin | |
parent | 2772641acf8f84046e3ac42c8386b65e4f2346f2 (diff) | |
download | vaadin-framework-42c4b2097bc955ca18107c449e04f0d5d5683ca3.tar.gz vaadin-framework-42c4b2097bc955ca18107c449e04f0d5d5683ca3.zip |
Use "\0" instead of "|" as a push message delimiter (#11692)
Used with TrackMessageSizeInterceptor and with client-to-server Websocket message splitting (see #11648)
The original issue that the delimiter can not appear in the message (unescaped) is apparently fixed in Atmosphere 1.0.13
Also ensure the max size of a websocket fragment in bytes does not exceed the buffer size (#11842)
Change-Id: I768524bb54a5b8b9479dc7bda821256bd843dc52
Diffstat (limited to 'shared/src/com/vaadin')
-rw-r--r-- | shared/src/com/vaadin/shared/ApplicationConstants.java | 4 | ||||
-rw-r--r-- | shared/src/com/vaadin/shared/communication/PushConstants.java | 46 |
2 files changed, 46 insertions, 4 deletions
diff --git a/shared/src/com/vaadin/shared/ApplicationConstants.java b/shared/src/com/vaadin/shared/ApplicationConstants.java index fc4abd1988..04cba79c0c 100644 --- a/shared/src/com/vaadin/shared/ApplicationConstants.java +++ b/shared/src/com/vaadin/shared/ApplicationConstants.java @@ -83,8 +83,4 @@ public class ApplicationConstants implements Serializable { * Name of the parameter used to transmit the CSRF token. */ public static final String CSRF_TOKEN_PARAMETER = "v-csrfToken"; - - public static final int WEBSOCKET_BUFFER_SIZE = 65536; - - public static final char WEBSOCKET_MESSAGE_DELIMITER = '|'; } diff --git a/shared/src/com/vaadin/shared/communication/PushConstants.java b/shared/src/com/vaadin/shared/communication/PushConstants.java new file mode 100644 index 0000000000..2d63621c12 --- /dev/null +++ b/shared/src/com/vaadin/shared/communication/PushConstants.java @@ -0,0 +1,46 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.communication; + +import java.io.Serializable; + +/** + * Shared constants used by push. + * + * @since 7.1 + * @author Vaadin Ltd + */ +public class PushConstants implements Serializable { + + /** + * The size, in <b>bytes</b>, of the receiving buffer used by some servers. + */ + public static final int WEBSOCKET_BUFFER_SIZE = 65536; + + /** + * The maximum size, in <b>characters</b>, of a websocket message fragment. + * This is a conservative maximum chosen so that the size in bytes will not + * exceed {@link PushConstants#WEBSOCKET_BUFFER_SIZE} given a UTF-8 encoded + * message. + */ + public static final int WEBSOCKET_FRAGMENT_SIZE = WEBSOCKET_BUFFER_SIZE / 4 - 1; + + /** + * The character used to mark message boundaries when messages may be split + * into multiple fragments. + */ + public static final char MESSAGE_DELIMITER = '\0'; +} |