http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatConfiguration.java b/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatConfiguration.java index 891e303..013bdc0 100644 --- a/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatConfiguration.java +++ b/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatConfiguration.java @@ -102,6 +102,13 @@ public class XmlJsonDataFormatConfiguration { * for unmarshalling (JSON to XML conversion). */ private String typeHints; + /** + * Whether the data format should set the Content-Type header with the type + * from the data format if the data format is capable of doing so. For + * example application/xml for data formats marshalling to XML or + * application/json for data formats marshalling to JSon etc. + */ + private Boolean contentTypeHeader = false; public String getEncoding() { return encoding; @@ -198,4 +205,12 @@ public class XmlJsonDataFormatConfiguration { public void setTypeHints(String typeHints) { this.typeHints = typeHints; } + + public Boolean getContentTypeHeader() { + return contentTypeHeader; + } + + public void setContentTypeHeader(Boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } } \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatConfiguration.java b/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatConfiguration.java index 0311c42..b13729f 100644 --- a/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatConfiguration.java +++ b/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatConfiguration.java @@ -30,6 +30,13 @@ public class XmlRpcDataFormatConfiguration { * Whether to marshal/unmarshal request or response Is by default false */ private Boolean request = false; + /** + * Whether the data format should set the Content-Type header with the type + * from the data format if the data format is capable of doing so. For + * example application/xml for data formats marshalling to XML or + * application/json for data formats marshalling to JSon etc. + */ + private Boolean contentTypeHeader = false; public Boolean getRequest() { return request; @@ -38,4 +45,12 @@ public class XmlRpcDataFormatConfiguration { public void setRequest(Boolean request) { this.request = request; } + + public Boolean getContentTypeHeader() { + return contentTypeHeader; + } + + public void setContentTypeHeader(Boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatConfiguration.java b/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatConfiguration.java index f42c34b..9c725c7 100644 --- a/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatConfiguration.java +++ b/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatConfiguration.java @@ -97,6 +97,13 @@ public class XMLSecurityDataFormatConfiguration { * KeyValue in the EncryptedKey structure or not. */ private Boolean addKeyValueForEncryptedKey = true; + /** + * Whether the data format should set the Content-Type header with the type + * from the data format if the data format is capable of doing so. For + * example application/xml for data formats marshalling to XML or + * application/json for data formats marshalling to JSon etc. + */ + private Boolean contentTypeHeader = false; public String getXmlCipherAlgorithm() { return xmlCipherAlgorithm; @@ -186,4 +193,12 @@ public class XMLSecurityDataFormatConfiguration { public void setAddKeyValueForEncryptedKey(Boolean addKeyValueForEncryptedKey) { this.addKeyValueForEncryptedKey = addKeyValueForEncryptedKey; } + + public Boolean getContentTypeHeader() { + return contentTypeHeader; + } + + public void setContentTypeHeader(Boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatConfiguration.java b/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatConfiguration.java index 5711cd8..522c52e 100644 --- a/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatConfiguration.java +++ b/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatConfiguration.java @@ -128,6 +128,13 @@ public class JsonDataFormatConfiguration { * only be enabled when desired to be used. */ private Boolean allowUnmarshallType = false; + /** + * Whether the data format should set the Content-Type header with the type + * from the data format if the data format is capable of doing so. For + * example application/xml for data formats marshalling to XML or + * application/json for data formats marshalling to JSon etc. + */ + private Boolean contentTypeHeader = false; public String getObjectMapper() { return objectMapper; @@ -256,4 +263,12 @@ public class JsonDataFormatConfiguration { public void setAllowUnmarshallType(Boolean allowUnmarshallType) { this.allowUnmarshallType = allowUnmarshallType; } + + public Boolean getContentTypeHeader() { + return contentTypeHeader; + } + + public void setContentTypeHeader(Boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatConfiguration.java b/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatConfiguration.java index 53a2ce0..8e953c6 100644 --- a/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatConfiguration.java +++ b/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatConfiguration.java @@ -84,6 +84,13 @@ public class XStreamDataFormatConfiguration { * tag. */ private Map<String, String[]> implicitCollections; + /** + * Whether the data format should set the Content-Type header with the type + * from the data format if the data format is capable of doing so. For + * example application/xml for data formats marshalling to XML or + * application/json for data formats marshalling to JSon etc. + */ + private Boolean contentTypeHeader = false; public String getPermissions() { return permissions; @@ -156,4 +163,12 @@ public class XStreamDataFormatConfiguration { public void setImplicitCollections(Map<String, String[]> implicitCollections) { this.implicitCollections = implicitCollections; } + + public Boolean getContentTypeHeader() { + return contentTypeHeader; + } + + public void setContentTypeHeader(Boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatConfiguration.java b/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatConfiguration.java index 295c99b..f21f0ad 100644 --- a/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatConfiguration.java +++ b/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatConfiguration.java @@ -32,6 +32,13 @@ public class ZipFileDataFormatConfiguration { * in a streaming mode. */ private Boolean usingIterator = false; + /** + * Whether the data format should set the Content-Type header with the type + * from the data format if the data format is capable of doing so. For + * example application/xml for data formats marshalling to XML or + * application/json for data formats marshalling to JSon etc. + */ + private Boolean contentTypeHeader = false; public Boolean getUsingIterator() { return usingIterator; @@ -40,4 +47,12 @@ public class ZipFileDataFormatConfiguration { public void setUsingIterator(Boolean usingIterator) { this.usingIterator = usingIterator; } + + public Boolean getContentTypeHeader() { + return contentTypeHeader; + } + + public void setContentTypeHeader(Boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-avro/src/main/docs/avro-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-avro/src/main/docs/avro-dataformat.adoc b/components/camel-avro/src/main/docs/avro-dataformat.adoc index f474baf..38058da 100644 --- a/components/camel-avro/src/main/docs/avro-dataformat.adoc +++ b/components/camel-avro/src/main/docs/avro-dataformat.adoc @@ -137,7 +137,7 @@ Avro Dataformat Options ^^^^^^^^^^^^^^^^^^^^^^^ // dataformat options: START -The Avro dataformat supports 1 options which are listed below. +The Avro dataformat supports 2 options which are listed below. @@ -146,6 +146,7 @@ The Avro dataformat supports 1 options which are listed below. |======================================================================= | Name | Default | Java Type | Description | instanceClassName | | String | Class name to use for marshal and unmarshalling +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-barcode/src/main/docs/barcode-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-barcode/src/main/docs/barcode-dataformat.adoc b/components/camel-barcode/src/main/docs/barcode-dataformat.adoc index 86888cb..bea27df 100644 --- a/components/camel-barcode/src/main/docs/barcode-dataformat.adoc +++ b/components/camel-barcode/src/main/docs/barcode-dataformat.adoc @@ -35,7 +35,7 @@ Barcode Options ^^^^^^^^^^^^^^^ // dataformat options: START -The Barcode dataformat supports 4 options which are listed below. +The Barcode dataformat supports 5 options which are listed below. @@ -47,6 +47,7 @@ The Barcode dataformat supports 4 options which are listed below. | height | | Integer | Height of the barcode | imageType | | String | Image type of the barcode such as png | barcodeFormat | | String | Barcode format such as QR-Code +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-base64/src/main/docs/base64-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-base64/src/main/docs/base64-dataformat.adoc b/components/camel-base64/src/main/docs/base64-dataformat.adoc index f0d76cd..910160d 100644 --- a/components/camel-base64/src/main/docs/base64-dataformat.adoc +++ b/components/camel-base64/src/main/docs/base64-dataformat.adoc @@ -11,7 +11,7 @@ Options ^^^^^^^ // dataformat options: START -The Base64 dataformat supports 3 options which are listed below. +The Base64 dataformat supports 4 options which are listed below. @@ -22,6 +22,7 @@ The Base64 dataformat supports 3 options which are listed below. | lineLength | 76 | Integer | To specific a maximum line length for the encoded data. By default 76 is used. | lineSeparator | \r\n | String | The line separators to use. By default \r\n is used. | urlSafe | false | Boolean | Instead of emitting '' and '/' we emit '-' and '_' respectively. urlSafe is only applied to encode operations. Decoding seamlessly handles both modes. Is by default false. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-beanio/src/main/docs/beanio-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-beanio/src/main/docs/beanio-dataformat.adoc b/components/camel-beanio/src/main/docs/beanio-dataformat.adoc index 160178d..1a05410 100644 --- a/components/camel-beanio/src/main/docs/beanio-dataformat.adoc +++ b/components/camel-beanio/src/main/docs/beanio-dataformat.adoc @@ -18,7 +18,7 @@ Options ^^^^^^^ // dataformat options: START -The BeanIO dataformat supports 7 options which are listed below. +The BeanIO dataformat supports 8 options which are listed below. @@ -33,6 +33,7 @@ The BeanIO dataformat supports 7 options which are listed below. | ignoreInvalidRecords | false | Boolean | Whether to ignore invalid records. | encoding | | String | The charset to use. Is by default the JVM platform default charset. | beanReaderErrorHandlerType | | String | To use a custom org.apache.camel.dataformat.beanio.BeanIOErrorHandler as error handler while parsing. Configure the fully qualified class name of the error handler. Notice the options ignoreUnidentifiedRecords ignoreUnexpectedRecords and ignoreInvalidRecords may not be in use when you use a custom error handler. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-bindy/src/main/docs/bindy-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/main/docs/bindy-dataformat.adoc b/components/camel-bindy/src/main/docs/bindy-dataformat.adoc index a4918fb..71b2746 100644 --- a/components/camel-bindy/src/main/docs/bindy-dataformat.adoc +++ b/components/camel-bindy/src/main/docs/bindy-dataformat.adoc @@ -66,7 +66,7 @@ Options // dataformat options: START -The Bindy dataformat supports 3 options which are listed below. +The Bindy dataformat supports 4 options which are listed below. @@ -77,6 +77,7 @@ The Bindy dataformat supports 3 options which are listed below. | type | | BindyType | Whether to use csv fixed or key value pairs mode. The default value is either Csv or KeyValue depending on chosen dataformat. | classType | | String | Name of model class to use. | locale | | String | To configure a default locale to use such as us for united states. To use the JVM platform default locale then use the name default +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-boon/src/main/docs/boon-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-boon/src/main/docs/boon-dataformat.adoc b/components/camel-boon/src/main/docs/boon-dataformat.adoc index 834cdb7..7818770 100644 --- a/components/camel-boon/src/main/docs/boon-dataformat.adoc +++ b/components/camel-boon/src/main/docs/boon-dataformat.adoc @@ -20,7 +20,7 @@ Options // dataformat options: START -The Boon dataformat supports 2 options which are listed below. +The Boon dataformat supports 3 options which are listed below. @@ -30,6 +30,7 @@ The Boon dataformat supports 2 options which are listed below. | Name | Default | Java Type | Description | unmarshalTypeName | | String | Class name of the java type to use when unarmshalling | useList | false | Boolean | To unarmshal to a List of Map or a List of Pojo. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-castor/src/main/docs/castor-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-castor/src/main/docs/castor-dataformat.adoc b/components/camel-castor/src/main/docs/castor-dataformat.adoc index f649094..23489c4 100644 --- a/components/camel-castor/src/main/docs/castor-dataformat.adoc +++ b/components/camel-castor/src/main/docs/castor-dataformat.adoc @@ -113,7 +113,7 @@ Options ^^^^^^^ // dataformat options: START -The Castor dataformat supports 5 options which are listed below. +The Castor dataformat supports 6 options which are listed below. @@ -126,6 +126,7 @@ The Castor dataformat supports 5 options which are listed below. | encoding | UTF-8 | String | Encoding to use when marshalling an Object to XML. Is by default UTF-8 | packages | | String[] | Add additional packages to Castor XmlContext | classes | | String[] | Add additional class names to Castor XmlContext +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java ---------------------------------------------------------------------- diff --git a/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java b/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java index dee44cc..adbc0ce 100644 --- a/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java +++ b/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java @@ -56,6 +56,7 @@ public abstract class AbstractCastorDataFormat extends ServiceSupport implements private String[] packages; private boolean validation; private volatile XMLContext xmlContext; + private boolean contentTypeHeader = true; public AbstractCastorDataFormat() { } @@ -75,6 +76,14 @@ public abstract class AbstractCastorDataFormat extends ServiceSupport implements Marshaller marshaller = createMarshaller(exchange); marshaller.setWriter(writer); marshaller.marshal(body); + + if (contentTypeHeader) { + if (exchange.hasOut()) { + exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/xml"); + } else { + exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/xml"); + } + } } public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception { @@ -174,6 +183,18 @@ public abstract class AbstractCastorDataFormat extends ServiceSupport implements this.validation = validation; } + + public boolean isContentTypeHeader() { + return contentTypeHeader; + } + + /** + * If enabled then Castor will set the Content-Type header to <tt>application/xml</tt> when marshalling. + */ + public void setContentTypeHeader(boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } + @Override protected void doStart() throws Exception { if (xmlContext == null) { http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-crypto/src/main/docs/crypto-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-crypto/src/main/docs/crypto-dataformat.adoc b/components/camel-crypto/src/main/docs/crypto-dataformat.adoc index f252e3a..ae7279a 100644 --- a/components/camel-crypto/src/main/docs/crypto-dataformat.adoc +++ b/components/camel-crypto/src/main/docs/crypto-dataformat.adoc @@ -15,7 +15,7 @@ CryptoDataFormat Options ^^^^^^^^^^^^^^^^^^^^^^^^ // dataformat options: START -The Crypto (Java Cryptographic Extension) dataformat supports 9 options which are listed below. +The Crypto (Java Cryptographic Extension) dataformat supports 10 options which are listed below. @@ -32,6 +32,7 @@ The Crypto (Java Cryptographic Extension) dataformat supports 9 options which ar | macAlgorithm | HmacSHA1 | String | The JCE algorithm name indicating the Message Authentication algorithm. | shouldAppendHMAC | false | Boolean | Flag indicating that a Message Authentication Code should be calculated and appended to the encrypted data. | inline | false | Boolean | Flag indicating that the configured IV should be inlined into the encrypted data stream. Is by default false. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-crypto/src/main/docs/pgp-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-crypto/src/main/docs/pgp-dataformat.adoc b/components/camel-crypto/src/main/docs/pgp-dataformat.adoc index 292395d..b1175a4 100644 --- a/components/camel-crypto/src/main/docs/pgp-dataformat.adoc +++ b/components/camel-crypto/src/main/docs/pgp-dataformat.adoc @@ -15,7 +15,7 @@ PGPDataFormat Options ^^^^^^^^^^^^^^^^^^^^^ // dataformat options: START -The PGP dataformat supports 14 options which are listed below. +The PGP dataformat supports 15 options which are listed below. @@ -37,6 +37,7 @@ The PGP dataformat supports 14 options which are listed below. | compressionAlgorithm | | Integer | Compression algorithm; possible values are defined in org.bouncycastle.bcpg.CompressionAlgorithmTags; for example 0 (= UNCOMPRESSED) 1 (= ZIP) 2 (= ZLIB) 3 (= BZIP2). Only relevant for encrypting. | hashAlgorithm | | Integer | Signature hash algorithm; possible values are defined in org.bouncycastle.bcpg.HashAlgorithmTags; for example 2 (= SHA1) 8 (= SHA256) 9 (= SHA384) 10 (= SHA512) 11 (=SHA224). Only relevant for signing. | signatureVerificationOption | | String | Controls the behavior for verifying the signature during unmarshaling. There are 4 values possible: optional: The PGP message may or may not contain signatures; if it does contain signatures then a signature verification is executed. required: The PGP message must contain at least one signature; if this is not the case an exception (PGPException) is thrown. A signature verification is executed. ignore: Contained signatures in the PGP message are ignored; no signature verification is executed. no_signature_allowed: The PGP message must not contain a signature; otherwise an exception (PGPException) is thrown. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-csv/src/main/docs/csv-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-csv/src/main/docs/csv-dataformat.adoc b/components/camel-csv/src/main/docs/csv-dataformat.adoc index b10793a..5c03a20 100644 --- a/components/camel-csv/src/main/docs/csv-dataformat.adoc +++ b/components/camel-csv/src/main/docs/csv-dataformat.adoc @@ -13,7 +13,7 @@ Options ^^^^^^^ // dataformat options: START -The CSV dataformat supports 23 options which are listed below. +The CSV dataformat supports 24 options which are listed below. @@ -44,6 +44,7 @@ The CSV dataformat supports 23 options which are listed below. | lazyLoad | false | Boolean | Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one. | useMaps | false | Boolean | Whether the unmarshalling should produce maps for the lines values instead of lists. It requires to have header (either defined or collected). | recordConverterRef | | String | Refers to a custom CsvRecordConverter to lookup from the registry to use. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-flatpack/src/main/docs/flatpack-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-flatpack/src/main/docs/flatpack-dataformat.adoc b/components/camel-flatpack/src/main/docs/flatpack-dataformat.adoc index 1892521..d7b0025 100644 --- a/components/camel-flatpack/src/main/docs/flatpack-dataformat.adoc +++ b/components/camel-flatpack/src/main/docs/flatpack-dataformat.adoc @@ -23,7 +23,7 @@ Options ^^^^^^^ // dataformat options: START -The Flatpack dataformat supports 8 options which are listed below. +The Flatpack dataformat supports 9 options which are listed below. @@ -39,6 +39,7 @@ The Flatpack dataformat supports 8 options which are listed below. | delimiter | , | String | The delimiter char (could be ; or similar) | allowShortLines | false | Boolean | Allows for lines to be shorter than expected and ignores the extra characters | ignoreExtraColumns | false | Boolean | Allows for lines to be longer than expected and ignores the extra characters. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-gson/src/main/docs/json-gson-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-gson/src/main/docs/json-gson-dataformat.adoc b/components/camel-gson/src/main/docs/json-gson-dataformat.adoc index cb83a73..7a02584 100644 --- a/components/camel-gson/src/main/docs/json-gson-dataformat.adoc +++ b/components/camel-gson/src/main/docs/json-gson-dataformat.adoc @@ -20,7 +20,7 @@ Gson Options // dataformat options: START -The JSon GSon dataformat supports 16 options which are listed below. +The JSon GSon dataformat supports 17 options which are listed below. @@ -44,6 +44,7 @@ The JSon GSon dataformat supports 16 options which are listed below. | disableFeatures | | String | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature com.fasterxml.jackson.databind.DeserializationFeature or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma | permissions | | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be configured separated by comma such as com.foo.-com.foo.bar.MySecretBean. The following default permission is always included: -java.lang.java.util. unless its overridden by specifying a JVM system property with they key org.apache.camel.xstream.permissions. | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java ---------------------------------------------------------------------- diff --git a/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java b/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java index e480c5d..a66e876 100644 --- a/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java +++ b/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java @@ -54,6 +54,7 @@ public class GsonDataFormat extends ServiceSupport implements DataFormat, DataFo private boolean serializeNulls; private boolean prettyPrint; private String dateFormatPattern; + private boolean contentTypeHeader = true; public GsonDataFormat() { this(Object.class); @@ -126,6 +127,14 @@ public class GsonDataFormat extends ServiceSupport implements DataFormat, DataFo final BufferedWriter writer = IOHelper.buffered(osw)) { gson.toJson(graph, writer); } + + if (contentTypeHeader) { + if (exchange.hasOut()) { + exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/json"); + } else { + exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/json"); + } + } } @Override @@ -282,6 +291,18 @@ public class GsonDataFormat extends ServiceSupport implements DataFormat, DataFo this.dateFormatPattern = dateFormatPattern; } + + public boolean isContentTypeHeader() { + return contentTypeHeader; + } + + /** + * If enabled then Gson will set the Content-Type header to <tt>application/json</tt> when marshalling. + */ + public void setContentTypeHeader(boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } + public Gson getGson() { return this.gson; } http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-hessian/src/main/docs/hessian-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-hessian/src/main/docs/hessian-dataformat.adoc b/components/camel-hessian/src/main/docs/hessian-dataformat.adoc index 77ac570..deac736 100644 --- a/components/camel-hessian/src/main/docs/hessian-dataformat.adoc +++ b/components/camel-hessian/src/main/docs/hessian-dataformat.adoc @@ -21,7 +21,17 @@ Options ^^^^^^^ // dataformat options: START -The Hessian dataformat has no options. +The Hessian dataformat supports 1 options which are listed below. + + + +{% raw %} +[width="100%",cols="2s,1m,1m,6",options="header"] +|======================================================================= +| Name | Default | Java Type | Description +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. +|======================================================================= +{% endraw %} // dataformat options: END [[hessian-UsingHessianDataFormat]] http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-hl7/src/main/docs/hl7-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-hl7/src/main/docs/hl7-dataformat.adoc b/components/camel-hl7/src/main/docs/hl7-dataformat.adoc index d0b340c..d63f43a 100644 --- a/components/camel-hl7/src/main/docs/hl7-dataformat.adoc +++ b/components/camel-hl7/src/main/docs/hl7-dataformat.adoc @@ -222,7 +222,7 @@ The link:hl7.html[HL7] component ships with a HL7 data format that can be used to marshal or unmarshal HL7 model objects. // dataformat options: START -The HL7 dataformat supports 1 options which are listed below. +The HL7 dataformat supports 2 options which are listed below. @@ -231,6 +231,7 @@ The HL7 dataformat supports 1 options which are listed below. |======================================================================= | Name | Default | Java Type | Description | validate | true | Boolean | Whether to validate the HL7 message Is by default true. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-ical/src/main/docs/ical-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-ical/src/main/docs/ical-dataformat.adoc b/components/camel-ical/src/main/docs/ical-dataformat.adoc index 1bca47d..322dbb9 100644 --- a/components/camel-ical/src/main/docs/ical-dataformat.adoc +++ b/components/camel-ical/src/main/docs/ical-dataformat.adoc @@ -33,7 +33,7 @@ Options ^^^^^^^ // dataformat options: START -The iCal dataformat supports 1 options which are listed below. +The iCal dataformat supports 2 options which are listed below. @@ -42,6 +42,7 @@ The iCal dataformat supports 1 options which are listed below. |======================================================================= | Name | Default | Java Type | Description | validating | false | Boolean | Whether to validate. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc b/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc index f8c2106..9766dce 100644 --- a/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc +++ b/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc @@ -21,7 +21,7 @@ Jackson Options // dataformat options: START -The JSon Jackson dataformat supports 16 options which are listed below. +The JSon Jackson dataformat supports 17 options which are listed below. @@ -45,6 +45,7 @@ The JSon Jackson dataformat supports 16 options which are listed below. | disableFeatures | | String | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature com.fasterxml.jackson.databind.DeserializationFeature or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma | permissions | | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be configured separated by comma such as com.foo.-com.foo.bar.MySecretBean. The following default permission is always included: -java.lang.java.util. unless its overridden by specifying a JVM system property with they key org.apache.camel.xstream.permissions. | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java ---------------------------------------------------------------------- diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java index ec7073f..31ff280 100644 --- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java +++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java @@ -69,6 +69,7 @@ public class JacksonDataFormat extends ServiceSupport implements DataFormat, Dat private String disableFeatures; private boolean enableJacksonTypeConverter; private boolean allowUnmarshallType; + private boolean contentTypeHeader = true; /** * Use the default Jackson {@link ObjectMapper} and {@link Object} @@ -153,6 +154,14 @@ public class JacksonDataFormat extends ServiceSupport implements DataFormat, Dat public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception { this.objectMapper.writerWithView(jsonView).writeValue(stream, graph); + + if (contentTypeHeader) { + if (exchange.hasOut()) { + exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/json"); + } else { + exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/json"); + } + } } public Object unmarshal(Exchange exchange, InputStream stream) throws Exception { @@ -344,6 +353,17 @@ public class JacksonDataFormat extends ServiceSupport implements DataFormat, Dat this.allowUnmarshallType = allowJacksonUnmarshallType; } + public boolean isContentTypeHeader() { + return contentTypeHeader; + } + + /** + * If enabled then Jackson will set the Content-Type header to <tt>application/json</tt> when marshalling. + */ + public void setContentTypeHeader(boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } + public String getEnableFeatures() { return enableFeatures; } http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalContentTypeHeaderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalContentTypeHeaderTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalContentTypeHeaderTest.java new file mode 100644 index 0000000..c66bf9d --- /dev/null +++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalContentTypeHeaderTest.java @@ -0,0 +1,100 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.jackson; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.model.dataformat.JsonLibrary; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; + +public class JacksonMarshalContentTypeHeaderTest extends CamelTestSupport { + + @Test + public void testYes() throws Exception { + final Map<String, Object> in = new HashMap<String, Object>(); + in.put("name", "Camel"); + + Exchange out = template.request("direct:yes", new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setBody(in); + } + }); + + assertNotNull(out); + assertTrue(out.hasOut()); + assertEquals("application/json", out.getOut().getHeader(Exchange.CONTENT_TYPE)); + } + + @Test + public void testYes2() throws Exception { + final Map<String, Object> in = new HashMap<String, Object>(); + in.put("name", "Camel"); + + Exchange out = template.request("direct:yes2", new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setBody(in); + } + }); + + assertNotNull(out); + assertTrue(out.hasOut()); + assertEquals("application/json", out.getOut().getHeader(Exchange.CONTENT_TYPE)); + } + + @Test + public void testNo() throws Exception { + final Map<String, Object> in = new HashMap<String, Object>(); + in.put("name", "Camel"); + + Exchange out = template.request("direct:no", new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setBody(in); + } + }); + + assertNotNull(out); + assertTrue(out.hasOut()); + assertNull(out.getOut().getHeader(Exchange.CONTENT_TYPE)); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + + @Override + public void configure() throws Exception { + JacksonDataFormat format = new JacksonDataFormat(); + from("direct:yes").marshal(format); + + from("direct:yes2").marshal().json(JsonLibrary.Jackson); + + JacksonDataFormat formatNoHeader = new JacksonDataFormat(); + formatNoHeader.setContentTypeHeader(false); + from("direct:no").marshal(formatNoHeader); + } + }; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-jacksonxml/src/main/docs/jacksonxml-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-jacksonxml/src/main/docs/jacksonxml-dataformat.adoc b/components/camel-jacksonxml/src/main/docs/jacksonxml-dataformat.adoc index 85c362e..28128a3 100644 --- a/components/camel-jacksonxml/src/main/docs/jacksonxml-dataformat.adoc +++ b/components/camel-jacksonxml/src/main/docs/jacksonxml-dataformat.adoc @@ -36,7 +36,7 @@ JacksonXML Options // dataformat options: START -The JacksonXML dataformat supports 14 options which are listed below. +The JacksonXML dataformat supports 15 options which are listed below. @@ -58,6 +58,7 @@ The JacksonXML dataformat supports 14 options which are listed below. | enableFeatures | | String | Set of features to enable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature com.fasterxml.jackson.databind.DeserializationFeature or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma | disableFeatures | | String | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature com.fasterxml.jackson.databind.DeserializationFeature or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-jacksonxml/src/main/java/org/apache/camel/component/jacksonxml/JacksonXMLDataFormat.java ---------------------------------------------------------------------- diff --git a/components/camel-jacksonxml/src/main/java/org/apache/camel/component/jacksonxml/JacksonXMLDataFormat.java b/components/camel-jacksonxml/src/main/java/org/apache/camel/component/jacksonxml/JacksonXMLDataFormat.java index dd70cd5..eeaddcc 100644 --- a/components/camel-jacksonxml/src/main/java/org/apache/camel/component/jacksonxml/JacksonXMLDataFormat.java +++ b/components/camel-jacksonxml/src/main/java/org/apache/camel/component/jacksonxml/JacksonXMLDataFormat.java @@ -69,6 +69,7 @@ public class JacksonXMLDataFormat extends ServiceSupport implements DataFormat, private String disableFeatures; private boolean enableJacksonTypeConverter; private boolean allowUnmarshallType; + private boolean contentTypeHeader = true; /** * Use the default Jackson {@link XmlMapper} and {@link Map} @@ -153,6 +154,14 @@ public class JacksonXMLDataFormat extends ServiceSupport implements DataFormat, public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception { this.xmlMapper.writerWithView(jsonView).writeValue(stream, graph); + + if (contentTypeHeader) { + if (exchange.hasOut()) { + exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/xml"); + } else { + exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/xml"); + } + } } public Object unmarshal(Exchange exchange, InputStream stream) throws Exception { @@ -344,6 +353,17 @@ public class JacksonXMLDataFormat extends ServiceSupport implements DataFormat, this.allowUnmarshallType = allowJacksonUnmarshallType; } + public boolean isContentTypeHeader() { + return contentTypeHeader; + } + + /** + * If enabled then Jackson will set the Content-Type header to <tt>application/xml</tt> when marshalling. + */ + public void setContentTypeHeader(boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } + public String getEnableFeatures() { return enableFeatures; } http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-jacksonxml/src/test/java/org/apache/camel/component/jacksonxml/JacksonMarshalContentTypeHeaderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jacksonxml/src/test/java/org/apache/camel/component/jacksonxml/JacksonMarshalContentTypeHeaderTest.java b/components/camel-jacksonxml/src/test/java/org/apache/camel/component/jacksonxml/JacksonMarshalContentTypeHeaderTest.java new file mode 100644 index 0000000..82a65c8 --- /dev/null +++ b/components/camel-jacksonxml/src/test/java/org/apache/camel/component/jacksonxml/JacksonMarshalContentTypeHeaderTest.java @@ -0,0 +1,99 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.jacksonxml; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; + +public class JacksonMarshalContentTypeHeaderTest extends CamelTestSupport { + + @Test + public void testYes() throws Exception { + final Map<String, Object> in = new HashMap<String, Object>(); + in.put("name", "Camel"); + + Exchange out = template.request("direct:yes", new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setBody(in); + } + }); + + assertNotNull(out); + assertTrue(out.hasOut()); + assertEquals("application/xml", out.getOut().getHeader(Exchange.CONTENT_TYPE)); + } + + @Test + public void testYes2() throws Exception { + final Map<String, Object> in = new HashMap<String, Object>(); + in.put("name", "Camel"); + + Exchange out = template.request("direct:yes2", new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setBody(in); + } + }); + + assertNotNull(out); + assertTrue(out.hasOut()); + assertEquals("application/xml", out.getOut().getHeader(Exchange.CONTENT_TYPE)); + } + + @Test + public void testNo() throws Exception { + final Map<String, Object> in = new HashMap<String, Object>(); + in.put("name", "Camel"); + + Exchange out = template.request("direct:no", new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setBody(in); + } + }); + + assertNotNull(out); + assertTrue(out.hasOut()); + assertNull(out.getOut().getHeader(Exchange.CONTENT_TYPE)); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + + @Override + public void configure() throws Exception { + JacksonXMLDataFormat format = new JacksonXMLDataFormat(); + from("direct:yes").marshal(format); + + from("direct:yes2").marshal().jacksonxml(); + + JacksonXMLDataFormat formatNoHeader = new JacksonXMLDataFormat(); + formatNoHeader.setContentTypeHeader(false); + from("direct:no").marshal(formatNoHeader); + } + }; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-jaxb/src/main/docs/jaxb-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-jaxb/src/main/docs/jaxb-dataformat.adoc b/components/camel-jaxb/src/main/docs/jaxb-dataformat.adoc index 1fe8e36..27a688f 100644 --- a/components/camel-jaxb/src/main/docs/jaxb-dataformat.adoc +++ b/components/camel-jaxb/src/main/docs/jaxb-dataformat.adoc @@ -12,7 +12,7 @@ Options ^^^^^^^ // dataformat options: START -The JAXB dataformat supports 16 options which are listed below. +The JAXB dataformat supports 17 options which are listed below. @@ -36,6 +36,7 @@ The JAXB dataformat supports 16 options which are listed below. | schemaLocation | | String | To define the location of the schema | noNamespaceSchemaLocation | | String | To define the location of the namespaceless schema | jaxbProviderProperties | | String | Refers to a custom java.util.Map to lookup in the registry containing custom JAXB provider properties to be used with the JAXB marshaller. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java ---------------------------------------------------------------------- diff --git a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java index fbd6636..9506b5e 100644 --- a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java +++ b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java @@ -106,6 +106,7 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, DataFo private TypeConverter typeConverter; private Schema cachedSchema; private Map<String, Object> jaxbProviderProperties; + private boolean contentTypeHeader = true; public JaxbDataFormat() { } @@ -166,6 +167,13 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, DataFo } marshal(exchange, graph, stream, marshaller); + if (contentTypeHeader) { + if (exchange.hasOut()) { + exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/xml"); + } else { + exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/xml"); + } + } } catch (Exception e) { throw new IOException(e); } @@ -438,6 +446,18 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, DataFo this.jaxbProviderProperties = jaxbProviderProperties; } + + public boolean isContentTypeHeader() { + return contentTypeHeader; + } + + /** + * If enabled then JAXB will set the Content-Type header to <tt>application/xml</tt> when marshalling. + */ + public void setContentTypeHeader(boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } + @Override @SuppressWarnings("unchecked") protected void doStart() throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbTest.java b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbTest.java index 1c7a812..8762925 100644 --- a/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbTest.java +++ b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbTest.java @@ -19,6 +19,7 @@ package org.apache.camel.jaxb; import javax.xml.bind.JAXBElement; import org.apache.camel.CamelExecutionException; +import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.converter.jaxb.JaxbDataFormat; @@ -86,6 +87,7 @@ public class CamelJaxbTest extends CamelTestSupport { MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class); resultEndpoint.expectedMessageCount(1); + resultEndpoint.expectedHeaderReceived(Exchange.CONTENT_TYPE, "application/xml"); template.sendBody("direct:marshal", person); resultEndpoint.assertIsSatisfied(); @@ -102,6 +104,7 @@ public class CamelJaxbTest extends CamelTestSupport { MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class); resultEndpoint.expectedMessageCount(1); + resultEndpoint.expectedHeaderReceived(Exchange.CONTENT_TYPE, "application/xml"); template.sendBody("direct:marshal", person); resultEndpoint.assertIsSatisfied(); http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-jibx/src/main/docs/jibx-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/main/docs/jibx-dataformat.adoc b/components/camel-jibx/src/main/docs/jibx-dataformat.adoc index fac8f9e..1abd141 100644 --- a/components/camel-jibx/src/main/docs/jibx-dataformat.adoc +++ b/components/camel-jibx/src/main/docs/jibx-dataformat.adoc @@ -33,7 +33,7 @@ Options ^^^^^^^ // dataformat options: START -The JiBX dataformat supports 2 options which are listed below. +The JiBX dataformat supports 3 options which are listed below. @@ -43,6 +43,7 @@ The JiBX dataformat supports 2 options which are listed below. | Name | Default | Java Type | Description | unmarshallClass | | String | Class name to use when unmarshalling from XML to Java. | bindingName | | String | To use a custom binding factory +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java b/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java index e48daa5..9628c59 100644 --- a/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java +++ b/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java @@ -35,6 +35,7 @@ public class JibxDataFormat extends ServiceSupport implements DataFormat, DataFo private Class<?> unmarshallClass; private String bindingName; + private boolean contentTypeHeader = true; public JibxDataFormat() { } @@ -57,6 +58,14 @@ public class JibxDataFormat extends ServiceSupport implements DataFormat, DataFo IBindingFactory bindingFactory = createBindingFactory(body.getClass(), bindingName); IMarshallingContext marshallingContext = bindingFactory.createMarshallingContext(); marshallingContext.marshalDocument(body, null, null, stream); + + if (contentTypeHeader) { + if (exchange.hasOut()) { + exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/xml"); + } else { + exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/xml"); + } + } } public Object unmarshal(Exchange exchange, InputStream stream) throws Exception { @@ -72,7 +81,6 @@ public class JibxDataFormat extends ServiceSupport implements DataFormat, DataFo return unmarshallingContext.unmarshalDocument(stream, null); } - @Override protected void doStart() throws Exception { // noop @@ -99,6 +107,19 @@ public class JibxDataFormat extends ServiceSupport implements DataFormat, DataFo this.bindingName = bindingName; } + + public boolean isContentTypeHeader() { + return contentTypeHeader; + } + + /** + * If enabled then Jibx will set the Content-Type header to <tt>application/xml</tt> when marshalling. + */ + public void setContentTypeHeader(boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } + + private IBindingFactory createBindingFactory(Class<?> clazz, String bindingName) throws JiBXException { if (bindingName == null) { return BindingDirectory.getFactory(clazz); http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc b/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc index 416cbf7..95ab41a 100644 --- a/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc +++ b/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc @@ -21,7 +21,7 @@ Johnzon Options // dataformat options: START -The JSon Johnzon dataformat supports 16 options which are listed below. +The JSon Johnzon dataformat supports 17 options which are listed below. @@ -45,6 +45,7 @@ The JSon Johnzon dataformat supports 16 options which are listed below. | disableFeatures | | String | Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature com.fasterxml.jackson.databind.DeserializationFeature or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma | permissions | | String | Adds permissions that controls which Java packages and classes XStream is allowed to use during unmarshal from xml/json to Java beans. A permission must be configured either here or globally using a JVM system property. The permission can be specified in a syntax where a plus sign is allow and minus sign is deny. Wildcards is supported by using . as prefix. For example to allow com.foo and all subpackages then specfy com.foo.. Multiple permissions can be configured separated by comma such as com.foo.-com.foo.bar.MySecretBean. The following default permission is always included: -java.lang.java.util. unless its overridden by specifying a JVM system property with they key org.apache.camel.xstream.permissions. | allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-lzf/src/main/docs/lzf-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-lzf/src/main/docs/lzf-dataformat.adoc b/components/camel-lzf/src/main/docs/lzf-dataformat.adoc index db09d69..12aa565 100644 --- a/components/camel-lzf/src/main/docs/lzf-dataformat.adoc +++ b/components/camel-lzf/src/main/docs/lzf-dataformat.adoc @@ -16,7 +16,7 @@ Options ^^^^^^^ // dataformat options: START -The LZF Deflate Compression dataformat supports 1 options which are listed below. +The LZF Deflate Compression dataformat supports 2 options which are listed below. @@ -25,6 +25,7 @@ The LZF Deflate Compression dataformat supports 1 options which are listed below |======================================================================= | Name | Default | Java Type | Description | usingParallelCompression | false | Boolean | Enable encoding (compress) using multiple processing cores. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-mail/src/main/docs/mime-multipart-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-mail/src/main/docs/mime-multipart-dataformat.adoc b/components/camel-mail/src/main/docs/mime-multipart-dataformat.adoc index cfaa0ca..82f461d 100644 --- a/components/camel-mail/src/main/docs/mime-multipart-dataformat.adoc +++ b/components/camel-mail/src/main/docs/mime-multipart-dataformat.adoc @@ -47,7 +47,7 @@ Options ^^^^^^^ // dataformat options: START -The MIME Multipart dataformat supports 5 options which are listed below. +The MIME Multipart dataformat supports 6 options which are listed below. @@ -60,6 +60,7 @@ The MIME Multipart dataformat supports 5 options which are listed below. | headersInline | false | Boolean | Defines whether the MIME-Multipart headers are part of the message body (true) or are set as Camel headers (false). Default is false. | includeHeaders | | String | A regex that defines which Camel headers are also included as MIME headers into the MIME multipart. This will only work if headersInline is set to true. Default is to include no headers | binaryContent | false | Boolean | Defines whether the content of binary parts in the MIME multipart is binary (true) or Base-64 encoded (false) Default is false. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc b/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc index c6a3a85..d5d9985 100644 --- a/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc +++ b/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc @@ -25,7 +25,7 @@ Protobuf Options ^^^^^^^^^^^^^^^^ // dataformat options: START -The Protobuf dataformat supports 1 options which are listed below. +The Protobuf dataformat supports 2 options which are listed below. @@ -34,6 +34,7 @@ The Protobuf dataformat supports 1 options which are listed below. |======================================================================= | Name | Default | Java Type | Description | instanceClass | | String | Name of class to use when unarmshalling +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-rss/src/main/docs/rss-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-rss/src/main/docs/rss-dataformat.adoc b/components/camel-rss/src/main/docs/rss-dataformat.adoc index 7a6f149..7b6b731 100644 --- a/components/camel-rss/src/main/docs/rss-dataformat.adoc +++ b/components/camel-rss/src/main/docs/rss-dataformat.adoc @@ -25,7 +25,17 @@ Options ^^^^^^^ // dataformat options: START -The RSS dataformat has no options. +The RSS dataformat supports 1 options which are listed below. + + + +{% raw %} +[width="100%",cols="2s,1m,1m,6",options="header"] +|======================================================================= +| Name | Default | Java Type | Description +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. +|======================================================================= +{% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc b/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc index 702a875..9ec7ebd 100644 --- a/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc +++ b/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc @@ -19,7 +19,7 @@ YAML Options ^^^^^^^^^^^^ // dataformat options: START -The YAML SnakeYAML dataformat supports 10 options which are listed below. +The YAML SnakeYAML dataformat supports 11 options which are listed below. @@ -37,6 +37,7 @@ The YAML SnakeYAML dataformat supports 10 options which are listed below. | prettyFlow | false | Boolean | Force the emitter to produce a pretty YAML document when using the flow style. | allowAnyType | false | Boolean | Allow any class to be un-marshaled | typeFilter | | List | Set the types SnakeYAML is allowed to un-marshall +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-soap/src/main/docs/soapjaxb-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-soap/src/main/docs/soapjaxb-dataformat.adoc b/components/camel-soap/src/main/docs/soapjaxb-dataformat.adoc index de54e65..92d7aea 100644 --- a/components/camel-soap/src/main/docs/soapjaxb-dataformat.adoc +++ b/components/camel-soap/src/main/docs/soapjaxb-dataformat.adoc @@ -24,7 +24,7 @@ SOAP Options // dataformat options: START -The SOAP dataformat supports 6 options which are listed below. +The SOAP dataformat supports 7 options which are listed below. @@ -38,6 +38,7 @@ The SOAP dataformat supports 6 options which are listed below. | version | 1.1 | String | SOAP version should either be 1.1 or 1.2. Is by default 1.1 | namespacePrefixRef | | String | When marshalling using JAXB or SOAP then the JAXB implementation will automatic assign namespace prefixes such as ns2 ns3 ns4 etc. To control this mapping Camel allows you to refer to a map which contains the desired mapping. | schema | | String | To validate against an existing schema. Your can use the prefix classpath: file: or http: to specify how the resource should by resolved. You can separate multiple schema files by using the '' character. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-syslog/src/main/docs/syslog-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-syslog/src/main/docs/syslog-dataformat.adoc b/components/camel-syslog/src/main/docs/syslog-dataformat.adoc index 51c30c7..263bb41 100644 --- a/components/camel-syslog/src/main/docs/syslog-dataformat.adoc +++ b/components/camel-syslog/src/main/docs/syslog-dataformat.adoc @@ -53,7 +53,17 @@ Options ^^^^^^^ // dataformat options: START -The Syslog dataformat has no options. +The Syslog dataformat supports 1 options which are listed below. + + + +{% raw %} +[width="100%",cols="2s,1m,1m,6",options="header"] +|======================================================================= +| Name | Default | Java Type | Description +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. +|======================================================================= +{% endraw %} // dataformat options: END [[Syslog-RFC5424Syslogprotocol]] http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-tagsoup/src/main/docs/tidyMarkup-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-tagsoup/src/main/docs/tidyMarkup-dataformat.adoc b/components/camel-tagsoup/src/main/docs/tidyMarkup-dataformat.adoc index 53970c01..1c11afe 100644 --- a/components/camel-tagsoup/src/main/docs/tidyMarkup-dataformat.adoc +++ b/components/camel-tagsoup/src/main/docs/tidyMarkup-dataformat.adoc @@ -24,7 +24,7 @@ TidyMarkup Options // dataformat options: START -The TidyMarkup dataformat supports 2 options which are listed below. +The TidyMarkup dataformat supports 3 options which are listed below. @@ -34,6 +34,7 @@ The TidyMarkup dataformat supports 2 options which are listed below. | Name | Default | Java Type | Description | dataObjectType | org.w3c.dom.Node | String | What data type to unmarshal as can either be org.w3c.dom.Node or java.lang.String. Is by default org.w3c.dom.Node | omitXmlDeclaration | false | Boolean | When returning a String do we omit the XML declaration in the top. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-tarfile/src/main/docs/tarfile-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-tarfile/src/main/docs/tarfile-dataformat.adoc b/components/camel-tarfile/src/main/docs/tarfile-dataformat.adoc index fba4bae..5b7dc9e 100644 --- a/components/camel-tarfile/src/main/docs/tarfile-dataformat.adoc +++ b/components/camel-tarfile/src/main/docs/tarfile-dataformat.adoc @@ -18,7 +18,7 @@ TarFile Options // dataformat options: START -The Tar File dataformat supports 1 options which are listed below. +The Tar File dataformat supports 2 options which are listed below. @@ -27,6 +27,7 @@ The Tar File dataformat supports 1 options which are listed below. |======================================================================= | Name | Default | Java Type | Description | usingIterator | false | Boolean | If the tar file has more then one entry the setting this option to true allows to work with the splitter EIP to split the data using an iterator in a streaming mode. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-univocity-parsers/src/main/docs/univocity-csv-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-univocity-parsers/src/main/docs/univocity-csv-dataformat.adoc b/components/camel-univocity-parsers/src/main/docs/univocity-csv-dataformat.adoc index a482428..1e42224 100644 --- a/components/camel-univocity-parsers/src/main/docs/univocity-csv-dataformat.adoc +++ b/components/camel-univocity-parsers/src/main/docs/univocity-csv-dataformat.adoc @@ -49,7 +49,7 @@ Options // dataformat options: START -The uniVocity CSV dataformat supports 17 options which are listed below. +The uniVocity CSV dataformat supports 18 options which are listed below. @@ -74,6 +74,7 @@ The uniVocity CSV dataformat supports 17 options which are listed below. | comment | # | String | The comment symbol. The default value is | lazyLoad | false | Boolean | Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one. The default value is false | asMap | false | Boolean | Whether the unmarshalling should produce maps for the lines values instead of lists. It requires to have header (either defined or collected). The default value is false +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-univocity-parsers/src/main/docs/univocity-fixed-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-univocity-parsers/src/main/docs/univocity-fixed-dataformat.adoc b/components/camel-univocity-parsers/src/main/docs/univocity-fixed-dataformat.adoc index 02229ab..813e541 100644 --- a/components/camel-univocity-parsers/src/main/docs/univocity-fixed-dataformat.adoc +++ b/components/camel-univocity-parsers/src/main/docs/univocity-fixed-dataformat.adoc @@ -49,7 +49,7 @@ Options // dataformat options: START -The uniVocity Fixed Length dataformat supports 16 options which are listed below. +The uniVocity Fixed Length dataformat supports 17 options which are listed below. @@ -73,6 +73,7 @@ The uniVocity Fixed Length dataformat supports 16 options which are listed below | comment | # | String | The comment symbol. The default value is | lazyLoad | false | Boolean | Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one. The default value is false | asMap | false | Boolean | Whether the unmarshalling should produce maps for the lines values instead of lists. It requires to have header (either defined or collected). The default value is false +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END http://git-wip-us.apache.org/repos/asf/camel/blob/28152825/components/camel-univocity-parsers/src/main/docs/univocity-tsv-dataformat.adoc ---------------------------------------------------------------------- diff --git a/components/camel-univocity-parsers/src/main/docs/univocity-tsv-dataformat.adoc b/components/camel-univocity-parsers/src/main/docs/univocity-tsv-dataformat.adoc index 30c0039..be2b39c 100644 --- a/components/camel-univocity-parsers/src/main/docs/univocity-tsv-dataformat.adoc +++ b/components/camel-univocity-parsers/src/main/docs/univocity-tsv-dataformat.adoc @@ -49,7 +49,7 @@ Options // dataformat options: START -The uniVocity TSV dataformat supports 14 options which are listed below. +The uniVocity TSV dataformat supports 15 options which are listed below. @@ -71,6 +71,7 @@ The uniVocity TSV dataformat supports 14 options which are listed below. | comment | # | String | The comment symbol. The default value is | lazyLoad | false | Boolean | Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one. The default value is false | asMap | false | Boolean | Whether the unmarshalling should produce maps for the lines values instead of lists. It requires to have header (either defined or collected). The default value is false +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. |======================================================================= {% endraw %} // dataformat options: END