camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bibr...@apache.org
Subject camel git commit: Extend FOP component with headers to set rendererOptions in FOUserAgent
Date Mon, 04 Apr 2016 21:40:56 GMT
Repository: camel
Updated Branches:
  refs/heads/master aac97e1c0 -> 6dc4800cf


Extend FOP component with headers to set rendererOptions in FOUserAgent


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6dc4800c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6dc4800c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6dc4800c

Branch: refs/heads/master
Commit: 6dc4800cfca530c051346357ca035d82b1bddaf1
Parents: aac97e1
Author: bibryam <bibryam@apache.org>
Authored: Mon Apr 4 22:40:46 2016 +0100
Committer: bibryam <bibryam@apache.org>
Committed: Mon Apr 4 22:40:46 2016 +0100

----------------------------------------------------------------------
 .../org/apache/camel/component/fop/FopConstants.java     |  1 +
 .../java/org/apache/camel/component/fop/FopProducer.java | 11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6dc4800c/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConstants.java
b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConstants.java
index 8c699da..e4ab6f2 100644
--- a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConstants.java
+++ b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConstants.java
@@ -19,5 +19,6 @@ package org.apache.camel.component.fop;
 public interface FopConstants {
     String CAMEL_FOP_RENDER = "CamelFop.Render.";
     String CAMEL_FOP_ENCRYPT = "CamelFop.Encrypt.";
+    String CAMEL_FOP_RENDERER_OPTIONS = "CamelFop.RendererOptions.";
     String CAMEL_FOP_OUTPUT_FORMAT = "CamelFop.Output.Format";
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/6dc4800c/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopProducer.java
b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopProducer.java
index a6da1aa..dd77570 100644
--- a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopProducer.java
+++ b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopProducer.java
@@ -54,6 +54,7 @@ public class FopProducer extends DefaultProducer {
         Map<String, Object> headers = exchange.getIn().getHeaders();
         setRenderParameters(userAgent, headers);
         setEncryptionParameters(userAgent, headers);
+        setUserAgentRendererOptions(userAgent, headers);
 
         String outputFormat = getOutputFormat(exchange);
         Source src = exchange.getIn().getBody(StreamSource.class);
@@ -104,9 +105,15 @@ public class FopProducer extends DefaultProducer {
         }
     }
 
+    private void setUserAgentRendererOptions(FOUserAgent userAgent, Map<String, Object>
headers) {
+        Map<String, Object> parameters = IntrospectionSupport.extractProperties(headers,
FopConstants.CAMEL_FOP_RENDERER_OPTIONS);
+        if (!parameters.isEmpty()) {
+            userAgent.getRendererOptions().putAll(parameters);
+        }
+    }
+
     private void setRenderParameters(FOUserAgent userAgent, Map<String, Object> headers)
throws Exception {
-        Map<String, Object> parameters = IntrospectionSupport
-                .extractProperties(headers, FopConstants.CAMEL_FOP_RENDER);
+        Map<String, Object> parameters = IntrospectionSupport.extractProperties(headers,
FopConstants.CAMEL_FOP_RENDER);
         if (!parameters.isEmpty()) {
             IntrospectionSupport.setProperties(userAgent, parameters);
         }


Mime
View raw message