MessageHandler$Whole
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using javax.websocket.MessageHandler$Whole (Showing top 20 results out of 315)

origin: org.glassfish.tyrus/tyrus-core

void notifyPongHandler(PongMessage pongMessage) {
  final Set<MessageHandler> messageHandlers = getMessageHandlers();
  for (MessageHandler handler : messageHandlers) {
    if (MessageHandlerManager.getHandlerType(handler).equals(PongMessage.class)) {
      ((MessageHandler.Whole<PongMessage>) handler).onMessage(pongMessage);
    }
  }
}
origin: org.jboss.web/jbossweb

@SuppressWarnings("unchecked")
private void sendMessageBinary(ByteBuffer msg, boolean last)
    throws WsIOException {
  if (binaryMsgHandler instanceof WrappedMessageHandler) {
    long maxMessageSize =
        ((WrappedMessageHandler) binaryMsgHandler).getMaxMessageSize();
    if (maxMessageSize > -1 && msg.remaining() > maxMessageSize) {
      throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
          MESSAGES.messageTooLarge(
              Long.valueOf(msg.remaining()),
              Long.valueOf(maxMessageSize))));
    }
  }
  try {
    if (binaryMsgHandler instanceof MessageHandler.Partial<?>) {
      ((MessageHandler.Partial<ByteBuffer>) binaryMsgHandler).onMessage(msg, last);
    } else {
      // Caller ensures last == true if this branch is used
      ((MessageHandler.Whole<ByteBuffer>) binaryMsgHandler).onMessage(msg);
    }
  } catch(Throwable t) {
    handleThrowableOnSend(t);
  }
}
origin: codefollower/Tomcat-Research

@SuppressWarnings("unchecked")
private void sendMessageBinary(ByteBuffer msg, boolean last)
    throws WsIOException {
  if (binaryMsgHandler instanceof WrappedMessageHandler) {
    long maxMessageSize =
        ((WrappedMessageHandler) binaryMsgHandler).getMaxMessageSize();
    if (maxMessageSize > -1 && msg.remaining() > maxMessageSize) {
      throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
          sm.getString("wsFrame.messageTooBig",
              Long.valueOf(msg.remaining()),
              Long.valueOf(maxMessageSize))));
    }
  }
  try {
    if (binaryMsgHandler instanceof MessageHandler.Partial<?>) {
      ((MessageHandler.Partial<ByteBuffer>) binaryMsgHandler).onMessage(msg, last);
    } else {
      // Caller ensures last == true if this branch is used
      ((MessageHandler.Whole<ByteBuffer>) binaryMsgHandler).onMessage(msg);
    }
  } catch(Throwable t) {
    ExceptionUtils.handleThrowable(t);
    wsSession.getLocal().onError(wsSession, t);
  }
}
origin: org.apache.tomcat/tomcat7-websocket

@SuppressWarnings("unchecked")
private void sendMessageBinary(ByteBuffer msg, boolean last)
    throws WsIOException {
  if (binaryMsgHandler instanceof WrappedMessageHandler) {
    long maxMessageSize =
        ((WrappedMessageHandler) binaryMsgHandler).getMaxMessageSize();
    if (maxMessageSize > -1 && msg.remaining() > maxMessageSize) {
      throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
          sm.getString("wsFrame.messageTooBig",
              Long.valueOf(msg.remaining()),
              Long.valueOf(maxMessageSize))));
    }
  }
  try {
    if (binaryMsgHandler instanceof MessageHandler.Partial<?>) {
      ((MessageHandler.Partial<ByteBuffer>) binaryMsgHandler).onMessage(msg, last);
    } else {
      // Caller ensures last == true if this branch is used
      ((MessageHandler.Whole<ByteBuffer>) binaryMsgHandler).onMessage(msg);
    }
  } catch(Throwable t) {
    handleThrowableOnSend(t);
  }
}
origin: org.apache.tomcat/tomcat-websocket

@SuppressWarnings("unchecked")
protected void sendMessageBinary(ByteBuffer msg, boolean last) throws WsIOException {
  if (binaryMsgHandler instanceof WrappedMessageHandler) {
    long maxMessageSize = ((WrappedMessageHandler) binaryMsgHandler).getMaxMessageSize();
    if (maxMessageSize > -1 && msg.remaining() > maxMessageSize) {
      throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
          sm.getString("wsFrame.messageTooBig",
              Long.valueOf(msg.remaining()),
              Long.valueOf(maxMessageSize))));
    }
  }
  try {
    if (binaryMsgHandler instanceof MessageHandler.Partial<?>) {
      ((MessageHandler.Partial<ByteBuffer>) binaryMsgHandler).onMessage(msg, last);
    } else {
      // Caller ensures last == true if this branch is used
      ((MessageHandler.Whole<ByteBuffer>) binaryMsgHandler).onMessage(msg);
    }
  } catch (Throwable t) {
    handleThrowableOnSend(t);
  }
}
origin: codefollower/Tomcat-Research

@SuppressWarnings("unchecked")
private void sendMessageText(boolean last) throws WsIOException {
  if (textMsgHandler instanceof WrappedMessageHandler) {
    long maxMessageSize =
        ((WrappedMessageHandler) textMsgHandler).getMaxMessageSize();
    if (maxMessageSize > -1 &&
        messageBufferText.remaining() > maxMessageSize) {
      throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
          sm.getString("wsFrame.messageTooBig",
              Long.valueOf(messageBufferText.remaining()),
              Long.valueOf(maxMessageSize))));
    }
  }
  try {
    if (textMsgHandler instanceof MessageHandler.Partial<?>) {
      ((MessageHandler.Partial<String>) textMsgHandler).onMessage(
          messageBufferText.toString(), last);
    } else {
      // Caller ensures last == true if this branch is used
      ((MessageHandler.Whole<String>) textMsgHandler).onMessage(
          messageBufferText.toString());
    }
  } catch (Throwable t) {
    ExceptionUtils.handleThrowable(t);
    wsSession.getLocal().onError(wsSession, t);
  } finally {
    messageBufferText.clear();
  }
}
origin: org.jboss.web/jbossweb

@SuppressWarnings("unchecked")
private void sendMessageText(boolean last) throws WsIOException {
  if (textMsgHandler instanceof WrappedMessageHandler) {
    long maxMessageSize =
        ((WrappedMessageHandler) textMsgHandler).getMaxMessageSize();
    if (maxMessageSize > -1 &&
        messageBufferText.remaining() > maxMessageSize) {
      throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
          MESSAGES.messageTooLarge(Long.valueOf(messageBufferText.remaining()),
              Long.valueOf(maxMessageSize))));
    }
  }
  try {
    if (textMsgHandler instanceof MessageHandler.Partial<?>) {
      ((MessageHandler.Partial<String>) textMsgHandler).onMessage(
          messageBufferText.toString(), last);
    } else {
      // Caller ensures last == true if this branch is used
      ((MessageHandler.Whole<String>) textMsgHandler).onMessage(
          messageBufferText.toString());
    }
  } catch (Throwable t) {
    handleThrowableOnSend(t);
  } finally {
    messageBufferText.clear();
  }
}
origin: org.apache.tomcat/tomcat-websocket

@SuppressWarnings("unchecked")
protected void sendMessageText(boolean last) throws WsIOException {
  if (textMsgHandler instanceof WrappedMessageHandler) {
    long maxMessageSize = ((WrappedMessageHandler) textMsgHandler).getMaxMessageSize();
    if (maxMessageSize > -1 && messageBufferText.remaining() > maxMessageSize) {
      throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
          sm.getString("wsFrame.messageTooBig",
              Long.valueOf(messageBufferText.remaining()),
              Long.valueOf(maxMessageSize))));
    }
  }
  try {
    if (textMsgHandler instanceof MessageHandler.Partial<?>) {
      ((MessageHandler.Partial<String>) textMsgHandler)
          .onMessage(messageBufferText.toString(), last);
    } else {
      // Caller ensures last == true if this branch is used
      ((MessageHandler.Whole<String>) textMsgHandler)
          .onMessage(messageBufferText.toString());
    }
  } catch (Throwable t) {
    handleThrowableOnSend(t);
  } finally {
    messageBufferText.clear();
  }
}
origin: org.apache.tomcat/tomcat7-websocket

@SuppressWarnings("unchecked")
private void sendMessageText(boolean last) throws WsIOException {
  if (textMsgHandler instanceof WrappedMessageHandler) {
    long maxMessageSize =
        ((WrappedMessageHandler) textMsgHandler).getMaxMessageSize();
    if (maxMessageSize > -1 &&
        messageBufferText.remaining() > maxMessageSize) {
      throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
          sm.getString("wsFrame.messageTooBig",
              Long.valueOf(messageBufferText.remaining()),
              Long.valueOf(maxMessageSize))));
    }
  }
  try {
    if (textMsgHandler instanceof MessageHandler.Partial<?>) {
      ((MessageHandler.Partial<String>) textMsgHandler).onMessage(
          messageBufferText.toString(), last);
    } else {
      // Caller ensures last == true if this branch is used
      ((MessageHandler.Whole<String>) textMsgHandler).onMessage(
          messageBufferText.toString());
    }
  } catch (Throwable t) {
    handleThrowableOnSend(t);
  } finally {
    messageBufferText.clear();
  }
}
origin: org.glassfish.tyrus/tyrus-core

if (currentState != State.CLOSED) {
  ((MessageHandler.Whole) mh).onMessage(object);
origin: org.apache.tomcat.embed/tomcat-embed-websocket

@SuppressWarnings("unchecked")
protected void sendMessageBinary(ByteBuffer msg, boolean last) throws WsIOException {
  if (binaryMsgHandler instanceof WrappedMessageHandler) {
    long maxMessageSize = ((WrappedMessageHandler) binaryMsgHandler).getMaxMessageSize();
    if (maxMessageSize > -1 && msg.remaining() > maxMessageSize) {
      throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
          sm.getString("wsFrame.messageTooBig",
              Long.valueOf(msg.remaining()),
              Long.valueOf(maxMessageSize))));
    }
  }
  try {
    if (binaryMsgHandler instanceof MessageHandler.Partial<?>) {
      ((MessageHandler.Partial<ByteBuffer>) binaryMsgHandler).onMessage(msg, last);
    } else {
      // Caller ensures last == true if this branch is used
      ((MessageHandler.Whole<ByteBuffer>) binaryMsgHandler).onMessage(msg);
    }
  } catch (Throwable t) {
    handleThrowableOnSend(t);
  }
}
origin: eclipse-ee4j/tyrus

if (currentState != State.CLOSED) {
  ((MessageHandler.Whole) mh).onMessage(object);
origin: eclipse-ee4j/tyrus

  @Override
  public void run() {
    messageHandler.onMessage(reader);
  }
});
origin: org.apache.tomcat/tomcat-websocket

if (mhPong != null) {
  try {
    mhPong.onMessage(new WsPongMessage(controlBufferBinary));
  } catch (Throwable t) {
    handleThrowableOnSend(t);
origin: org.glassfish.tyrus/tyrus-core

  @Override
  public void run() {
    messageHandler.onMessage(reader);
  }
});
origin: org.apache.tomcat/tomcat7-websocket

if (mhPong != null) {
  try {
    mhPong.onMessage(new WsPongMessage(controlBufferBinary));
  } catch (Throwable t) {
    handleThrowableOnSend(t);
origin: org.glassfish.tyrus/tyrus-core

  @Override
  public void run() {
    messageHandler.onMessage(inputStream);
  }
});
origin: codefollower/Tomcat-Research

if (mhPong != null) {
  try {
    mhPong.onMessage(new WsPongMessage(controlBufferBinary));
  } catch (Throwable t) {
    ExceptionUtils.handleThrowable(t);
origin: eclipse-ee4j/tyrus

void notifyPongHandler(PongMessage pongMessage) {
  final Set<MessageHandler> messageHandlers = getMessageHandlers();
  for (MessageHandler handler : messageHandlers) {
    if (MessageHandlerManager.getHandlerType(handler).equals(PongMessage.class)) {
      ((MessageHandler.Whole<PongMessage>) handler).onMessage(pongMessage);
    }
  }
}
origin: org.apache.tomcat.embed/tomcat-embed-websocket

if (mhPong != null) {
  try {
    mhPong.onMessage(new WsPongMessage(controlBufferBinary));
  } catch (Throwable t) {
    handleThrowableOnSend(t);
javax.websocketMessageHandler$Whole

Javadoc

This kind of handler is notified by the container on arrival of a complete message. If the message is received in parts, the container buffers it until it is has been fully received before this method is called.

For handling incoming text messages, the allowed types for T are

  • java.lang.String
  • java.io.Reader
  • any developer object for which there is a corresponding Decoder.Text or Decoder.TextStream configured

For handling incoming binary messages, the allowed types for T are

  • java.nio.ByteBuffer
  • byte[]
  • java.io.InputStream
  • any developer object for which there is a corresponding Decoder.Binary or Decoder.BinaryStream configured

For handling incoming pong messages, the type of T is PongMessage

Developers should not continue to reference message objects of type java.io.Reader, java.nio.ByteBufferor java.io.InputStream after the completion of the onMessage() call, since they may be recycled by the implementation.

Most used methods

  • onMessage
    Called when the message has been fully received.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getExternalFilesDir (Context)
  • requestLocationUpdates (LocationManager)
  • onRequestPermissionsResult (Fragment)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Permission (java.security)
    Legacy security code; do not use.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)