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.
|
toString
public 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()
WebMessage
The actor that sent this message. This can be a virtual actor representing the web client.
getFrom
in interface FromMessage
getFrom
in class WebMessage
public 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()
WebMessage
The message’s text body, if it has one; null
otherwise.
getStringBody
in class WebMessage
public ByteBuffer getByteBufferBody()
WebMessage
The message’s binary body, if it has one; null
otherwise.
getByteBufferBody
in class WebMessage
protected String contentString()
contentString
in class WebMessage