Apache Tomcat 7.0.28

org.apache.catalina.websocket
Class MessageInbound

java.lang.Object
  extended by org.apache.catalina.websocket.StreamInbound
      extended by org.apache.catalina.websocket.MessageInbound
All Implemented Interfaces:
UpgradeInbound

public abstract class MessageInbound
extends StreamInbound

Base implementation of the class used to process WebSocket connections based on messages. Applications should extend this class to provide application specific functionality. Applications that wish to operate on a stream basis rather than a message basis should use StreamInbound.


Constructor Summary
MessageInbound()
           
 
Method Summary
 int getByteBufferMaxSize()
          Obtain the current maximum size (in bytes) of the buffer used for binary messages.
 int getCharBufferMaxSize()
          Obtain the current maximum size (in characters) of the buffer used for binary messages.
protected  void onBinaryData(InputStream is)
          This method is called when there is a binary WebSocket message available to process.
protected abstract  void onBinaryMessage(ByteBuffer message)
          This method is called when there is a binary WebSocket message available to process.
protected  void onTextData(Reader r)
          This method is called when there is a textual WebSocket message available to process.
protected abstract  void onTextMessage(CharBuffer message)
          This method is called when there is a textual WebSocket message available to process.
 void setByteBufferMaxSize(int byteBufferMaxSize)
          Set the maximum size (in bytes) of the buffer used for binary messages.
 void setCharBufferMaxSize(int charBufferMaxSize)
          Set the maximum size (in characters) of the buffer used for textual messages.
 
Methods inherited from class org.apache.catalina.websocket.StreamInbound
getOutboundByteBufferSize, getOutboundCharBufferSize, getReadTimeout, getWsOutbound, onClose, onData, onOpen, onUpgradeComplete, setOutboundByteBufferSize, setOutboundCharBufferSize, setUpgradeOutbound, setUpgradeProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageInbound

public MessageInbound()
Method Detail

onBinaryData

protected final void onBinaryData(InputStream is)
                           throws IOException
Description copied from class: StreamInbound
This method is called when there is a binary WebSocket message available to process. The message is presented via a stream and may be formed from one or more frames. The number of frames used to transmit the message is not made visible to the application.

Specified by:
onBinaryData in class StreamInbound
Parameters:
is - The WebSocket message
Throws:
IOException - If a problem occurs processing the message. Any exception will trigger the closing of the WebSocket connection.

onTextData

protected final void onTextData(Reader r)
                         throws IOException
Description copied from class: StreamInbound
This method is called when there is a textual WebSocket message available to process. The message is presented via a reader and may be formed from one or more frames. The number of frames used to transmit the message is not made visible to the application.

Specified by:
onTextData in class StreamInbound
Parameters:
r - The WebSocket message
Throws:
IOException - If a problem occurs processing the message. Any exception will trigger the closing of the WebSocket connection.

getByteBufferMaxSize

public final int getByteBufferMaxSize()
Obtain the current maximum size (in bytes) of the buffer used for binary messages.


setByteBufferMaxSize

public final void setByteBufferMaxSize(int byteBufferMaxSize)
Set the maximum size (in bytes) of the buffer used for binary messages.


getCharBufferMaxSize

public final int getCharBufferMaxSize()
Obtain the current maximum size (in characters) of the buffer used for binary messages.


setCharBufferMaxSize

public final void setCharBufferMaxSize(int charBufferMaxSize)
Set the maximum size (in characters) of the buffer used for textual messages.


onBinaryMessage

protected abstract void onBinaryMessage(ByteBuffer message)
                                 throws IOException
This method is called when there is a binary WebSocket message available to process. The message is presented via a ByteBuffer and may have been formed from one or more frames. The number of frames used to transmit the message is not made visible to the application.

Parameters:
message - The WebSocket message
Throws:
IOException - If a problem occurs processing the message. Any exception will trigger the closing of the WebSocket connection.

onTextMessage

protected abstract void onTextMessage(CharBuffer message)
                               throws IOException
This method is called when there is a textual WebSocket message available to process. The message is presented via a CharBuffer and may have been formed from one or more frames. The number of frames used to transmit the message is not made visible to the application.

Parameters:
message - The WebSocket message
Throws:
IOException - If a problem occurs processing the message. Any exception will trigger the closing of the WebSocket connection.

Apache Tomcat 7.0.28

Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.