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
- Author:
- Jonas Konrad
-
Field Summary
Fields inherited from interface io.micronaut.http.body.MessageBodyHandlerRegistry
EMPTY
-
Constructor Summary
ConstructorDescriptionContextlessMessageBodyHandlerRegistry
(ApplicationConfiguration applicationConfiguration, ByteBufferFactory<?, ?> byteBufferFactory, RawMessageBodyHandler<?>... otherRawHandlers) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(@NonNull MediaType mediaType, @NonNull MessageBodyHandler<?> handler) Add aMessageBodyHandler
for the given media type.<T> Optional<MessageBodyReader<T>>
findReader
(Argument<T> type, List<MediaType> mediaTypes) Find a reader for the type and annotation metadata at declaration point.protected <T> MessageBodyReader<T>
findReaderImpl
(Argument<T> type, List<MediaType> mediaTypes) <T> Optional<MessageBodyWriter<T>>
findWriter
(Argument<T> type, List<MediaType> mediaType) Find a writer for the type and annotation metadata at declaration point.protected <T> MessageBodyWriter<T>
findWriterImpl
(Argument<T> type, List<MediaType> mediaTypes)
-
Constructor Details
-
ContextlessMessageBodyHandlerRegistry
public ContextlessMessageBodyHandlerRegistry(ApplicationConfiguration applicationConfiguration, 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 aMessageBodyHandler
for the given media type.- Parameters:
mediaType
- The media type the handler applies tohandler
- The handler
-
findReaderImpl
-
findWriterImpl
-
findReader
Description copied from interface:MessageBodyHandlerRegistry
Find a reader for the type and annotation metadata at declaration point.- Specified by:
findReader
in interfaceMessageBodyHandlerRegistry
- Type Parameters:
T
- The generic type- Parameters:
type
- The typemediaTypes
- The media type- Returns:
- A message body reader if it is exists.
-
findWriter
Description copied from interface:MessageBodyHandlerRegistry
Find a writer for the type and annotation metadata at declaration point.- Specified by:
findWriter
in interfaceMessageBodyHandlerRegistry
- Type Parameters:
T
- The generic type- Parameters:
type
- The typemediaType
- The media type- Returns:
- A message body writer if it is exists.
-