public class HttpMessageConverters extends Object implements Iterable<HttpMessageConverter<?>>
HttpMessageConverter
s used in a Spring Boot
application. Provides a convenient way to add and merge additional
HttpMessageConverter
s to a web application.
An instance of this bean can be registered with specific
additional converters
if
needed, otherwise default converters will be used.
NOTE: The default converters used are the same as standard Spring MVC (see
WebMvcConfigurationSupport.getMessageConverters()
with some slight re-ordering to
put XML converters at the back of the list.
HttpMessageConverters(HttpMessageConverter...)
,
HttpMessageConverters(Collection)
,
getConverters()
Constructor and Description |
---|
HttpMessageConverters(boolean addDefaultConverters,
Collection<HttpMessageConverter<?>> converters)
Create a new
HttpMessageConverters instance with the specified converters. |
HttpMessageConverters(Collection<HttpMessageConverter<?>> additionalConverters)
Create a new
HttpMessageConverters instance with the specified additional
converters. |
HttpMessageConverters(HttpMessageConverter<?>... additionalConverters)
Create a new
HttpMessageConverters instance with the specified additional
converters. |
Modifier and Type | Method and Description |
---|---|
List<HttpMessageConverter<?>> |
getConverters()
Return an immutable list of the converters in the order that they will be
registered.
|
Iterator<HttpMessageConverter<?>> |
iterator() |
protected List<HttpMessageConverter<?>> |
postProcessConverters(List<HttpMessageConverter<?>> converters)
Method that can be used to post-process the
HttpMessageConverter list
before it is used. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public HttpMessageConverters(HttpMessageConverter<?>... additionalConverters)
HttpMessageConverters
instance with the specified additional
converters.additionalConverters
- additional converters to be added. New converters will
be added to the front of the list, overrides will replace existing items without
changing the order. The getConverters()
methods can be used for further
converter manipulation.public HttpMessageConverters(Collection<HttpMessageConverter<?>> additionalConverters)
HttpMessageConverters
instance with the specified additional
converters.additionalConverters
- additional converters to be added. Items are added just
before any default converter of the same type (or at the front of the list if no
default converter is found) The postProcessConverters(List)
method can be
used for further converter manipulation.public HttpMessageConverters(boolean addDefaultConverters, Collection<HttpMessageConverter<?>> converters)
HttpMessageConverters
instance with the specified converters.addDefaultConverters
- if default converters should be addedconverters
- converters to be added. Items are added just before any default
converter of the same type (or at the front of the list if no default converter is
found) The postProcessConverters(List)
method can be used for further
converter manipulation.protected List<HttpMessageConverter<?>> postProcessConverters(List<HttpMessageConverter<?>> converters)
HttpMessageConverter
list
before it is used.converters
- a mutable list of the converters that will be used.public Iterator<HttpMessageConverter<?>> iterator()
iterator
in interface Iterable<HttpMessageConverter<?>>
public List<HttpMessageConverter<?>> getConverters()
Copyright © 2015 Pivotal Software, Inc.. All rights reserved.