Codota Logo
TextWebSocketFrame.getText
Code IndexAdd Codota to your IDE (free)

How to use
getText
method
in
io.netty.handler.codec.http.websocketx.TextWebSocketFrame

Best Java code snippets using io.netty.handler.codec.http.websocketx.TextWebSocketFrame.getText (Showing top 3 results out of 315)

  • Common ways to obtain TextWebSocketFrame
private void myMethod () {
TextWebSocketFrame t =
  • Codota IconByteBuf binaryData;new TextWebSocketFrame(binaryData)
  • Codota IconString text;new TextWebSocketFrame(text)
  • Codota IconWebSocketFrame webSocketFrame;(TextWebSocketFrame) webSocketFrame.retainedDuplicate()
  • Smart code suggestions by Codota
}
origin: org.jboss.errai.io.netty/netty-example

@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
  Channel ch = ctx.getChannel();
  if (!handshaker.isHandshakeComplete()) {
    handshaker.finishHandshake(ch, (HttpResponse) e.getMessage());
    System.out.println("WebSocket Client connected!");
    return;
  }
  if (e.getMessage() instanceof HttpResponse) {
    HttpResponse response = (HttpResponse) e.getMessage();
    throw new Exception("Unexpected HttpResponse (status=" + response.getStatus() + ", content="
        + response.getContent().toString(CharsetUtil.UTF_8) + ")");
  }
  WebSocketFrame frame = (WebSocketFrame) e.getMessage();
  if (frame instanceof TextWebSocketFrame) {
    TextWebSocketFrame textFrame = (TextWebSocketFrame) frame;
    System.out.println("WebSocket Client received message: " + textFrame.getText());
  } else if (frame instanceof PongWebSocketFrame) {
    System.out.println("WebSocket Client received pong");
  } else if (frame instanceof CloseWebSocketFrame) {
    System.out.println("WebSocket Client received closing");
    ch.close();
  }
}
origin: org.jboss.errai.io.netty/netty-example

private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
  // Check for closing frame
  if (frame instanceof CloseWebSocketFrame) {
    this.handshaker.close(ctx.getChannel(), (CloseWebSocketFrame) frame);
    return;
  } else if (frame instanceof PingWebSocketFrame) {
    ctx.getChannel().write(new PongWebSocketFrame(frame.getBinaryData()));
    return;
  } else if (!(frame instanceof TextWebSocketFrame)) {
    throw new UnsupportedOperationException(String.format("%s frame types not supported", frame.getClass()
        .getName()));
  }
  // Send the uppercase string back.
  String request = ((TextWebSocketFrame) frame).getText();
  if (logger.isDebugEnabled()) {
    logger.debug(String.format("Channel %s received %s", ctx.getChannel().getId(), request));
  }
  ctx.getChannel().write(new TextWebSocketFrame(request.toUpperCase()));
}
origin: org.jboss.errai.io.netty/netty-example

private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
  // Check for closing frame
  if (frame instanceof CloseWebSocketFrame) {
    this.handshaker.close(ctx.getChannel(), (CloseWebSocketFrame) frame);
    return;
  } else if (frame instanceof PingWebSocketFrame) {
    ctx.getChannel().write(new PongWebSocketFrame(frame.getBinaryData()));
    return;
  } else if (!(frame instanceof TextWebSocketFrame)) {
    throw new UnsupportedOperationException(String.format("%s frame types not supported", frame.getClass()
        .getName()));
  }
  // Send the uppercase string back.
  String request = ((TextWebSocketFrame) frame).getText();
  if (logger.isDebugEnabled()) {
    logger.debug(String.format("Channel %s received %s", ctx.getChannel().getId(), request));
  }
  ctx.getChannel().write(new TextWebSocketFrame(request.toUpperCase()));
}
io.netty.handler.codec.http.websocketxTextWebSocketFramegetText

Popular methods of TextWebSocketFrame

  • <init>
    Creates a new text frame with the specified text string. The final fragment flag is set to true.
  • text
    Returns the text data in this frame
  • content
  • isFinalFragment
  • fromText
  • retain
  • rsv
  • copy
  • release

Popular in Java

  • Parsing JSON documents to java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • notifyDataSetChanged (ArrayAdapter)
  • getExternalFilesDir (Context)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now