Package org.glassfish.jersey.server
Class ChunkedOutput<T>
java.lang.Object
jakarta.ws.rs.core.GenericType<T>
org.glassfish.jersey.server.ChunkedOutput<T>
- Type Parameters:
- T- chunk type.
- All Implemented Interfaces:
- Closeable,- AutoCloseable
- Direct Known Subclasses:
- EventOutput
Used for sending messages in "typed" chunks. Useful for long running processes,
 which needs to produce partial responses.
- Author:
- Pavel Bucek, Martin Matula, Marek Potociar
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classBuilder that allows to create a new ChunkedOutput based on the given configuration options.static classBuilder that allows to create a new ChunkedOutput based on the given configuration options.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedCreate newChunkedOutput.protectedChunkedOutput(byte[] chunkDelimiter) Create newChunkedOutputwith a custom chunk delimiter.protectedChunkedOutput(byte[] chunkDelimiter, jakarta.inject.Provider<AsyncContext> asyncContextProvider) Create newChunkedOutputwith a custom chunk delimiter.ChunkedOutput(Type chunkType) CreateChunkedOutputwith specified type.ChunkedOutput(Type chunkType, byte[] chunkDelimiter) Create newChunkedOutputwith a custom chunk delimiter.ChunkedOutput(Type chunkType, String chunkDelimiter) Create newChunkedOutputwith a custom chunk delimiter.protectedChunkedOutput(String chunkDelimiter) Create newChunkedOutputwith a custom chunk delimiter.protectedChunkedOutput(ChunkedOutput.Builder<T> builder) Create newChunkedOutputbased on builder.
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> ChunkedOutput.Builder<T>builder()Returns a builder to create a ChunkedOutput with custom configuration.static <T> ChunkedOutput.TypedBuilder<T>Returns a builder to create a ChunkedOutput with custom configuration.voidclose()Close this response - it will be finalized and underlying connections will be closed or made available for another response.booleanprotected voidinthashCode()booleanisClosed()Get state information.protected voidExecuted only in case of close being triggered by client.toString()voidWrite a chunk.Methods inherited from class jakarta.ws.rs.core.GenericTypeforInstance, getRawType, getType
- 
Constructor Details- 
ChunkedOutputprotected ChunkedOutput()Create newChunkedOutput.
- 
ChunkedOutputCreate newChunkedOutputbased on builder.- Parameters:
- builder- the builder to use
 
- 
ChunkedOutputCreateChunkedOutputwith specified type.- Parameters:
- chunkType- chunk type. Must not be {code null}.
 
- 
ChunkedOutputprotected ChunkedOutput(byte[] chunkDelimiter) Create newChunkedOutputwith a custom chunk delimiter.- Parameters:
- chunkDelimiter- custom chunk delimiter bytes. Must not be {code null}.
- Since:
- 2.4.1
 
- 
ChunkedOutputprotected ChunkedOutput(byte[] chunkDelimiter, jakarta.inject.Provider<AsyncContext> asyncContextProvider) Create newChunkedOutputwith a custom chunk delimiter.- Parameters:
- chunkDelimiter- custom chunk delimiter bytes. Must not be {code null}.
- Since:
- 2.4.1
 
- 
ChunkedOutputCreate newChunkedOutputwith a custom chunk delimiter.- Parameters:
- chunkType- chunk type. Must not be {code null}.
- chunkDelimiter- custom chunk delimiter bytes. Must not be {code null}.
- Since:
- 2.4.1
 
- 
ChunkedOutputCreate newChunkedOutputwith a custom chunk delimiter.- Parameters:
- chunkDelimiter- custom chunk delimiter string. Must not be {code null}.
- Since:
- 2.4.1
 
- 
ChunkedOutputCreate newChunkedOutputwith a custom chunk delimiter.- Parameters:
- chunkType- chunk type. Must not be {code null}.
- chunkDelimiter- custom chunk delimiter string. Must not be {code null}.
- Since:
- 2.4.1
 
 
- 
- 
Method Details- 
builderReturns a builder to create a ChunkedOutput with custom configuration.- Returns:
- builder
 
- 
builderReturns a builder to create a ChunkedOutput with custom configuration.- Parameters:
- chunkType- chunk type. Must not be {code null}.
- Returns:
- builder
 
- 
writeWrite a chunk.- Parameters:
- chunk- a chunk instance to be written.
- Throws:
- IOException- if this response is closed or when encountered any problem during serializing or writing a chunk.
 
- 
flushQueue- Throws:
- IOException
 
- 
closeClose this response - it will be finalized and underlying connections will be closed or made available for another response.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
- 
isClosedpublic boolean isClosed()Get state information. Please note thatChunkedOutputcan be closed by the client side - client can close connection from its side.- Returns:
- true when closed, false otherwise.
 
- 
onCloseExecuted only in case of close being triggered by client.- Parameters:
- e- Exception causing the close
 
- 
equals- Overrides:
- equalsin class- GenericType<T>
 
- 
hashCodepublic int hashCode()- Overrides:
- hashCodein class- GenericType<T>
 
- 
toString- Overrides:
- toStringin class- GenericType<T>
 
 
-