Package io.micronaut.http.body
Class ContextlessMessageBodyHandlerRegistry
java.lang.Object
io.micronaut.http.body.ContextlessMessageBodyHandlerRegistry
- All Implemented Interfaces:
MessageBodyHandlerRegistry
MessageBodyHandlerRegistry implementation that does not need an application context.- Since:
- 4.0.0
-
Field Summary
Fields inherited from interface io.micronaut.http.body.MessageBodyHandlerRegistry
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionContextlessMessageBodyHandlerRegistry(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.micronaut.core.io.buffer.ByteBufferFactory<?, ?> byteBufferFactory, RawMessageBodyHandler<?>... otherRawHandlers) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(@NonNull MediaType mediaType, @NonNull MessageBodyHandler<?> handler) Add aMessageBodyHandlerfor the given media type.<T> Optional<MessageBodyReader<T>>findReader(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaTypes) Find a reader for the type and annotation metadata at declaration point.protected <T> MessageBodyReader<T>findReaderImpl(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaTypes) <T> Optional<MessageBodyWriter<T>>findWriter(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaType) Find a writer for the type and annotation metadata at declaration point.protected <T> MessageBodyWriter<T>findWriterImpl(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaTypes)
-
Constructor Details
-
ContextlessMessageBodyHandlerRegistry
public ContextlessMessageBodyHandlerRegistry(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.micronaut.core.io.buffer.ByteBufferFactory<?, ?> byteBufferFactory, RawMessageBodyHandler<?>... otherRawHandlers) - Parameters:
applicationConfiguration- The configurationbyteBufferFactory- The buffer factoryotherRawHandlers- Raw handlers to add on top of the default ones
-
-
Method Details
-
add
public void add(@NonNull @NonNull MediaType mediaType, @NonNull @NonNull MessageBodyHandler<?> handler) Add aMessageBodyHandlerfor the given media type.- Parameters:
mediaType- The media type the handler applies tohandler- The handler
-
findReaderImpl
protected <T> MessageBodyReader<T> findReaderImpl(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaTypes) -
findWriterImpl
protected <T> MessageBodyWriter<T> findWriterImpl(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaTypes) -
findReader
public <T> Optional<MessageBodyReader<T>> findReader(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaTypes) Description copied from interface:MessageBodyHandlerRegistryFind a reader for the type and annotation metadata at declaration point.- Specified by:
findReaderin interfaceMessageBodyHandlerRegistry- Type Parameters:
T- The generic type- Parameters:
type- The typemediaTypes- The media type- Returns:
- A message body reader if it is existing.
-
findWriter
public <T> Optional<MessageBodyWriter<T>> findWriter(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaType) Description copied from interface:MessageBodyHandlerRegistryFind a writer for the type and annotation metadata at declaration point.- Specified by:
findWriterin interfaceMessageBodyHandlerRegistry- Type Parameters:
T- The generic type- Parameters:
type- The typemediaType- The media type- Returns:
- A message body writer if it is existing.
-