Skip to content

Commit

Permalink
Polish PublisherResponseHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Dec 4, 2024
1 parent 0ac0e12 commit 316424b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,32 +312,32 @@ private boolean requiresChunkedStream(MediaType mediaType) {
|| mediaType.isCompatible(RestMediaType.APPLICATION_STREAM_JSON_TYPE);
}

@SuppressWarnings("rawtypes")
private void handleChunkedStreaming(ResteasyReactiveRequestContext requestContext, Publisher<?> result, boolean json) {
long demand = 1L;
if (result instanceof RestMulti.SyncRestMulti) {
RestMulti.SyncRestMulti rest = (RestMulti.SyncRestMulti) result;
if (result instanceof RestMulti.SyncRestMulti rest) {
demand = rest.getDemand();
}
result.subscribe(
new StreamingMultiSubscriber(requestContext, streamingResponseCustomizers, result, json, demand, false));
}

@SuppressWarnings("rawtypes")
private void handleStreaming(ResteasyReactiveRequestContext requestContext, Publisher<?> result, boolean json) {
long demand = 1L;
boolean encodeAsJsonArray = true;
if (result instanceof RestMulti.SyncRestMulti) {
RestMulti.SyncRestMulti rest = (RestMulti.SyncRestMulti) result;
if (result instanceof RestMulti.SyncRestMulti rest) {
demand = rest.getDemand();
encodeAsJsonArray = rest.encodeAsJsonArray();
}
result.subscribe(new StreamingMultiSubscriber(requestContext, streamingResponseCustomizers, result, json, demand,
encodeAsJsonArray));
}

@SuppressWarnings("rawtypes")
private void handleSse(ResteasyReactiveRequestContext requestContext, Publisher<?> result) {
long demand;
if (result instanceof RestMulti.SyncRestMulti) {
RestMulti.SyncRestMulti rest = (RestMulti.SyncRestMulti) result;
if (result instanceof RestMulti.SyncRestMulti rest) {
demand = rest.getDemand();
} else {
demand = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class SseEventSinkImpl implements SseEventSink {

public static final byte[] EMPTY_BUFFER = new byte[0];
private ResteasyReactiveRequestContext context;
private final ResteasyReactiveRequestContext context;
private SseBroadcasterImpl broadcaster;
private boolean closed;

Expand Down

0 comments on commit 316424b

Please sign in to comment.