Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 090BECD17 for ; Fri, 28 Jun 2013 12:44:37 +0000 (UTC) Received: (qmail 28180 invoked by uid 500); 28 Jun 2013 12:44:35 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 28062 invoked by uid 500); 28 Jun 2013 12:44:34 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 28053 invoked by uid 99); 28 Jun 2013 12:44:33 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jun 2013 12:44:33 +0000 Received: from localhost (HELO [192.168.23.9]) (127.0.0.1) (smtp-auth username markt, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jun 2013 12:44:33 +0000 Message-ID: <51CD8528.50804@apache.org> Date: Fri, 28 Jun 2013 13:44:24 +0100 From: Mark Thomas User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Tomcat Developers List Subject: Re: WebSocket: to flip or not the ByteBuffer during sendBinary in RemoteEndpoint(s) References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 28/06/2013 12:47, Niki Dokovski wrote: > Hi folks, > while playing around with tyrus and tomcat implementation of websocket I > spotted a difference in the way sendBinary is actually implemented. In > short: tyrus uses bytebuffer.array(), hence there is no change in buffer's > position while we end with channel write operation that does this. Neither > the spec nor the javadoc detail that but the result is that one application > can run perfectly on one of the implementations and could cause problem on > the other. Shall we contact the EG for clarification on this matter? No need. The EG has already stated its view (well, the EG lead did and no-one disagreed) Since the spec does not say anything about re-using ByteBuffers and they are mutable objects, I would expect the conventional developer practice to be to use a new one each time. > Opinions? I agree with the EG lead. Client's should not be making any assumptions about what the implementation will or won't do with a ByteBuffer. If you want to argue for a specific behaviour, open an issue against the spec. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org