Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take ReaderInterceptor into account when reading SSE events #36490

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.ext.ReaderInterceptor;
import jakarta.ws.rs.sse.InboundSseEvent;
import jakarta.ws.rs.sse.SseEvent;

Expand All @@ -24,12 +25,18 @@ public class InboundSseEventImpl implements InboundSseEvent {
private String data;
private MediaType mediaType;
private long reconnectDelay = SseEvent.RECONNECT_NOT_SET;
private Serialisers serialisers;
private ConfigurationImpl configuration;
private final Serialisers serialisers;
private final ConfigurationImpl configuration;
private final ReaderInterceptor[] interceptors;

public InboundSseEventImpl(ConfigurationImpl configuration, Serialisers serialisers) {
this.configuration = configuration;
this.serialisers = serialisers;
var interceptors = Serialisers.NO_READER_INTERCEPTOR;
if ((configuration != null) && configuration.getReaderInterceptors() != null) {
interceptors = configuration.getReaderInterceptors().toArray(Serialisers.NO_READER_INTERCEPTOR);
}
this.interceptors = interceptors;
}

public MediaType getMediaType() {
Expand Down Expand Up @@ -122,7 +129,7 @@ public <T> T readData(GenericType<T> type, MediaType mediaType) {
try {
return (T) ClientSerialisers.invokeClientReader(null, type.getRawType(), type.getType(),
mediaType, null, null, new QuarkusMultivaluedHashMap<>(),
serialisers, in, Serialisers.NO_READER_INTERCEPTOR, configuration);
serialisers, in, interceptors, configuration);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down
Loading