tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: svn commit: r1292776 - /tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java
Date Thu, 23 Feb 2012 19:12:32 GMT
2012/2/23  <markt@apache.org>:
> Author: markt
> Date: Thu Feb 23 12:48:56 2012
> New Revision: 1292776
>
> URL: http://svn.apache.org/viewvc?rev=1292776&view=rev
> Log:
> More javadoc
>
> Modified:
>    tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java
>
> Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java?rev=1292776&r1=1292775&r2=1292776&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Thu Feb 23 12:48:56
2012
> @@ -102,6 +102,15 @@ public class WsOutbound {
>     }
>
>
> +    /**
> +     * Flush any message (binary or textual) that may be buffered and then send
> +     * the a WebSocket binary message as a single frame with the provided buffer

s/the a/a /

> +     * as the payload of the message.
> +     *
> +     * @param msgBb The buffer containing the payload
> +     *
> +     * @throws IOException  If an error occurs writing to the client
> +     */
>     public void writeBinaryMessage(ByteBuffer msgBb) throws IOException {
>         if (text != null) {
>             // Empty the buffer
> @@ -112,6 +121,15 @@ public class WsOutbound {
>     }
>
>
> +    /**
> +     * Flush any message (binary or textual) that may be buffered and then send
> +     * the a WebSocket text message as a single frame with the provided buffer

ditto

> +     * as the payload of the message.
> +     *
> +     * @param msgBb The buffer containing the payload
> +     *
> +     * @throws IOException  If an error occurs writing to the client
> +     */
>     public void writeTextMessage(CharBuffer msgCb) throws IOException {
>         if (text != null) {
>             // Empty the buffer
> @@ -122,6 +140,11 @@ public class WsOutbound {
>     }
>
>
> +    /**
> +     * Flush any message (binary or textual) that may be buffered.
> +     *
> +     * @throws IOException  If an error occurs writing to the client
> +     */
>     public void flush() throws IOException {
>         doFlush(true);
>     }
> @@ -142,8 +165,15 @@ public class WsOutbound {
>     }
>
>
> -
> -    public void close(WsFrame frame) throws IOException {
> +    /**
> +     * Respond to a client close by sending a close that echos the status code

s/echos/echoes/ ?

> +     * and message.
> +     *
> +     * @param frame The close frame received from a client
> +     *
> +     * @throws IOException  If an error occurs writing to the client
> +     */
> +    protected void close(WsFrame frame) throws IOException {
>         if (frame.getPayLoadLength() > 0) {
>             // Must be status (2 bytes) plus optional message
>             if (frame.getPayLoadLength() == 1) {
> @@ -184,6 +214,15 @@ public class WsOutbound {
>     }
>
>
> +    /**
> +     * Send a close message to the client
> +     *
> +     * @param status    Must be a valid status code or zero to send no code
> +     * @param data      Optional message. If message is defined, a valid status
> +     *                  code must be provided.
> +     *
> +     * @throws IOException  If an error occurs writing to the client
> +     */
>     public void close(int status, ByteBuffer data) throws IOException {
>         // TODO Think about threading requirements for writing. This is not
>         // currently thread safe and writing almost certainly needs to be.
> @@ -214,6 +253,13 @@ public class WsOutbound {
>     }
>
>
> +    /**
> +     * Send a pong message to the client
> +     *
> +     * @param data      Optional message.
> +     *
> +     * @throws IOException  If an error occurs writing to the client
> +     */
>     public void pong(ByteBuffer data) throws IOException {
>         // TODO Think about threading requirements for writing. This is not
>         // currently thread safe and writing almost certainly needs to be.
>

in the pong() method the following:
276 	  	  	upgradeOutbound.write(data.limit());
277 	  	  	upgradeOutbound.write(data.array(), 0, data.limit());
assumes that data.position() is 0.
I am not sure that we can assume that in this public method.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message