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); } }