Auto-set content-length to STOMP 1.0 frames

As recommended by the 1.0 spec.
This commit is contained in:
Ville Skyttä 2015-07-21 19:04:08 +03:00
parent 8353bd1f77
commit 0b3a64c5e8
1 changed files with 7 additions and 0 deletions

View File

@ -128,6 +128,13 @@ public class StompFrame
head.append(header.getValue());
head.append(Stomp.NEWLINE);
}
if (bytesBody != null && bytesBody.length > 0 && !hasHeader(Stomp.Headers.CONTENT_LENGTH))
{
head.append(Stomp.Headers.CONTENT_LENGTH);
head.append(Stomp.Headers.SEPARATOR);
head.append(bytesBody.length);
head.append(Stomp.NEWLINE);
}
// Add a newline to separate the headers from the content.
head.append(Stomp.NEWLINE);