String clientPagePath = socket.getPagePath();
if (clientPagePath != null && !clientPagePath.equals(URIUtil.encodePath(pagePath))) {
continue;
}
Session session = socket.getSession();
webSocketData.setCallback(socket.getCallback());
if ((session != null)) { //&& socket.isAuthenticated()) {
List<? extends GraphObject> result = webSocketData.getResult();
if ((result != null) && (result.size() > 0)
&& (webSocketData.getCommand().equals("UPDATE") || webSocketData.getCommand().equals("ADD") || webSocketData.getCommand().equals("CREATE"))) {
WebSocketMessage clientData = webSocketData.copy();
SecurityContext securityContext = socket.getSecurityContext();
// For non-authenticated clients, construct a security context without user
if (securityContext == null) {
try {
securityContext = SecurityContext.getInstance(null, AccessMode.Frontend);
} catch (FrameworkException ex) {
continue;
}
}
clientData.setResult(filter(securityContext, result));
message = gson.toJson(clientData, WebSocketMessage.class);
} else {
message = gson.toJson(webSocketData, WebSocketMessage.class);
}
//logger.log(Level.INFO, "############################################################ SENDING \n{0}", message);
try {
session.getRemote().sendString(message);
} catch (Throwable t) {
if (t instanceof WebSocketException) {