@@ -1154,15 +1154,9 @@ tend to send accept headers that prefer XML.
1154
1154
1155
1155
[[howto-write-an-xml-rest-service]]
1156
1156
=== Write an XML REST Service
1157
- If you have the Jackson XML extension (`jackson-dataformat-xml`) or JAXB on the classpath, you
1157
+ If you have the Jackson XML extension (`jackson-dataformat-xml`) on the classpath, you
1158
1158
can use it to render XML responses. The previous example that we used for JSON would
1159
- work.
1160
-
1161
- NOTE: To get the server to render XML instead of JSON, you might have to send an
1162
- `Accept: text/xml` header (or use a browser).
1163
-
1164
- ==== Jackson XML
1165
- To use the Jackson XML renderer, add the following dependency to your project:
1159
+ work. To use the Jackson XML renderer, add the following dependency to your project:
1166
1160
1167
1161
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
1168
1162
----
@@ -1172,10 +1166,9 @@ To use the Jackson XML renderer, add the following dependency to your project:
1172
1166
</dependency>
1173
1167
----
1174
1168
1175
- ==== JAXB
1176
- If Jackson's XML extension is not available, JAXB is tried next,
1177
- with the additional requirement of having `MyThing` annotated as
1178
- `@XmlRootElement`, as shown in the following example:
1169
+ If Jackson's XML extension is not available and JAXB is available, XML can be rendered
1170
+ with the additional requirement of having `MyThing` annotated as `@XmlRootElement`, as
1171
+ shown in the following example:
1179
1172
1180
1173
[source,java,indent=0,subs="verbatim,quotes,attributes"]
1181
1174
----
@@ -1186,7 +1179,8 @@ with the additional requirement of having `MyThing` annotated as
1186
1179
}
1187
1180
----
1188
1181
1189
- To use JAXB as XML renderer, add the following dependency to your project:
1182
+ JAXB is only available out of the box with Java 8. If you're using a more recent java
1183
+ generation, add the following dependency to your project:
1190
1184
1191
1185
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
1192
1186
----
@@ -1196,6 +1190,10 @@ To use JAXB as XML renderer, add the following dependency to your project:
1196
1190
</dependency>
1197
1191
----
1198
1192
1193
+ NOTE: To get the server to render XML instead of JSON, you might have to send an
1194
+ `Accept: text/xml` header (or use a browser).
1195
+
1196
+
1199
1197
1200
1198
[[howto-customize-the-jackson-objectmapper]]
1201
1199
=== Customize the Jackson ObjectMapper
0 commit comments