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 4c90c1a76a4 [CAMEL-21199] Camel-jackson not properly marshalling 4-byte characters (#15958) 4c90c1a76a4 is described below commit 4c90c1a76a42dc6cb517f6e1176f1e18a70108af Author: Radovan Netuka <rnet...@redhat.com> AuthorDate: Thu Oct 17 15:29:46 2024 +0200 [CAMEL-21199] Camel-jackson not properly marshalling 4-byte characters (#15958) --- .../apache/camel/catalog/dataformats/jackson.json | 2 +- .../camel/catalog/dataformats/jacksonXml.json | 29 +++++----- .../apache/camel/catalog/models/jacksonXml.json | 29 +++++----- .../org/apache/camel/catalog/models/json.json | 2 +- .../apache/camel/catalog/schemas/camel-spring.xsd | 16 +----- .../jackson/JacksonDataFormatConfigurer.java | 4 +- .../apache/camel/component/jackson/jackson.json | 2 +- .../src/main/docs/jackson-dataformat.adoc | 7 ++- .../jackson/AbstractJacksonDataFormat.java | 23 ++++---- .../JacksonMarshalMultibyteCharactersTest.java | 13 ++++- .../jackson/JacksonMarshalUseWriterTest.java | 65 ---------------------- .../jacksonxml/JacksonXMLDataFormatConfigurer.java | 2 - .../camel/component/jacksonxml/jacksonXml.json | 29 +++++----- .../src/main/docs/jacksonXml-dataformat.adoc | 6 -- .../component/jacksonxml/JacksonXMLDataFormat.java | 18 +----- .../dataformat/protobuf/ProtobufDataFormat.java | 2 +- .../apache/camel/model/dataformat/jacksonXml.json | 29 +++++----- .../org/apache/camel/model/dataformat/json.json | 2 +- .../model/dataformat/JacksonXMLDataFormat.java | 38 ------------- .../camel/model/dataformat/JsonDataFormat.java | 40 ++++++------- .../dataformat/JacksonXMLDataFormatReifier.java | 1 - .../reifier/dataformat/JsonDataFormatReifier.java | 2 +- .../java/org/apache/camel/xml/in/ModelParser.java | 3 +- .../java/org/apache/camel/xml/out/ModelWriter.java | 3 +- .../org/apache/camel/yaml/out/ModelWriter.java | 3 +- .../dsl/yaml/deserializers/ModelDeserializers.java | 20 +++---- .../generated/resources/schema/camelYamlDsl.json | 15 ++--- 27 files changed, 128 insertions(+), 277 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/jackson.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/jackson.json index 5a2cdec82b9..331bc0dbafc 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/jackson.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/jackson.json @@ -21,7 +21,7 @@ "useDefaultObjectMapper": { "index": 2, "kind": "attribute", "displayName": "Use Default Object Mapper", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to lookup and use default Jackson ObjectMapper from the registry." }, "autoDiscoverObjectMapper": { "index": 3, "kind": "attribute", "displayName": "Auto Discover Object Mapper", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If set to true then Jackson will look for an objectMapper to use from the registry" }, "prettyPrint": { "index": 4, "kind": "attribute", "displayName": "Pretty Print", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To enable pretty printing output nicely formatted. Is by default false." }, - "useWriter": { "index": 5, "kind": "attribute", "displayName": "Use Writer", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte\/4-byte characters such as Japanese." }, + "combineUnicodeSurrogates": { "index": 5, "kind": "attribute", "displayName": "Combine Unicode Surrogates", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force generator that outputs JSON content to combine surrogate pairs (if any) into 4-byte characters. This should be preferred when using 4-byte characters such as Japanese." }, "unmarshalType": { "index": 6, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, "jsonView": { "index": 7, "kind": "attribute", "displayName": "Json View", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, "include": { "index": 8, "kind": "attribute", "displayName": "Include", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/jacksonXml.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/jacksonXml.json index 49ccd095846..f77c64d4d59 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/jacksonXml.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/jacksonXml.json @@ -19,20 +19,19 @@ "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, "xmlMapper": { "index": 1, "kind": "attribute", "displayName": "Xml Mapper", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Lookup and use the existing XmlMapper with the given id." }, "prettyPrint": { "index": 2, "kind": "attribute", "displayName": "Pretty Print", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To enable pretty printing output nicely formatted. Is by default false." }, - "useWriter": { "index": 3, "kind": "attribute", "displayName": "Use Writer", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force using generator that outputs XML content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte\/4-byte characters such as Japanese." }, - "unmarshalType": { "index": 4, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, - "allowUnmarshallType": { "index": 5, "kind": "attribute", "displayName": "Allow Unmarshall Type", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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." }, - "jsonView": { "index": 6, "kind": "attribute", "displayName": "Json View", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, - "include": { "index": 7, "kind": "attribute", "displayName": "Include", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, - "allowJmsType": { "index": 8, "kind": "attribute", "displayName": "Allow Jms Type", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to." }, - "collectionType": { "index": 9, "kind": "attribute", "displayName": "Collection Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default." }, - "useList": { "index": 10, "kind": "attribute", "displayName": "Use List", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To unmarshal to a List of Map or a List of Pojo." }, - "timezone": { "index": 11, "kind": "attribute", "displayName": "Timezone", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If set then Jackson will use the Timezone when marshalling\/unmarshalling." }, - "enableJaxbAnnotationModule": { "index": 12, "kind": "attribute", "displayName": "Enable Jaxb Annotation Module", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the JAXB annotations module when using jackson. When enabled then JAXB annotations can be used by Jackson." }, - "moduleClassNames": { "index": 13, "kind": "attribute", "displayName": "Module Class Names", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules com.fasterxml.jackson.databind.Module specified as a String with FQN class names. Multiple classes can be separated by comma." }, - "moduleRefs": { "index": 14, "kind": "attribute", "displayName": "Module Refs", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules referred from the Camel registry. Multiple modules can be separated by comma." }, - "enableFeatures": { "index": 15, "kind": "attribute", "displayName": "Enable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializati [...] - "disableFeatures": { "index": 16, "kind": "attribute", "displayName": "Disable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializ [...] - "contentTypeHeader": { "index": 17, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header with the type from the data format. For example application\/xml for data formats marshalling to XML, or application\/json for data formats marshall [...] + "unmarshalType": { "index": 3, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, + "allowUnmarshallType": { "index": 4, "kind": "attribute", "displayName": "Allow Unmarshall Type", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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." }, + "jsonView": { "index": 5, "kind": "attribute", "displayName": "Json View", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, + "include": { "index": 6, "kind": "attribute", "displayName": "Include", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, + "allowJmsType": { "index": 7, "kind": "attribute", "displayName": "Allow Jms Type", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to." }, + "collectionType": { "index": 8, "kind": "attribute", "displayName": "Collection Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default." }, + "useList": { "index": 9, "kind": "attribute", "displayName": "Use List", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To unmarshal to a List of Map or a List of Pojo." }, + "timezone": { "index": 10, "kind": "attribute", "displayName": "Timezone", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If set then Jackson will use the Timezone when marshalling\/unmarshalling." }, + "enableJaxbAnnotationModule": { "index": 11, "kind": "attribute", "displayName": "Enable Jaxb Annotation Module", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the JAXB annotations module when using jackson. When enabled then JAXB annotations can be used by Jackson." }, + "moduleClassNames": { "index": 12, "kind": "attribute", "displayName": "Module Class Names", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules com.fasterxml.jackson.databind.Module specified as a String with FQN class names. Multiple classes can be separated by comma." }, + "moduleRefs": { "index": 13, "kind": "attribute", "displayName": "Module Refs", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules referred from the Camel registry. Multiple modules can be separated by comma." }, + "enableFeatures": { "index": 14, "kind": "attribute", "displayName": "Enable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializati [...] + "disableFeatures": { "index": 15, "kind": "attribute", "displayName": "Disable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializ [...] + "contentTypeHeader": { "index": 16, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header with the type from the data format. For example application\/xml for data formats marshalling to XML, or application\/json for data formats marshall [...] } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jacksonXml.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jacksonXml.json index 9943337f1b4..0f22728a934 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jacksonXml.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jacksonXml.json @@ -16,20 +16,19 @@ "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, "xmlMapper": { "index": 1, "kind": "attribute", "displayName": "Xml Mapper", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Lookup and use the existing XmlMapper with the given id." }, "prettyPrint": { "index": 2, "kind": "attribute", "displayName": "Pretty Print", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To enable pretty printing output nicely formatted. Is by default false." }, - "useWriter": { "index": 3, "kind": "attribute", "displayName": "Use Writer", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force using generator that outputs XML content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte\/4-byte characters such as Japanese." }, - "unmarshalType": { "index": 4, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, - "allowUnmarshallType": { "index": 5, "kind": "attribute", "displayName": "Allow Unmarshall Type", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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." }, - "jsonView": { "index": 6, "kind": "attribute", "displayName": "Json View", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, - "include": { "index": 7, "kind": "attribute", "displayName": "Include", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, - "allowJmsType": { "index": 8, "kind": "attribute", "displayName": "Allow Jms Type", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to." }, - "collectionType": { "index": 9, "kind": "attribute", "displayName": "Collection Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default." }, - "useList": { "index": 10, "kind": "attribute", "displayName": "Use List", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To unmarshal to a List of Map or a List of Pojo." }, - "timezone": { "index": 11, "kind": "attribute", "displayName": "Timezone", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If set then Jackson will use the Timezone when marshalling\/unmarshalling." }, - "enableJaxbAnnotationModule": { "index": 12, "kind": "attribute", "displayName": "Enable Jaxb Annotation Module", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the JAXB annotations module when using jackson. When enabled then JAXB annotations can be used by Jackson." }, - "moduleClassNames": { "index": 13, "kind": "attribute", "displayName": "Module Class Names", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules com.fasterxml.jackson.databind.Module specified as a String with FQN class names. Multiple classes can be separated by comma." }, - "moduleRefs": { "index": 14, "kind": "attribute", "displayName": "Module Refs", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules referred from the Camel registry. Multiple modules can be separated by comma." }, - "enableFeatures": { "index": 15, "kind": "attribute", "displayName": "Enable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializati [...] - "disableFeatures": { "index": 16, "kind": "attribute", "displayName": "Disable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializ [...] - "contentTypeHeader": { "index": 17, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header with the type from the data format. For example application\/xml for data formats marshalling to XML, or application\/json for data formats marshall [...] + "unmarshalType": { "index": 3, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, + "allowUnmarshallType": { "index": 4, "kind": "attribute", "displayName": "Allow Unmarshall Type", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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." }, + "jsonView": { "index": 5, "kind": "attribute", "displayName": "Json View", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, + "include": { "index": 6, "kind": "attribute", "displayName": "Include", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, + "allowJmsType": { "index": 7, "kind": "attribute", "displayName": "Allow Jms Type", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to." }, + "collectionType": { "index": 8, "kind": "attribute", "displayName": "Collection Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default." }, + "useList": { "index": 9, "kind": "attribute", "displayName": "Use List", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To unmarshal to a List of Map or a List of Pojo." }, + "timezone": { "index": 10, "kind": "attribute", "displayName": "Timezone", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If set then Jackson will use the Timezone when marshalling\/unmarshalling." }, + "enableJaxbAnnotationModule": { "index": 11, "kind": "attribute", "displayName": "Enable Jaxb Annotation Module", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the JAXB annotations module when using jackson. When enabled then JAXB annotations can be used by Jackson." }, + "moduleClassNames": { "index": 12, "kind": "attribute", "displayName": "Module Class Names", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules com.fasterxml.jackson.databind.Module specified as a String with FQN class names. Multiple classes can be separated by comma." }, + "moduleRefs": { "index": 13, "kind": "attribute", "displayName": "Module Refs", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules referred from the Camel registry. Multiple modules can be separated by comma." }, + "enableFeatures": { "index": 14, "kind": "attribute", "displayName": "Enable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializati [...] + "disableFeatures": { "index": 15, "kind": "attribute", "displayName": "Disable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializ [...] + "contentTypeHeader": { "index": 16, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header with the type from the data format. For example application\/xml for data formats marshalling to XML, or application\/json for data formats marshall [...] } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/json.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/json.json index 5d1b1fe5690..481742c34e5 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/json.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/json.json @@ -18,7 +18,7 @@ "autoDiscoverObjectMapper": { "index": 3, "kind": "attribute", "displayName": "Auto Discover Object Mapper", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If set to true then Jackson will look for an objectMapper to use from the registry" }, "prettyPrint": { "index": 4, "kind": "attribute", "displayName": "Pretty Print", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To enable pretty printing output nicely formatted. Is by default false." }, "library": { "index": 5, "kind": "attribute", "displayName": "Library", "group": "common", "required": false, "type": "enum", "javaType": "org.apache.camel.model.dataformat.JsonLibrary", "enum": [ "Fastjson", "Gson", "Jackson", "Johnzon", "Jsonb" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Jackson", "description": "Which json library to use." }, - "useWriter": { "index": 6, "kind": "attribute", "displayName": "Use Writer", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte\/4-byte characters such as Japanese." }, + "combineUnicodeSurrogates": { "index": 6, "kind": "attribute", "displayName": "Combine Unicode Surrogates", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force generator that outputs JSON content to combine surrogate pairs (if any) into 4-byte characters. This should be preferred when using 4-byte characters such as Japanese." }, "unmarshalType": { "index": 7, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, "jsonView": { "index": 8, "kind": "attribute", "displayName": "Json View", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, "include": { "index": 9, "kind": "attribute", "displayName": "Include", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd index 566a574b1df..3879096bf10 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd @@ -8783,16 +8783,6 @@ Lookup and use the existing XmlMapper with the given id. <xs:documentation xml:lang="en"> <![CDATA[ To enable pretty printing output nicely formatted. Is by default false. Default value: false -]]> - </xs:documentation> - </xs:annotation> - </xs:attribute> - <xs:attribute name="useWriter" type="xs:string"> - <xs:annotation> - <xs:documentation xml:lang="en"> -<![CDATA[ -Force using generator that outputs XML content using a java.io.Writer which handles character encoding. This should be -preferred when using 2-byte/4-byte characters such as Japanese. Default value: false ]]> </xs:documentation> </xs:annotation> @@ -9194,12 +9184,12 @@ Which json library to use. Default value: Jackson </xs:documentation> </xs:annotation> </xs:attribute> - <xs:attribute name="useWriter" type="xs:string"> + <xs:attribute name="combineUnicodeSurrogates" type="xs:string"> <xs:annotation> <xs:documentation xml:lang="en"> <![CDATA[ -Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This should be -preferred when using 2-byte/4-byte characters such as Japanese. Default value: false +Force generator that outputs JSON content to combine surrogate pairs (if any) into 4-byte characters. This should be +preferred when using 4-byte characters such as Japanese. Default value: false ]]> </xs:documentation> </xs:annotation> diff --git a/components/camel-jackson/src/generated/java/org/apache/camel/component/jackson/JacksonDataFormatConfigurer.java b/components/camel-jackson/src/generated/java/org/apache/camel/component/jackson/JacksonDataFormatConfigurer.java index 0914711e7f3..13468664b87 100644 --- a/components/camel-jackson/src/generated/java/org/apache/camel/component/jackson/JacksonDataFormatConfigurer.java +++ b/components/camel-jackson/src/generated/java/org/apache/camel/component/jackson/JacksonDataFormatConfigurer.java @@ -24,8 +24,8 @@ public class JacksonDataFormatConfigurer extends PropertyConfigurerSupport imple case "objectMapper": dataformat.setObjectMapper(property(camelContext, com.fasterxml.jackson.databind.ObjectMapper.class, value)); return true; case "usedefaultobjectmapper": case "useDefaultObjectMapper": dataformat.setUseDefaultObjectMapper(property(camelContext, boolean.class, value)); return true; - case "usewriter": - case "useWriter": dataformat.setUseWriter(property(camelContext, boolean.class, value)); return true; + case "combineunicodesurrogates": + case "combineUnicodeSurrogates": dataformat.setCombineUnicodeSurrogates(property(camelContext, boolean.class, value)); return true; case "collectiontype": case "collectionType": dataformat.setCollectionType(property(camelContext, java.lang.Class.class, value)); return true; case "moduleclassnames": diff --git a/components/camel-jackson/src/generated/resources/META-INF/org/apache/camel/component/jackson/jackson.json b/components/camel-jackson/src/generated/resources/META-INF/org/apache/camel/component/jackson/jackson.json index 5a2cdec82b9..331bc0dbafc 100644 --- a/components/camel-jackson/src/generated/resources/META-INF/org/apache/camel/component/jackson/jackson.json +++ b/components/camel-jackson/src/generated/resources/META-INF/org/apache/camel/component/jackson/jackson.json @@ -21,7 +21,7 @@ "useDefaultObjectMapper": { "index": 2, "kind": "attribute", "displayName": "Use Default Object Mapper", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to lookup and use default Jackson ObjectMapper from the registry." }, "autoDiscoverObjectMapper": { "index": 3, "kind": "attribute", "displayName": "Auto Discover Object Mapper", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If set to true then Jackson will look for an objectMapper to use from the registry" }, "prettyPrint": { "index": 4, "kind": "attribute", "displayName": "Pretty Print", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To enable pretty printing output nicely formatted. Is by default false." }, - "useWriter": { "index": 5, "kind": "attribute", "displayName": "Use Writer", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte\/4-byte characters such as Japanese." }, + "combineUnicodeSurrogates": { "index": 5, "kind": "attribute", "displayName": "Combine Unicode Surrogates", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force generator that outputs JSON content to combine surrogate pairs (if any) into 4-byte characters. This should be preferred when using 4-byte characters such as Japanese." }, "unmarshalType": { "index": 6, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, "jsonView": { "index": 7, "kind": "attribute", "displayName": "Json View", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, "include": { "index": 8, "kind": "attribute", "displayName": "Include", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, diff --git a/components/camel-jackson/src/main/docs/jackson-dataformat.adoc b/components/camel-jackson/src/main/docs/jackson-dataformat.adoc index 180155358f8..91e6ce4e2b9 100644 --- a/components/camel-jackson/src/main/docs/jackson-dataformat.adoc +++ b/components/camel-jackson/src/main/docs/jackson-dataformat.adoc @@ -33,9 +33,10 @@ include::partial$dataformat-options.adoc[] === 2 and 4 bytes characters -Jackson will default work with UTF-8 using an optimized JSon generator that only supports UTF-8. -For users that need 2-bytes or 4-bytes (such as Japanese) would need to turn on `useWriter=true` -in the Camel dataformat, to use another JSon generator that lets `java.io.Writer` handle character encodings. +Jackson by default outputs 4-byte characters (in languages such as Japanese) as surrogate pair, escaped. This is +compliant with Json specification. This can however frustrate users, because it garbles regular output, such as +names and texts with Unicode escapes. To avoid this, users commonly use 4-bytes would need to turn on `combineUnicodeSurrogates=true` +in the Camel dataformat. === Using custom ObjectMapper diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java index acccb8e258e..22db2ba6b90 100644 --- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java +++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java @@ -19,7 +19,6 @@ package org.apache.camel.component.jackson; import java.io.File; import java.io.InputStream; import java.io.OutputStream; -import java.io.OutputStreamWriter; import java.io.Reader; import java.util.ArrayList; import java.util.Collection; @@ -32,12 +31,14 @@ import java.util.TimeZone; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.FormatSchema; +import com.fasterxml.jackson.core.json.JsonWriteFeature; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; +import com.fasterxml.jackson.databind.ObjectWriter; import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.SerializationFeature; @@ -66,7 +67,7 @@ public abstract class AbstractJacksonDataFormat extends ServiceSupport private CamelContext camelContext; private ObjectMapper objectMapper; private boolean useDefaultObjectMapper = true; - private boolean useWriter; + private boolean combineUnicodeSurrogates; private String collectionTypeName; private Class<? extends Collection> collectionType; private List<Module> modules; @@ -159,13 +160,11 @@ public abstract class AbstractJacksonDataFormat extends ServiceSupport if (this.schemaResolver != null) { schema = this.schemaResolver.resolve(exchange); } - if (useWriter) { - try (OutputStreamWriter writer = new OutputStreamWriter(stream)) { - this.objectMapper.writerWithView(jsonView).with(schema).writeValue(writer, graph); - } - } else { - this.objectMapper.writerWithView(jsonView).with(schema).writeValue(stream, graph); + ObjectWriter objectWriter = this.objectMapper.writerWithView(jsonView); + if (combineUnicodeSurrogates) { + objectWriter = objectWriter.with(JsonWriteFeature.COMBINE_UNICODE_SURROGATES_IN_UTF8); } + objectWriter.with(schema).writeValue(stream, graph); if (contentTypeHeader) { exchange.getMessage().setHeader(Exchange.CONTENT_TYPE, getDefaultContentType()); @@ -263,12 +262,12 @@ public abstract class AbstractJacksonDataFormat extends ServiceSupport this.unmarshalTypeName = unmarshalTypeName; } - public boolean isUseWriter() { - return useWriter; + public boolean isCombineUnicodeSurrogates() { + return combineUnicodeSurrogates; } - public void setUseWriter(boolean useWriter) { - this.useWriter = useWriter; + public void setCombineUnicodeSurrogates(boolean combineUnicodeSurrogates) { + this.combineUnicodeSurrogates = combineUnicodeSurrogates; } public Class<? extends Collection> getCollectionType() { diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalMultibyteCharactersTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalMultibyteCharactersTest.java index 03d9577279e..0a17cbf12fb 100644 --- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalMultibyteCharactersTest.java +++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalMultibyteCharactersTest.java @@ -29,6 +29,14 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; public class JacksonMarshalMultibyteCharactersTest extends CamelTestSupport { + /** + * Tests marshalling 4-byte characters by Jackson. Jackson, by default, marshals 4-byte characters as a pair of + * UTF-16 escapes - a high and low surrogate, escaped. Since Jackson 2.18, there is an option to combine the + * surrogates into one character. + * <p> + * This test verifies the latter behavior since it's expected that Camel users working with languages such as + * Japanese or Chinese would prefer having the characters combined. + */ @Test public void testMarshal4ByteCharacter() throws Exception { Map<String, Object> in = new HashMap<>(); @@ -42,7 +50,7 @@ public class JacksonMarshalMultibyteCharactersTest extends CamelTestSupport { Object marshalled = template.requestBody("direct:in", in); String marshalledAsString = context.getTypeConverter().convertTo(String.class, marshalled); - // prior to fixing CAMEL-21199, this was the result returned by Jackson + // just for clarity we test that escaped surrogate pair is no longer returned assertNotEquals("{\"name\":\"\u30b7\u30b9\u30c6\u30e0\\uD867\\uDE3D\"}", marshalledAsString); assertEquals("{\"name\":\"\u30b7\u30b9\u30c6\u30e0\uD867\uDE3D\"}", marshalledAsString); @@ -58,8 +66,7 @@ public class JacksonMarshalMultibyteCharactersTest extends CamelTestSupport { @Override public void configure() { JacksonDataFormat format = new JacksonDataFormat(); - format.setUseWriter(true); - + format.setCombineUnicodeSurrogates(true); from("direct:in").marshal(format).log("marshal: ${body}"); from("direct:back").unmarshal(format).log("unmarshal: ${body}").to("mock:reverse"); } diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUseWriterTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUseWriterTest.java deleted file mode 100644 index 227bcc2a7b8..00000000000 --- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalUseWriterTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class JacksonMarshalUseWriterTest extends CamelTestSupport { - - @Test - public void testUseWriter() throws Exception { - Map<String, Object> in = new HashMap<>(); - in.put("name", "Camel"); - - MockEndpoint mock = getMockEndpoint("mock:reverse"); - mock.expectedMessageCount(1); - mock.message(0).body().isInstanceOf(Map.class); - mock.message(0).body().isEqualTo(in); - - Object marshalled = template.requestBody("direct:in", in); - String marshalledAsString = context.getTypeConverter().convertTo(String.class, marshalled); - assertEquals("{\"name\":\"Camel\"}", marshalledAsString); - - template.sendBody("direct:back", marshalled); - - mock.assertIsSatisfied(); - } - - @Override - protected RouteBuilder createRouteBuilder() { - return new RouteBuilder() { - - @Override - public void configure() { - JacksonDataFormat format = new JacksonDataFormat(); - format.setUseWriter(true); - - from("direct:in").marshal(format); - from("direct:back").unmarshal(format).to("mock:reverse"); - } - }; - } - -} diff --git a/components/camel-jacksonxml/src/generated/java/org/apache/camel/component/jacksonxml/JacksonXMLDataFormatConfigurer.java b/components/camel-jacksonxml/src/generated/java/org/apache/camel/component/jacksonxml/JacksonXMLDataFormatConfigurer.java index b6a25acab96..f9c8d7bcf37 100644 --- a/components/camel-jacksonxml/src/generated/java/org/apache/camel/component/jacksonxml/JacksonXMLDataFormatConfigurer.java +++ b/components/camel-jacksonxml/src/generated/java/org/apache/camel/component/jacksonxml/JacksonXMLDataFormatConfigurer.java @@ -22,8 +22,6 @@ public class JacksonXMLDataFormatConfigurer extends PropertyConfigurerSupport im switch (ignoreCase ? name.toLowerCase() : name) { case "xmlmapper": case "xmlMapper": dataformat.setXmlMapper(property(camelContext, com.fasterxml.jackson.dataformat.xml.XmlMapper.class, value)); return true; - case "usewriter": - case "useWriter": dataformat.setUseWriter(property(camelContext, boolean.class, value)); return true; case "collectiontype": case "collectionType": dataformat.setCollectionType(property(camelContext, java.lang.Class.class, value)); return true; case "moduleclassnames": diff --git a/components/camel-jacksonxml/src/generated/resources/META-INF/org/apache/camel/component/jacksonxml/jacksonXml.json b/components/camel-jacksonxml/src/generated/resources/META-INF/org/apache/camel/component/jacksonxml/jacksonXml.json index 49ccd095846..f77c64d4d59 100644 --- a/components/camel-jacksonxml/src/generated/resources/META-INF/org/apache/camel/component/jacksonxml/jacksonXml.json +++ b/components/camel-jacksonxml/src/generated/resources/META-INF/org/apache/camel/component/jacksonxml/jacksonXml.json @@ -19,20 +19,19 @@ "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, "xmlMapper": { "index": 1, "kind": "attribute", "displayName": "Xml Mapper", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Lookup and use the existing XmlMapper with the given id." }, "prettyPrint": { "index": 2, "kind": "attribute", "displayName": "Pretty Print", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To enable pretty printing output nicely formatted. Is by default false." }, - "useWriter": { "index": 3, "kind": "attribute", "displayName": "Use Writer", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force using generator that outputs XML content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte\/4-byte characters such as Japanese." }, - "unmarshalType": { "index": 4, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, - "allowUnmarshallType": { "index": 5, "kind": "attribute", "displayName": "Allow Unmarshall Type", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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." }, - "jsonView": { "index": 6, "kind": "attribute", "displayName": "Json View", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, - "include": { "index": 7, "kind": "attribute", "displayName": "Include", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, - "allowJmsType": { "index": 8, "kind": "attribute", "displayName": "Allow Jms Type", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to." }, - "collectionType": { "index": 9, "kind": "attribute", "displayName": "Collection Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default." }, - "useList": { "index": 10, "kind": "attribute", "displayName": "Use List", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To unmarshal to a List of Map or a List of Pojo." }, - "timezone": { "index": 11, "kind": "attribute", "displayName": "Timezone", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If set then Jackson will use the Timezone when marshalling\/unmarshalling." }, - "enableJaxbAnnotationModule": { "index": 12, "kind": "attribute", "displayName": "Enable Jaxb Annotation Module", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the JAXB annotations module when using jackson. When enabled then JAXB annotations can be used by Jackson." }, - "moduleClassNames": { "index": 13, "kind": "attribute", "displayName": "Module Class Names", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules com.fasterxml.jackson.databind.Module specified as a String with FQN class names. Multiple classes can be separated by comma." }, - "moduleRefs": { "index": 14, "kind": "attribute", "displayName": "Module Refs", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules referred from the Camel registry. Multiple modules can be separated by comma." }, - "enableFeatures": { "index": 15, "kind": "attribute", "displayName": "Enable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializati [...] - "disableFeatures": { "index": 16, "kind": "attribute", "displayName": "Disable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializ [...] - "contentTypeHeader": { "index": 17, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header with the type from the data format. For example application\/xml for data formats marshalling to XML, or application\/json for data formats marshall [...] + "unmarshalType": { "index": 3, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, + "allowUnmarshallType": { "index": 4, "kind": "attribute", "displayName": "Allow Unmarshall Type", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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." }, + "jsonView": { "index": 5, "kind": "attribute", "displayName": "Json View", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, + "include": { "index": 6, "kind": "attribute", "displayName": "Include", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, + "allowJmsType": { "index": 7, "kind": "attribute", "displayName": "Allow Jms Type", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to." }, + "collectionType": { "index": 8, "kind": "attribute", "displayName": "Collection Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default." }, + "useList": { "index": 9, "kind": "attribute", "displayName": "Use List", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To unmarshal to a List of Map or a List of Pojo." }, + "timezone": { "index": 10, "kind": "attribute", "displayName": "Timezone", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If set then Jackson will use the Timezone when marshalling\/unmarshalling." }, + "enableJaxbAnnotationModule": { "index": 11, "kind": "attribute", "displayName": "Enable Jaxb Annotation Module", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the JAXB annotations module when using jackson. When enabled then JAXB annotations can be used by Jackson." }, + "moduleClassNames": { "index": 12, "kind": "attribute", "displayName": "Module Class Names", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules com.fasterxml.jackson.databind.Module specified as a String with FQN class names. Multiple classes can be separated by comma." }, + "moduleRefs": { "index": 13, "kind": "attribute", "displayName": "Module Refs", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules referred from the Camel registry. Multiple modules can be separated by comma." }, + "enableFeatures": { "index": 14, "kind": "attribute", "displayName": "Enable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializati [...] + "disableFeatures": { "index": 15, "kind": "attribute", "displayName": "Disable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializ [...] + "contentTypeHeader": { "index": 16, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header with the type from the data format. For example application\/xml for data formats marshalling to XML, or application\/json for data formats marshall [...] } } diff --git a/components/camel-jacksonxml/src/main/docs/jacksonXml-dataformat.adoc b/components/camel-jacksonxml/src/main/docs/jacksonXml-dataformat.adoc index 638e2819803..0c753ed98b1 100644 --- a/components/camel-jacksonxml/src/main/docs/jacksonXml-dataformat.adoc +++ b/components/camel-jacksonxml/src/main/docs/jacksonXml-dataformat.adoc @@ -49,12 +49,6 @@ include::partial$dataformat-options.adoc[] == Usage -=== 2 and 4 bytes characters - -Jackson will default work with UTF-8 using an optimized generator that only supports UTF-8. -For users that need 2-bytes or 4-bytes (such as Japanese) would need to turn on `useWriter=true` -in the Camel dataformat, to use another generator that lets `java.io.Writer` handle character encodings. - === Using Jackson XML in Spring DSL When using Data Format in Spring DSL, you need to 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 e52c7e9733f..4ec59b5bf8f 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 @@ -19,7 +19,6 @@ package org.apache.camel.component.jacksonxml; import java.io.File; import java.io.InputStream; import java.io.OutputStream; -import java.io.OutputStreamWriter; import java.io.Reader; import java.util.ArrayList; import java.util.Collection; @@ -67,7 +66,6 @@ public class JacksonXMLDataFormat extends ServiceSupport private CamelContext camelContext; private XmlMapper xmlMapper; - private boolean useWriter; private String collectionTypeName; private Class<? extends Collection> collectionType; private List<Module> modules; @@ -171,13 +169,7 @@ public class JacksonXMLDataFormat extends ServiceSupport @Override public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception { - if (useWriter) { - try (OutputStreamWriter writer = new OutputStreamWriter(stream)) { - this.xmlMapper.writerWithView(jsonView).writeValue(writer, graph); - } - } else { - this.xmlMapper.writerWithView(jsonView).writeValue(stream, graph); - } + this.xmlMapper.writerWithView(jsonView).writeValue(stream, graph); if (contentTypeHeader) { exchange.getMessage().setHeader(Exchange.CONTENT_TYPE, "application/xml"); @@ -263,14 +255,6 @@ public class JacksonXMLDataFormat extends ServiceSupport this.unmarshalType = unmarshalType; } - public boolean isUseWriter() { - return useWriter; - } - - public void setUseWriter(boolean useWriter) { - this.useWriter = useWriter; - } - public String getCollectionTypeName() { return collectionTypeName; } diff --git a/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java b/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java index 2025d0ff254..1c591690d8b 100644 --- a/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java +++ b/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java @@ -44,7 +44,7 @@ import org.apache.commons.io.IOUtils; @Dataformat("protobuf") @Metadata(excludeProperties = "library,objectMapper,useDefaultObjectMapper,jsonViewTypeName,jsonView,include,allowJmsType," + - "collectionTypeName,collectionType,useList,useWriter,moduleClassNames,moduleRefs,enableFeatures," + "collectionTypeName,collectionType,useList,combineUnicodeSurrogates,moduleClassNames,moduleRefs,enableFeatures," + "disableFeatures,allowUnmarshallType,timezone,autoDiscoverObjectMapper," + "schemaResolver,autoDiscoverSchemaResolver,unmarshalType,unmarshalTypeName") diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/jacksonXml.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/jacksonXml.json index 9943337f1b4..0f22728a934 100644 --- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/jacksonXml.json +++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/jacksonXml.json @@ -16,20 +16,19 @@ "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, "xmlMapper": { "index": 1, "kind": "attribute", "displayName": "Xml Mapper", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Lookup and use the existing XmlMapper with the given id." }, "prettyPrint": { "index": 2, "kind": "attribute", "displayName": "Pretty Print", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To enable pretty printing output nicely formatted. Is by default false." }, - "useWriter": { "index": 3, "kind": "attribute", "displayName": "Use Writer", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force using generator that outputs XML content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte\/4-byte characters such as Japanese." }, - "unmarshalType": { "index": 4, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, - "allowUnmarshallType": { "index": 5, "kind": "attribute", "displayName": "Allow Unmarshall Type", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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." }, - "jsonView": { "index": 6, "kind": "attribute", "displayName": "Json View", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, - "include": { "index": 7, "kind": "attribute", "displayName": "Include", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, - "allowJmsType": { "index": 8, "kind": "attribute", "displayName": "Allow Jms Type", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to." }, - "collectionType": { "index": 9, "kind": "attribute", "displayName": "Collection Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default." }, - "useList": { "index": 10, "kind": "attribute", "displayName": "Use List", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To unmarshal to a List of Map or a List of Pojo." }, - "timezone": { "index": 11, "kind": "attribute", "displayName": "Timezone", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If set then Jackson will use the Timezone when marshalling\/unmarshalling." }, - "enableJaxbAnnotationModule": { "index": 12, "kind": "attribute", "displayName": "Enable Jaxb Annotation Module", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the JAXB annotations module when using jackson. When enabled then JAXB annotations can be used by Jackson." }, - "moduleClassNames": { "index": 13, "kind": "attribute", "displayName": "Module Class Names", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules com.fasterxml.jackson.databind.Module specified as a String with FQN class names. Multiple classes can be separated by comma." }, - "moduleRefs": { "index": 14, "kind": "attribute", "displayName": "Module Refs", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules referred from the Camel registry. Multiple modules can be separated by comma." }, - "enableFeatures": { "index": 15, "kind": "attribute", "displayName": "Enable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializati [...] - "disableFeatures": { "index": 16, "kind": "attribute", "displayName": "Disable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializ [...] - "contentTypeHeader": { "index": 17, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header with the type from the data format. For example application\/xml for data formats marshalling to XML, or application\/json for data formats marshall [...] + "unmarshalType": { "index": 3, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, + "allowUnmarshallType": { "index": 4, "kind": "attribute", "displayName": "Allow Unmarshall Type", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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." }, + "jsonView": { "index": 5, "kind": "attribute", "displayName": "Json View", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, + "include": { "index": 6, "kind": "attribute", "displayName": "Include", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, + "allowJmsType": { "index": 7, "kind": "attribute", "displayName": "Allow Jms Type", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to." }, + "collectionType": { "index": 8, "kind": "attribute", "displayName": "Collection Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default." }, + "useList": { "index": 9, "kind": "attribute", "displayName": "Use List", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To unmarshal to a List of Map or a List of Pojo." }, + "timezone": { "index": 10, "kind": "attribute", "displayName": "Timezone", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If set then Jackson will use the Timezone when marshalling\/unmarshalling." }, + "enableJaxbAnnotationModule": { "index": 11, "kind": "attribute", "displayName": "Enable Jaxb Annotation Module", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the JAXB annotations module when using jackson. When enabled then JAXB annotations can be used by Jackson." }, + "moduleClassNames": { "index": 12, "kind": "attribute", "displayName": "Module Class Names", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules com.fasterxml.jackson.databind.Module specified as a String with FQN class names. Multiple classes can be separated by comma." }, + "moduleRefs": { "index": 13, "kind": "attribute", "displayName": "Module Refs", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom Jackson modules referred from the Camel registry. Multiple modules can be separated by comma." }, + "enableFeatures": { "index": 14, "kind": "attribute", "displayName": "Enable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializati [...] + "disableFeatures": { "index": 15, "kind": "attribute", "displayName": "Disable Features", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "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.Deserializ [...] + "contentTypeHeader": { "index": 16, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header with the type from the data format. For example application\/xml for data formats marshalling to XML, or application\/json for data formats marshall [...] } } diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/json.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/json.json index 5d1b1fe5690..481742c34e5 100644 --- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/json.json +++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/json.json @@ -18,7 +18,7 @@ "autoDiscoverObjectMapper": { "index": 3, "kind": "attribute", "displayName": "Auto Discover Object Mapper", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If set to true then Jackson will look for an objectMapper to use from the registry" }, "prettyPrint": { "index": 4, "kind": "attribute", "displayName": "Pretty Print", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To enable pretty printing output nicely formatted. Is by default false." }, "library": { "index": 5, "kind": "attribute", "displayName": "Library", "group": "common", "required": false, "type": "enum", "javaType": "org.apache.camel.model.dataformat.JsonLibrary", "enum": [ "Fastjson", "Gson", "Jackson", "Johnzon", "Jsonb" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Jackson", "description": "Which json library to use." }, - "useWriter": { "index": 6, "kind": "attribute", "displayName": "Use Writer", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte\/4-byte characters such as Japanese." }, + "combineUnicodeSurrogates": { "index": 6, "kind": "attribute", "displayName": "Combine Unicode Surrogates", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Force generator that outputs JSON content to combine surrogate pairs (if any) into 4-byte characters. This should be preferred when using 4-byte characters such as Japanese." }, "unmarshalType": { "index": 7, "kind": "attribute", "displayName": "Unmarshal Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Class name of the java type to use when unmarshalling" }, "jsonView": { "index": 8, "kind": "attribute", "displayName": "Json View", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations" }, "include": { "index": 9, "kind": "attribute", "displayName": "Include", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL" }, diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/JacksonXMLDataFormat.java b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/JacksonXMLDataFormat.java index a7dc8367fa1..429817b657a 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/JacksonXMLDataFormat.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/JacksonXMLDataFormat.java @@ -47,11 +47,6 @@ public class JacksonXMLDataFormat extends DataFormatDefinition implements Conten @XmlAttribute @Metadata(javaType = "java.lang.Boolean") private String prettyPrint; - @XmlAttribute - @Metadata(javaType = "java.lang.Boolean", - description = "Force using generator that outputs XML content using a java.io.Writer which handles character encoding." - + " This should be preferred when using 2-byte/4-byte characters such as Japanese.") - private String useWriter; @XmlAttribute(name = "unmarshalType") private String unmarshalTypeName; @XmlAttribute @@ -103,7 +98,6 @@ public class JacksonXMLDataFormat extends DataFormatDefinition implements Conten this.collectionType = builder.collectionType; this.xmlMapper = builder.xmlMapper; this.prettyPrint = builder.prettyPrint; - this.useWriter = builder.useWriter; this.unmarshalTypeName = builder.unmarshalTypeName; this.allowUnmarshallType = builder.allowUnmarshallType; this.jsonViewTypeName = builder.jsonViewTypeName; @@ -127,7 +121,6 @@ public class JacksonXMLDataFormat extends DataFormatDefinition implements Conten this.collectionType = builder.collectionType; this.xmlMapper = builder.xmlMapper; this.prettyPrint = builder.prettyPrint; - this.useWriter = builder.useWriter; this.unmarshalTypeName = builder.unmarshalTypeName; this.allowUnmarshallType = builder.allowUnmarshallType; this.jsonViewTypeName = builder.jsonViewTypeName; @@ -160,18 +153,6 @@ public class JacksonXMLDataFormat extends DataFormatDefinition implements Conten this.xmlMapper = xmlMapper; } - public String getUseWriter() { - return useWriter; - } - - /** - * Force using generator that outputs XML content using a java.io.Writer which handles character encoding. + This - * should be preferred when using 2-byte/4-byte characters such as Japanese. - */ - public void setUseWriter(String useWriter) { - this.useWriter = useWriter; - } - public String getPrettyPrint() { return prettyPrint; } @@ -401,7 +382,6 @@ public class JacksonXMLDataFormat extends DataFormatDefinition implements Conten private Class<?> collectionType; private String xmlMapper; private String prettyPrint; - private String useWriter; private String unmarshalTypeName; private String allowUnmarshallType; private String jsonViewTypeName; @@ -445,24 +425,6 @@ public class JacksonXMLDataFormat extends DataFormatDefinition implements Conten return this; } - /** - * Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This - * should be preferred when using 2-byte/4-byte characters such as Japanese. - */ - public Builder useWriter(boolean useWriter) { - this.useWriter = Boolean.toString(useWriter); - return this; - } - - /** - * Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This - * should be preferred when using 2-byte/4-byte characters such as Japanese. - */ - public Builder useWriter(String useWriter) { - this.useWriter = useWriter; - return this; - } - /** * Class name of the java type to use when unmarshalling */ diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java index 65a87647059..56a4c5cd68e 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java @@ -50,9 +50,9 @@ public class JsonDataFormat extends DataFormatDefinition implements ContentTypeH private JsonLibrary library = JsonLibrary.Jackson; @XmlAttribute @Metadata(javaType = "java.lang.Boolean", - description = "Force using generator that outputs JSON content using a java.io.Writer which handles character encoding." - + " This should be preferred when using 2-byte/4-byte characters such as Japanese.") - private String useWriter; + description = "Force generator that outputs JSON content to combine surrogate pairs (if any) into 4-byte " + + "characters. This should be preferred when using 4-byte characters such as Japanese.") + private String combineUnicodeSurrogates; @XmlAttribute(name = "unmarshalType") private String unmarshalTypeName; @XmlTransient @@ -129,7 +129,7 @@ public class JsonDataFormat extends DataFormatDefinition implements ContentTypeH this.autoDiscoverObjectMapper = source.autoDiscoverObjectMapper; this.prettyPrint = source.prettyPrint; this.library = source.library; - this.useWriter = source.useWriter; + this.combineUnicodeSurrogates = source.combineUnicodeSurrogates; this.unmarshalTypeName = source.unmarshalTypeName; this.unmarshalType = source.unmarshalType; this.jsonViewTypeName = source.jsonViewTypeName; @@ -159,7 +159,7 @@ public class JsonDataFormat extends DataFormatDefinition implements ContentTypeH this.autoDiscoverObjectMapper = builder.autoDiscoverObjectMapper; this.prettyPrint = builder.prettyPrint; this.library = builder.library; - this.useWriter = builder.useWriter; + this.combineUnicodeSurrogates = builder.combineUnicodeSurrogates; this.unmarshalTypeName = builder.unmarshalTypeName; this.unmarshalType = builder.unmarshalType; this.jsonViewTypeName = builder.jsonViewTypeName; @@ -244,16 +244,16 @@ public class JsonDataFormat extends DataFormatDefinition implements ContentTypeH this.prettyPrint = prettyPrint; } - public String getUseWriter() { - return useWriter; + public String getCombineUnicodeSurrogates() { + return combineUnicodeSurrogates; } /** - * Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This - * should be preferred when using 2-byte/4-byte characters such as Japanese. + * Force generator that outputs JSON content to combine surrogate pairs (if any) into 4-byte characters. This should + * be preferred when using 4-byte characters such as Japanese. */ - public void setUseWriter(String useWriter) { - this.useWriter = useWriter; + public void setCombineUnicodeSurrogates(String combineUnicodeSurrogates) { + this.combineUnicodeSurrogates = combineUnicodeSurrogates; } public String getUnmarshalTypeName() { @@ -637,7 +637,7 @@ public class JsonDataFormat extends DataFormatDefinition implements ContentTypeH private String autoDiscoverObjectMapper; private String prettyPrint; private JsonLibrary library = JsonLibrary.Jackson; - private String useWriter; + private String combineUnicodeSurrogates; private String unmarshalTypeName; private Class<?> unmarshalType; private String jsonViewTypeName; @@ -754,20 +754,20 @@ public class JsonDataFormat extends DataFormatDefinition implements ContentTypeH } /** - * Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This - * should be preferred when using 2-byte/4-byte characters such as Japanese. + * Force generator that outputs JSON content to combine surrogate pairs (if any) into 4-byte characters. This + * should be preferred when using 4-byte characters such as Japanese. */ - public Builder useWriter(boolean useWriter) { - this.useWriter = Boolean.toString(useWriter); + public Builder combineUnicodeSurrogates(boolean combineUnicodeSurrogates) { + this.combineUnicodeSurrogates = Boolean.toString(combineUnicodeSurrogates); return this; } /** - * Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This - * should be preferred when using 2-byte/4-byte characters such as Japanese. + * Force generator that outputs JSON content to combine surrogate pairs (if any) into 4-byte characters. This + * should be preferred when using 4-byte characters such as Japanese. */ - public Builder useWriter(String useWriter) { - this.useWriter = useWriter; + public Builder combineUnicodeSurrogates(String combineUnicodeSurrogates) { + this.combineUnicodeSurrogates = combineUnicodeSurrogates; return this; } diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/JacksonXMLDataFormatReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/JacksonXMLDataFormatReifier.java index 108ffcaa192..6241e65c3f8 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/JacksonXMLDataFormatReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/JacksonXMLDataFormatReifier.java @@ -34,7 +34,6 @@ public class JacksonXMLDataFormatReifier extends DataFormatReifier<JacksonXMLDat properties.put("unmarshalType", or(definition.getUnmarshalType(), definition.getUnmarshalTypeName())); properties.put("jsonView", or(definition.getJsonView(), definition.getJsonViewTypeName())); properties.put("prettyPrint", definition.getPrettyPrint()); - properties.put("useWriter", definition.getUseWriter()); properties.put("include", definition.getInclude()); properties.put("allowJmsType", definition.getAllowJmsType()); properties.put("collectionType", or(definition.getCollectionType(), definition.getCollectionTypeName())); diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/JsonDataFormatReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/JsonDataFormatReifier.java index 59d8c7a5219..76ce3933b51 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/JsonDataFormatReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/JsonDataFormatReifier.java @@ -50,7 +50,7 @@ public class JsonDataFormatReifier extends DataFormatReifier<JsonDataFormat> { properties.put("allowJmsType", definition.getAllowJmsType()); properties.put("collectionType", or(definition.getCollectionType(), definition.getCollectionTypeName())); properties.put("useList", definition.getUseList()); - properties.put("useWriter", definition.getUseWriter()); + properties.put("combineUnicodeSurrogates", definition.getCombineUnicodeSurrogates()); properties.put("moduleClassNames", definition.getModuleClassNames()); properties.put("moduleRefs", definition.getModuleRefs()); properties.put("enableFeatures", definition.getEnableFeatures()); diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java index 527ad865f4b..479084a27a3 100644 --- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java +++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java @@ -1881,7 +1881,6 @@ public class ModelParser extends BaseParser { case "timezone": def.setTimezone(val); yield true; case "unmarshalType": def.setUnmarshalTypeName(val); yield true; case "useList": def.setUseList(val); yield true; - case "useWriter": def.setUseWriter(val); yield true; case "xmlMapper": def.setXmlMapper(val); yield true; default: yield identifiedTypeAttributeHandler().accept(def, key, val); }, noElementHandler(), noValueHandler()); @@ -1925,6 +1924,7 @@ public class ModelParser extends BaseParser { case "autoDiscoverObjectMapper": def.setAutoDiscoverObjectMapper(val); yield true; case "autoDiscoverSchemaResolver": def.setAutoDiscoverSchemaResolver(val); yield true; case "collectionType": def.setCollectionTypeName(val); yield true; + case "combineUnicodeSurrogates": def.setCombineUnicodeSurrogates(val); yield true; case "contentTypeHeader": def.setContentTypeHeader(val); yield true; case "dateFormatPattern": def.setDateFormatPattern(val); yield true; case "disableFeatures": def.setDisableFeatures(val); yield true; @@ -1942,7 +1942,6 @@ public class ModelParser extends BaseParser { case "unmarshalType": def.setUnmarshalTypeName(val); yield true; case "useDefaultObjectMapper": def.setUseDefaultObjectMapper(val); yield true; case "useList": def.setUseList(val); yield true; - case "useWriter": def.setUseWriter(val); yield true; default: yield identifiedTypeAttributeHandler().accept(def, key, val); }, noElementHandler(), noValueHandler()); } diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java index 4f4439aaff9..ce5841617db 100644 --- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java +++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java @@ -2584,7 +2584,6 @@ public class ModelWriter extends BaseWriter { doWriteAttribute("moduleClassNames", def.getModuleClassNames()); doWriteAttribute("collectionType", def.getCollectionTypeName()); doWriteAttribute("allowJmsType", def.getAllowJmsType()); - doWriteAttribute("useWriter", def.getUseWriter()); doWriteAttribute("jsonView", def.getJsonViewTypeName()); doWriteAttribute("enableFeatures", def.getEnableFeatures()); doWriteAttribute("useList", def.getUseList()); @@ -2644,11 +2643,11 @@ public class ModelWriter extends BaseWriter { doWriteAttribute("prettyPrint", def.getPrettyPrint()); doWriteAttribute("unmarshalType", def.getUnmarshalTypeName()); doWriteAttribute("autoDiscoverSchemaResolver", def.getAutoDiscoverSchemaResolver()); - doWriteAttribute("useWriter", def.getUseWriter()); doWriteAttribute("useList", def.getUseList()); doWriteAttribute("disableFeatures", def.getDisableFeatures()); doWriteAttribute("moduleRefs", def.getModuleRefs()); doWriteAttribute("schemaResolver", def.getSchemaResolver()); + doWriteAttribute("combineUnicodeSurrogates", def.getCombineUnicodeSurrogates()); doWriteAttribute("useDefaultObjectMapper", def.getUseDefaultObjectMapper()); doWriteAttribute("objectMapper", def.getObjectMapper()); doWriteAttribute("namingStrategy", def.getNamingStrategy()); diff --git a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java index adfa2f9d241..75466431c09 100644 --- a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java +++ b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java @@ -2584,7 +2584,6 @@ public class ModelWriter extends BaseWriter { doWriteAttribute("moduleClassNames", def.getModuleClassNames()); doWriteAttribute("collectionType", def.getCollectionTypeName()); doWriteAttribute("allowJmsType", def.getAllowJmsType()); - doWriteAttribute("useWriter", def.getUseWriter()); doWriteAttribute("jsonView", def.getJsonViewTypeName()); doWriteAttribute("enableFeatures", def.getEnableFeatures()); doWriteAttribute("useList", def.getUseList()); @@ -2644,11 +2643,11 @@ public class ModelWriter extends BaseWriter { doWriteAttribute("prettyPrint", def.getPrettyPrint()); doWriteAttribute("unmarshalType", def.getUnmarshalTypeName()); doWriteAttribute("autoDiscoverSchemaResolver", def.getAutoDiscoverSchemaResolver()); - doWriteAttribute("useWriter", def.getUseWriter()); doWriteAttribute("useList", def.getUseList()); doWriteAttribute("disableFeatures", def.getDisableFeatures()); doWriteAttribute("moduleRefs", def.getModuleRefs()); doWriteAttribute("schemaResolver", def.getSchemaResolver()); + doWriteAttribute("combineUnicodeSurrogates", def.getCombineUnicodeSurrogates()); doWriteAttribute("useDefaultObjectMapper", def.getUseDefaultObjectMapper()); doWriteAttribute("objectMapper", def.getObjectMapper()); doWriteAttribute("namingStrategy", def.getNamingStrategy()); diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java index d501be1acb7..2c8db785ea2 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java @@ -7561,7 +7561,6 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "timezone", type = "string", description = "If set then Jackson will use the Timezone when marshalling/unmarshalling.", displayName = "Timezone"), @YamlProperty(name = "unmarshalType", type = "string", description = "Class name of the java type to use when unmarshalling", displayName = "Unmarshal Type"), @YamlProperty(name = "useList", type = "boolean", description = "To unmarshal to a List of Map or a List of Pojo.", displayName = "Use List"), - @YamlProperty(name = "useWriter", type = "boolean", description = "Force using generator that outputs XML content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte/4-byte characters such as Japanese.", displayName = "Use Writer"), @YamlProperty(name = "xmlMapper", type = "string", description = "Lookup and use the existing XmlMapper with the given id.", displayName = "Xml Mapper") } ) @@ -7660,11 +7659,6 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setUseList(val); break; } - case "useWriter": { - String val = asText(node); - target.setUseWriter(val); - break; - } case "xmlMapper": { String val = asText(node); target.setXmlMapper(val); @@ -8222,6 +8216,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "autoDiscoverObjectMapper", type = "boolean", description = "If set to true then Jackson will look for an objectMapper to use from the registry", displayName = "Auto Discover Object Mapper"), @YamlProperty(name = "autoDiscoverSchemaResolver", type = "boolean", description = "When not disabled, the SchemaResolver will be looked up into the registry", displayName = "Auto Discover Schema Resolver"), @YamlProperty(name = "collectionType", type = "string", description = "Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows using different collection types than java.util.Collection based as default.", displayName = "Collection Type"), + @YamlProperty(name = "combineUnicodeSurrogates", type = "boolean", description = "Force generator that outputs JSON content to combine surrogate pairs (if any) into 4-byte characters. This should be preferred when using 4-byte characters such as Japanese.", displayName = "Combine Unicode Surrogates"), @YamlProperty(name = "contentTypeHeader", type = "boolean", description = "Whether the data format should set the Content-Type header with the type from the data format. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSON", displayName = "Content Type Header"), @YamlProperty(name = "dateFormatPattern", type = "string", description = "To configure the date format while marshall or unmarshall Date fields in JSON using Gson", displayName = "Date Format Pattern"), @YamlProperty(name = "disableFeatures", type = "string", description = "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", displayName = "Disable Features"), @@ -8239,8 +8234,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "timezone", type = "string", description = "If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson and fastjson.", displayName = "Timezone"), @YamlProperty(name = "unmarshalType", type = "string", description = "Class name of the java type to use when unmarshalling", displayName = "Unmarshal Type"), @YamlProperty(name = "useDefaultObjectMapper", type = "boolean", description = "Whether to lookup and use default Jackson ObjectMapper from the registry.", displayName = "Use Default Object Mapper"), - @YamlProperty(name = "useList", type = "boolean", description = "To unmarshal to a List of Map or a List of Pojo.", displayName = "Use List"), - @YamlProperty(name = "useWriter", type = "boolean", description = "Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte/4-byte characters such as Japanese.", displayName = "Use Writer") + @YamlProperty(name = "useList", type = "boolean", description = "To unmarshal to a List of Map or a List of Pojo.", displayName = "Use List") } ) public static class JsonDataFormatDeserializer extends YamlDeserializerBase<JsonDataFormat> { @@ -8283,6 +8277,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setCollectionTypeName(val); break; } + case "combineUnicodeSurrogates": { + String val = asText(node); + target.setCombineUnicodeSurrogates(val); + break; + } case "contentTypeHeader": { String val = asText(node); target.setContentTypeHeader(val); @@ -8372,11 +8371,6 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setUseList(val); break; } - case "useWriter": { - String val = asText(node); - target.setUseWriter(val); - break; - } default: { return false; } diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json index c6158231929..648c27fed13 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json @@ -11079,11 +11079,6 @@ "title" : "Use List", "description" : "To unmarshal to a List of Map or a List of Pojo." }, - "useWriter" : { - "type" : "boolean", - "title" : "Use Writer", - "description" : "Force using generator that outputs XML content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte/4-byte characters such as Japanese." - }, "xmlMapper" : { "type" : "string", "title" : "Xml Mapper", @@ -11262,6 +11257,11 @@ "title" : "Collection Type", "description" : "Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows using different collection types than java.util.Collection based as default." }, + "combineUnicodeSurrogates" : { + "type" : "boolean", + "title" : "Combine Unicode Surrogates", + "description" : "Force generator that outputs JSON content to combine surrogate pairs (if any) into 4-byte characters. This should be preferred when using 4-byte characters such as Japanese." + }, "contentTypeHeader" : { "type" : "boolean", "title" : "Content Type Header", @@ -11353,11 +11353,6 @@ "type" : "boolean", "title" : "Use List", "description" : "To unmarshal to a List of Map or a List of Pojo." - }, - "useWriter" : { - "type" : "boolean", - "title" : "Use Writer", - "description" : "Force using generator that outputs JSON content using a java.io.Writer which handles character encoding. This should be preferred when using 2-byte/4-byte characters such as Japanese." } } },