Alfred Samanga 59ac0633fc BAEL-3352 - Websockets with the Play Framework and Akka (#7983)
* Websocket implementation

* Websocket implementation with Akka Streams

* Websocket implementation with Akka Streams

* Websocket implementation with Akka Streams

* Added configuration options for play server timeout and websocket frame lengths

* Cleaned up code for consuming http endpoint in Messenger actor

* Cleaned up code for consuming http endpoint in Messenger actor

* Cleaned up code for akka streams implementation for websocket

* Renamed unit test method

* Added Poison Pill for stopping the actor. Fixed indentations.

* Refactored the WebSocket method for readability

* Refactored the JavaScript for readability

* Code refactoring and removing unwanted comments

* Added the latest version of jQuery

* Removed .gitignore in favor of the one at the project root
2019-11-23 11:09:07 +00:00

25 lines
857 B
Java

package utils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import dto.MessageDTO;
import dto.RequestDTO;
public class MessageConverter {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
public static MessageDTO jsonNodeToMessage(JsonNode jsonNode) {
return OBJECT_MAPPER.convertValue(jsonNode, MessageDTO.class);
}
public static JsonNode messageToJsonNode(MessageDTO messageDTO) {
return OBJECT_MAPPER.convertValue(messageDTO, JsonNode.class);
}
public static RequestDTO jsonNodeToRequest(JsonNode jsonNode) {
return OBJECT_MAPPER.convertValue(jsonNode, RequestDTO.class);
}
public static JsonNode requestToJsonNode(RequestDTO requestDTO) {
return OBJECT_MAPPER.convertValue(requestDTO, JsonNode.class);
}
}