public class WebDataMessage extends WebMessage
A message that can be received from or sent to a web client, and contains only data (and no metadata like headers).
| Constructor and Description |
|---|
WebDataMessage(ActorRef<? super WebDataMessage> from,
ByteBuffer body)
Constructs a
WebDataMessage with a binary body. |
WebDataMessage(ActorRef<? super WebDataMessage> from,
String body)
Constructs a
WebDataMessage with a text body. |
| Modifier and Type | Method and Description |
|---|---|
protected String |
contentString() |
ByteBuffer |
getByteBufferBody()
The message’s binary body, if it has one;
null otherwise. |
ActorRef<WebDataMessage> |
getFrom()
The actor that sent this message.
|
String |
getStringBody()
The message’s text body, if it has one;
null otherwise. |
boolean |
isBinary()
Whether this is a binary message or a text message.
|
toStringpublic WebDataMessage(ActorRef<? super WebDataMessage> from, String body)
Constructs a WebDataMessage with a text body.
from - the message senderbody - the message bodypublic WebDataMessage(ActorRef<? super WebDataMessage> from, ByteBuffer body)
Constructs a WebDataMessage with a binary body.
from - the message senderbody - the message bodypublic ActorRef<WebDataMessage> getFrom()
WebMessageThe actor that sent this message. This can be a virtual actor representing the web client.
getFrom in interface FromMessagegetFrom in class WebMessagepublic boolean isBinary()
Whether this is a binary message or a text message.
true if this is a binary message; false if this is a text mesasge.public String getStringBody()
WebMessageThe message’s text body, if it has one; null otherwise.
getStringBody in class WebMessagepublic ByteBuffer getByteBufferBody()
WebMessageThe message’s binary body, if it has one; null otherwise.
getByteBufferBody in class WebMessageprotected String contentString()
contentString in class WebMessage