//~--- methods --------------------------------------------------------
@Override
public void processMessage(WebSocketMessage webSocketData) {
final SecurityContext securityContext = getWebSocket().getSecurityContext();
try {
int sequenceNumber = ((Long) webSocketData.getNodeData().get("chunkId")).intValue();
int chunkSize = ((Long) webSocketData.getNodeData().get("chunkSize")).intValue();
Object rawData = webSocketData.getNodeData().get("chunk");
int chunks = ((Long) webSocketData.getNodeData().get("chunks")).intValue();
String uuid = webSocketData.getId();
byte[] data = null;
if (rawData != null) {
if (rawData instanceof String) {
logger.log(Level.FINEST, "Raw data: {0}", rawData);
// data = Base64.decodeBase64(((String)rawData).getBytes("UTF-8"));
data = Base64.decodeBase64(((String) rawData));
logger.log(Level.FINEST, "Decoded data: {0}", data);
}
}
final File file = (File) getNode(uuid);
if (!securityContext.isAllowed(file, Permission.write)) {
logger.log(Level.WARNING, "No write permission for {0} on {1}", new Object[] {getWebSocket().getCurrentUser().toString(), file.toString()});
getWebSocket().send(MessageBuilder.status().message("No write permission").code(400).build(), true);
return;