This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 1bfe2a7  Using custom Content-Type headers with RestDSL (#6004)
1bfe2a7 is described below

commit 1bfe2a76a37f9e7281bc46f617c39f6a1abf923e
Author: Calle <[email protected]>
AuthorDate: Mon Aug 30 10:01:59 2021 +0200

    Using custom Content-Type headers with RestDSL (#6004)
    
    Added information about how to allow custom XML/JSon Content-Type headers 
when automatic binding from POJO to JSon/JAXB takes place.
    
    Changes to documentation based on discussion in the following thread:
    
https://lists.apache.org/thread.html/r5e82fecd501a3b5ed25844fded1124bf2f3d48a8fdb97556dd5d0f70%40%3Cusers.camel.apache.org%3E
    
    Not sure if the information is placed at the best position in the 
documentation but I couldn't figure out a better place.
---
 docs/user-manual/modules/ROOT/pages/rest-dsl.adoc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/user-manual/modules/ROOT/pages/rest-dsl.adoc 
b/docs/user-manual/modules/ROOT/pages/rest-dsl.adoc
index 46ff783..6bead10 100644
--- a/docs/user-manual/modules/ROOT/pages/rest-dsl.adoc
+++ b/docs/user-manual/modules/ROOT/pages/rest-dsl.adoc
@@ -317,6 +317,13 @@ to specify a custom content-type if the message body 
should not attempt to be
 marshalled using the binding. For example if the message body is a
 custom binary payload etc.
 
+When automatic binding from POJO to JSon/JAXB takes place the existing 
`content-type` header will by default be replaced with either 
`application/json` or `application/xml`. To disable the default behavior and be 
able to produce JSon/JAXB responses with custom `content-type` headers (e.g. 
`application/user.v2+json`) you configure this in Java DSL as shown below:
+
+[source,java]
+----
+restConfiguration().dataFormatProperty("contentTypeHeader", "false");
+----
+
 To use binding you must include the necessary data formats on the
 classpath, such as `camel-jaxb` and/or `camel-jackson`. And then enable
 the binding mode. You can configure the binding mode globally on the

Reply via email to