use of org.eclipse.che.ide.websocket.events.ReplyHandler in project che by eclipse.
the class AbstractMessageBus method onMessageReceived.
/** {@inheritDoc} */
@Override
public void onMessageReceived(MessageReceivedEvent event) {
Message message = parseMessage(event.getMessage());
// as it might be disallowed when processing actually takes place.
if (message.getResponseCode() == 202) {
return;
}
//TODO Should be revised to remove
List<Pair> headers = message.getHeaders().toList();
if (headers != null) {
for (Pair header : headers) {
if (HTTPHeader.LOCATION.equals(header.getName()) && header.getValue().contains("async/")) {
return;
}
}
}
if (getChannel(message) != null) {
// this is a message received by subscription
processSubscriptionMessage(message);
} else {
String uuid = message.getStringField(MessageBuilder.UUID_FIELD);
ReplyHandler replyCallback = replyCallbackMap.remove(uuid);
if (replyCallback != null) {
replyCallback.onReply(message.getBody());
} else {
RequestCallback requestCallback = requestCallbackMap.remove(uuid);
if (requestCallback != null) {
requestCallback.onReply(message);
}
}
}
}
Aggregations