Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids. This change adds Jackson 2 as an optional dependency and also provides MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use with the new version. The MVC namespace and the MVC Java config detect and use MappingJackson2HttpMessageConverter if Jackson 2 is present. Otherwise if Jackson 1.x is present, then MappingJacksonHttpMessageConverter is used. Issue: SPR-9302
This commit is contained in:
@@ -2892,7 +2892,7 @@ public String upload(...) {
|
||||
</property>
|
||||
<property name="defaultViews">
|
||||
<list>
|
||||
<bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" />
|
||||
<bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
@@ -2924,7 +2924,7 @@ public String upload(...) {
|
||||
the <classname>SampleContentAtomView</classname> if the view name
|
||||
returned is <classname>content</classname>. If the request is made with
|
||||
the file extension <literal>.json</literal>, the
|
||||
<classname>MappingJacksonJsonView</classname> instance from the
|
||||
<classname>MappingJackson2JsonView</classname>instance from the
|
||||
<literal>DefaultViews</literal> list will be selected regardless of the
|
||||
view name. Alternatively, client requests can be made without a file
|
||||
extension but with the <literal>Accept</literal> header set to the
|
||||
@@ -3588,7 +3588,7 @@ public String onSubmit(<emphasis role="bold">@RequestPart("meta-data") MetaData
|
||||
However, the <literal>@RequestPart("meta-data") MetaData</literal>
|
||||
method argument in this case is read as JSON content based on its
|
||||
<literal>'Content-Type'</literal> header and converted with the help of
|
||||
the <classname>MappingJacksonHttpMessageConverter</classname>.</para>
|
||||
the <classname>MappingJackson2HttpMessageConverter</classname>.</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
@@ -4256,9 +4256,10 @@ public class WebConfig {
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para><classname>MappingJacksonHttpMessageConverter</classname>
|
||||
converts to/from JSON — added if Jackson is present on the
|
||||
classpath.</para>
|
||||
<para><classname>MappingJackson2HttpMessageConverter</classname>
|
||||
(or <classname>MappingJacksonHttpMessageConverter</classname>)
|
||||
converts to/from JSON — added if Jackson 2 (or Jackson) is present
|
||||
on the classpath.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
||||
Reference in New Issue
Block a user