return; UnparsedNotification notification = new UnparsedNotification(messageNumber, resourceState, resourceId, resourceUri, channelId).setChannelExpiration(channelExpiration) .setChannelToken(channelToken) .setChanged(changed) .setContentType(req.getContentType()) .setContentStream(contentStream); StoredChannel storedChannel = channelDataStore.get(notification.getChannelId()); if (storedChannel != null) { storedChannel.getNotificationCallback().onNotification(storedChannel, notification);
public final void onNotification(StoredChannel storedChannel, UnparsedNotification notification) throws IOException { TypedNotification<T> typedNotification = new TypedNotification<T>(notification); // TODO(yanivi): how to properly detect if there is no content? String contentType = notification.getContentType(); if (contentType != null) { Charset charset = new HttpMediaType(contentType).getCharsetParameter(); Class<T> dataClass = Preconditions.checkNotNull(getDataClass()); typedNotification.setContent( getObjectParser().parseAndClose(notification.getContentStream(), charset, dataClass)); } onNotification(storedChannel, typedNotification); } }