Class SourceWrappers
- java.lang.Object
-
- io.servicetalk.http.router.jersey.internal.SourceWrappers
-
public final class SourceWrappers extends java.lang.ObjectWhen request's contents are not buffered, Jersey's determines if the entity body input stream that backs a request can be closed by introspecting the return type of theMessageBodyReader. If the return type is aCloseableor aSourcethen it doesn't close it, otherwise it closes it.We have
MessageBodyReaders that deliver content as RS sources: in that case we do not want Jersey to close the backing input stream because the content has not been consumed yet when exiting theMessageBodyReader.readFrom(Class, Type, Annotation[], MediaType, MultivaluedMap, InputStream)method.Since RS sources don't implement
CloseablenorSource, this class provides wrappers that implement the latter, allowing us to prevent an untimely closure of the entity input stream.Note that this is only necessary when a user-provided entity input stream is used, which can only happen when a filter or interceptor has replaced the one we've put in place at request creation time. Indeed, the
close()method of the entity stream we initially provide (BufferPublisherInputStream) is a no-op so it doesn't matter if it gets called.- See Also:
InboundMessageContext.readEntity(Class, Type, Annotation[], PropertiesDelegate)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSourceWrappers.PublisherSource<T>APublisherthat is also aSource.static classSourceWrappers.SingleSource<T>ASinglethat is also aSource.
-