You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/12/10 08:12:28 UTC
[1/3] camel git commit: Fixed bunch of CS errors for release
Repository: camel
Updated Branches:
refs/heads/camel-2.14.x f0bfd0e1b -> 4feec4fb5
refs/heads/master a42a65d90 -> 8f119e3fd
Fixed bunch of CS errors for release
Conflicts:
camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlSplitBodyRouteTest.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/443ebec9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/443ebec9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/443ebec9
Branch: refs/heads/master
Commit: 443ebec920e4571d0262a61b12dbf7a8671e6b66
Parents: a42a65d
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Dec 10 13:12:05 2014 +0800
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Dec 10 07:56:19 2014 +0100
----------------------------------------------------------------------
.../properties/DefaultPropertiesParser.java | 4 +--
.../util/DumpModelAsXmlSplitBodyRouteTest.java | 1 -
.../camel/component/crypto/SignatureTests.java | 9 ++++---
.../camel/converter/jaxb/JaxbDataFormat.java | 26 ++++++++++----------
.../restlet/DefaultRestletBinding.java | 6 ++---
.../component/stream/ScanStreamDelayTest.java | 2 +-
6 files changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/443ebec9/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java b/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java
index fdd2896..5b83983 100644
--- a/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java
+++ b/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java
@@ -221,8 +221,8 @@ public class DefaultPropertiesParser implements AugmentedPropertyNameAwareProper
log.debug("Property with key [{}] is applied by function [{}]", key, function.getName());
String value = function.apply(remainder);
if (value == null) {
- throw new IllegalArgumentException("Property with key [" + key + "] using function [" + function.getName() + "]" +
- " returned null value which is not allowed, from input: " + input);
+ throw new IllegalArgumentException("Property with key [" + key + "] using function [" + function.getName() + "]"
+ + " returned null value which is not allowed, from input: " + input);
} else {
if (log.isDebugEnabled()) {
log.debug("Property with key [{}] applied by function [{}] -> {}", new Object[]{key, function.getName(), value});
http://git-wip-us.apache.org/repos/asf/camel/blob/443ebec9/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlSplitBodyRouteTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlSplitBodyRouteTest.java b/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlSplitBodyRouteTest.java
index df10d67..bfe2a2d 100644
--- a/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlSplitBodyRouteTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlSplitBodyRouteTest.java
@@ -25,7 +25,6 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.converter.jaxp.XmlConverter;
import org.apache.camel.model.ModelHelper;
-
/**
*
*/
http://git-wip-us.apache.org/repos/asf/camel/blob/443ebec9/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java
----------------------------------------------------------------------
diff --git a/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java b/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java
index 4d8148f..72cf658 100644
--- a/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java
+++ b/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java
@@ -140,7 +140,8 @@ public class SignatureTests extends CamelTestSupport {
}, new RouteBuilder() {
public void configure() throws Exception {
// START SNIPPET: keystore
- from("direct:keystoreParameters").to("crypto:sign://keyStoreParameters?keyStoreParameters=#signatureParams&alias=bob&password=letmein", "crypto:verify://keyStoreParameters?keyStoreParameters=#signatureParams&alias=bob", "mock:result");
+ from("direct:keystoreParameters").to("crypto:sign://keyStoreParameters?keyStoreParameters=#signatureParams&alias=bob&password=letmein",
+ "crypto:verify://keyStoreParameters?keyStoreParameters=#signatureParams&alias=bob", "mock:result");
// END SNIPPET: keystore
}
}, new RouteBuilder() {
@@ -198,14 +199,14 @@ public class SignatureTests extends CamelTestSupport {
sendBody("direct:algorithm", payload);
assertMockEndpointsSatisfied();
}
-
+
@Test
public void testRSASHA1() throws Exception {
setupMock();
sendBody("direct:rsa-sha1", payload);
assertMockEndpointsSatisfied();
}
-
+
@Test
public void testRSASHA256() throws Exception {
setupMock();
@@ -258,7 +259,7 @@ public class SignatureTests extends CamelTestSupport {
sendBody("direct:keystoreParameters", payload);
assertMockEndpointsSatisfied();
}
-
+
@Test
public void testSignatureHeaderInRouteDefinition() throws Exception {
setupMock();
http://git-wip-us.apache.org/repos/asf/camel/blob/443ebec9/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
index 2993db5..68593eb 100644
--- a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
+++ b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
@@ -44,6 +44,7 @@ import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
+import org.xml.sax.SAXException;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
@@ -59,14 +60,13 @@ import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.ResourceHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.xml.sax.SAXException;
/**
* A <a href="http://camel.apache.org/data-format.html">data format</a> ({@link DataFormat})
* using JAXB2 to marshal to and from XML
*
- * @version
+ * @version
*/
public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelContextAware {
@@ -80,7 +80,7 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
private String contextPath;
private String schema;
private String schemaLocation;
-
+
private boolean prettyPrint = true;
private boolean ignoreJAXBElement = true;
private boolean mustBeJAXBElement = true;
@@ -113,10 +113,10 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
try {
// must create a new instance of marshaller as its not thread safe
Marshaller marshaller = createMarshaller();
-
+
if (isPrettyPrint()) {
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- }
+ }
// exchange take precedence over encoding option
String charset = exchange.getProperty(Exchange.CHARSET_NAME, String.class);
if (charset == null) {
@@ -143,7 +143,7 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
}
void marshal(Exchange exchange, Object graph, OutputStream stream, Marshaller marshaller)
- throws XMLStreamException, JAXBException, NoTypeConversionAvailableException, IOException, InvalidPayloadException {
+ throws XMLStreamException, JAXBException, NoTypeConversionAvailableException, IOException, InvalidPayloadException {
Object e = graph;
if (partialClass != null && getPartNamespace() != null) {
@@ -217,10 +217,10 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
// Properties
// -------------------------------------------------------------------------
- public boolean isIgnoreJAXBElement() {
+ public boolean isIgnoreJAXBElement() {
return ignoreJAXBElement;
}
-
+
public void setIgnoreJAXBElement(boolean flag) {
ignoreJAXBElement = flag;
}
@@ -275,11 +275,11 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
public void setPrettyPrint(boolean prettyPrint) {
this.prettyPrint = prettyPrint;
}
-
+
public boolean isFragment() {
return fragment;
}
-
+
public void setFragment(boolean fragment) {
this.fragment = fragment;
}
@@ -347,7 +347,7 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
public void setXmlStreamWriterWrapper(JaxbXmlStreamWriterWrapper xmlStreamWriterWrapper) {
this.xmlStreamWriterWrapper = xmlStreamWriterWrapper;
}
-
+
public String getSchemaLocation() {
return schemaLocation;
}
@@ -406,7 +406,7 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
return JAXBContext.newInstance();
}
}
-
+
protected Unmarshaller createUnmarshaller() throws JAXBException, SAXException, FileNotFoundException,
MalformedURLException {
Unmarshaller unmarshaller = getContext().createUnmarshaller();
@@ -439,7 +439,7 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
return marshaller;
}
-
+
private Schema createSchema(Source[] sources) throws SAXException {
SchemaFactory factory = getOrCreateSchemaFactory();
try {
http://git-wip-us.apache.org/repos/asf/camel/blob/443ebec9/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
index 947d01c..dbc949d 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
@@ -177,7 +177,7 @@ public class DefaultRestletBinding implements RestletBinding, HeaderFilterStrate
} else {
// put the user stuff in the form
if (value instanceof Collection) {
- for (Object v: (Collection<?>) value) {
+ for (Object v : (Collection<?>) value) {
form.add(key, v.toString());
}
} else {
@@ -336,8 +336,8 @@ public class DefaultRestletBinding implements RestletBinding, HeaderFilterStrate
if (mediaType != null && mediaType.equals(MediaType.APPLICATION_OCTET_STREAM)) {
exchange.getOut().setBody(response.getEntity().getStream());
} else if (response.getEntity() instanceof Representation) {
- Representation representationDecoded = new DecodeRepresentation(response.getEntity());
- exchange.getOut().setBody(representationDecoded.getText());
+ Representation representationDecoded = new DecodeRepresentation(response.getEntity());
+ exchange.getOut().setBody(representationDecoded.getText());
} else {
// get content text by default
String text = response.getEntity().getText();
http://git-wip-us.apache.org/repos/asf/camel/blob/443ebec9/components/camel-stream/src/test/java/org/apache/camel/component/stream/ScanStreamDelayTest.java
----------------------------------------------------------------------
diff --git a/components/camel-stream/src/test/java/org/apache/camel/component/stream/ScanStreamDelayTest.java b/components/camel-stream/src/test/java/org/apache/camel/component/stream/ScanStreamDelayTest.java
index 60ae0ab..b790e37 100644
--- a/components/camel-stream/src/test/java/org/apache/camel/component/stream/ScanStreamDelayTest.java
+++ b/components/camel-stream/src/test/java/org/apache/camel/component/stream/ScanStreamDelayTest.java
@@ -28,7 +28,7 @@ import org.junit.Before;
import org.junit.Test;
/**
- *
+ *
*/
public class ScanStreamDelayTest extends CamelTestSupport {
[3/3] camel git commit: CAMEL-8139: rest-dsl Allow to configure data
format properties for IN vs OUT
Posted by da...@apache.org.
CAMEL-8139: rest-dsl Allow to configure data format properties for IN vs OUT
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4feec4fb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4feec4fb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4feec4fb
Branch: refs/heads/camel-2.14.x
Commit: 4feec4fb59f15358cc03470024be8e22236b711f
Parents: f0bfd0e
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Dec 10 08:11:37 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Dec 10 08:11:58 2014 +0100
----------------------------------------------------------------------
.../camel/model/rest/RestBindingDefinition.java | 34 ++++++++++++++++----
...estletBindingInJaxbOutStringWithXmlTest.java | 2 +-
2 files changed, 29 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/4feec4fb/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
index eac4829..1691ee8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
@@ -124,7 +124,7 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit
IntrospectionSupport.setProperty(context.getTypeConverter(), json, "unmarshalType", clazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), json, "useList", type.endsWith("[]"));
}
- setAdditionalConfiguration(context, json);
+ setAdditionalConfiguration(context, json, "json.in.");
context.addService(json);
Class<?> outClazz = null;
@@ -136,7 +136,7 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit
IntrospectionSupport.setProperty(context.getTypeConverter(), outJson, "unmarshalType", outClazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), outJson, "useList", outType.endsWith("[]"));
}
- setAdditionalConfiguration(context, outJson);
+ setAdditionalConfiguration(context, outJson, "json.out.");
context.addService(outJson);
}
@@ -170,7 +170,7 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit
JAXBContext jc = JAXBContext.newInstance(clazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), jaxb, "context", jc);
}
- setAdditionalConfiguration(context, jaxb);
+ setAdditionalConfiguration(context, jaxb, "xml.in.");
context.addService(jaxb);
Class<?> outClazz = null;
@@ -186,23 +186,45 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit
JAXBContext jc = JAXBContext.newInstance(clazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), outJaxb, "context", jc);
}
- setAdditionalConfiguration(context, outJaxb);
+ setAdditionalConfiguration(context, outJaxb, "xml.out.");
context.addService(outJaxb);
}
return new RestBindingProcessor(json, jaxb, outJson, outJaxb, consumes, produces, mode, skip, cors, corsHeaders);
}
- private void setAdditionalConfiguration(CamelContext context, DataFormat dataFormat) throws Exception {
+ private void setAdditionalConfiguration(CamelContext context, DataFormat dataFormat, String prefix) throws Exception {
if (context.getRestConfiguration().getDataFormatProperties() != null && !context.getRestConfiguration().getDataFormatProperties().isEmpty()) {
// must use a copy as otherwise the options gets removed during introspection setProperties
Map<String, Object> copy = new HashMap<String, Object>();
- copy.putAll(context.getRestConfiguration().getDataFormatProperties());
+
+ // filter keys on prefix
+ // - either its a known prefix and must match the prefix parameter
+ // - or its a common configuration that we should always use
+ for (Map.Entry<String, Object> entry : context.getRestConfiguration().getDataFormatProperties().entrySet()) {
+ String key = entry.getKey();
+ String copyKey;
+ boolean known = isKeyKnownPrefix(key);
+ if (known) {
+ // remove the prefix from the key to use
+ copyKey = key.substring(prefix.length());
+ } else {
+ // use the key as is
+ copyKey = key;
+ }
+ if (!known || key.startsWith(prefix)) {
+ copy.put(copyKey, entry.getValue());
+ }
+ }
IntrospectionSupport.setProperties(context.getTypeConverter(), dataFormat, copy);
}
}
+ private boolean isKeyKnownPrefix(String key) {
+ return key.startsWith("json.in.") || key.startsWith("json.out.") || key.startsWith("xml.in.") || key.startsWith("xml.out.");
+ }
+
public String getConsumes() {
return consumes;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/4feec4fb/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
index 10f1c7f..415e01c 100644
--- a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
+++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
@@ -52,7 +52,7 @@ public class RestRestletBindingInJaxbOutStringWithXmlTest extends RestletTestSup
public void configure() throws Exception {
restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto)
// turn off must be JAXB as we create the output type ourselves as xml in a String type
- .dataFormatProperty("mustBeJAXBElement", "false");
+ .dataFormatProperty("xml.out.mustBeJAXBElement", "false");
// use the rest DSL to define the rest services
rest("/users/")
[2/3] camel git commit: CAMEL-8139: rest-dsl Allow to configure data
format properties for IN vs OUT
Posted by da...@apache.org.
CAMEL-8139: rest-dsl Allow to configure data format properties for IN vs OUT
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8f119e3f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8f119e3f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8f119e3f
Branch: refs/heads/master
Commit: 8f119e3fdfd37d001c62542eaee85f165ec604b4
Parents: 443ebec
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Dec 10 08:11:37 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Dec 10 08:11:37 2014 +0100
----------------------------------------------------------------------
.../camel/model/rest/RestBindingDefinition.java | 34 ++++++++++++++++----
...estletBindingInJaxbOutStringWithXmlTest.java | 2 +-
2 files changed, 29 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/8f119e3f/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
index eac4829..1691ee8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
@@ -124,7 +124,7 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit
IntrospectionSupport.setProperty(context.getTypeConverter(), json, "unmarshalType", clazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), json, "useList", type.endsWith("[]"));
}
- setAdditionalConfiguration(context, json);
+ setAdditionalConfiguration(context, json, "json.in.");
context.addService(json);
Class<?> outClazz = null;
@@ -136,7 +136,7 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit
IntrospectionSupport.setProperty(context.getTypeConverter(), outJson, "unmarshalType", outClazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), outJson, "useList", outType.endsWith("[]"));
}
- setAdditionalConfiguration(context, outJson);
+ setAdditionalConfiguration(context, outJson, "json.out.");
context.addService(outJson);
}
@@ -170,7 +170,7 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit
JAXBContext jc = JAXBContext.newInstance(clazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), jaxb, "context", jc);
}
- setAdditionalConfiguration(context, jaxb);
+ setAdditionalConfiguration(context, jaxb, "xml.in.");
context.addService(jaxb);
Class<?> outClazz = null;
@@ -186,23 +186,45 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit
JAXBContext jc = JAXBContext.newInstance(clazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), outJaxb, "context", jc);
}
- setAdditionalConfiguration(context, outJaxb);
+ setAdditionalConfiguration(context, outJaxb, "xml.out.");
context.addService(outJaxb);
}
return new RestBindingProcessor(json, jaxb, outJson, outJaxb, consumes, produces, mode, skip, cors, corsHeaders);
}
- private void setAdditionalConfiguration(CamelContext context, DataFormat dataFormat) throws Exception {
+ private void setAdditionalConfiguration(CamelContext context, DataFormat dataFormat, String prefix) throws Exception {
if (context.getRestConfiguration().getDataFormatProperties() != null && !context.getRestConfiguration().getDataFormatProperties().isEmpty()) {
// must use a copy as otherwise the options gets removed during introspection setProperties
Map<String, Object> copy = new HashMap<String, Object>();
- copy.putAll(context.getRestConfiguration().getDataFormatProperties());
+
+ // filter keys on prefix
+ // - either its a known prefix and must match the prefix parameter
+ // - or its a common configuration that we should always use
+ for (Map.Entry<String, Object> entry : context.getRestConfiguration().getDataFormatProperties().entrySet()) {
+ String key = entry.getKey();
+ String copyKey;
+ boolean known = isKeyKnownPrefix(key);
+ if (known) {
+ // remove the prefix from the key to use
+ copyKey = key.substring(prefix.length());
+ } else {
+ // use the key as is
+ copyKey = key;
+ }
+ if (!known || key.startsWith(prefix)) {
+ copy.put(copyKey, entry.getValue());
+ }
+ }
IntrospectionSupport.setProperties(context.getTypeConverter(), dataFormat, copy);
}
}
+ private boolean isKeyKnownPrefix(String key) {
+ return key.startsWith("json.in.") || key.startsWith("json.out.") || key.startsWith("xml.in.") || key.startsWith("xml.out.");
+ }
+
public String getConsumes() {
return consumes;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/8f119e3f/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
index 10f1c7f..415e01c 100644
--- a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
+++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
@@ -52,7 +52,7 @@ public class RestRestletBindingInJaxbOutStringWithXmlTest extends RestletTestSup
public void configure() throws Exception {
restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto)
// turn off must be JAXB as we create the output type ourselves as xml in a String type
- .dataFormatProperty("mustBeJAXBElement", "false");
+ .dataFormatProperty("xml.out.mustBeJAXBElement", "false");
// use the rest DSL to define the rest services
rest("/users/")