camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-9601: camel-restlet - Should support the Accept header
Date Sun, 14 Feb 2016 12:01:28 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 313086d25 -> eaf374ab7
  refs/heads/master 1f09884c6 -> 5e61eba52


CAMEL-9601: camel-restlet - Should support the Accept header


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

Branch: refs/heads/master
Commit: 5e61eba520bbf93441efe8111096da7f7fb43792
Parents: 1f09884
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Feb 14 13:00:55 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Feb 14 13:00:55 2016 +0100

----------------------------------------------------------------------
 .../camel/component/restlet/DefaultRestletBinding.java      | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5e61eba5/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 1f6738e..69821b2 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
@@ -212,11 +212,18 @@ public class DefaultRestletBinding implements RestletBinding, HeaderFilterStrate
             }
         }
 
+        // accept
+        String accept = exchange.getIn().getHeader("Accept", String.class);
+        if (accept != null) {
+            MediaType acceptedMediaType = exchange.getContext().getTypeConverter().tryConvertTo(MediaType.class,
exchange, accept);
+            if (acceptedMediaType != null) {
+                request.getClientInfo().getAcceptedMediaTypes().add(new Preference<MediaType>(acceptedMediaType));
+            }
+        }
         MediaType acceptedMediaType = exchange.getIn().getHeader(Exchange.ACCEPT_CONTENT_TYPE,
MediaType.class);
         if (acceptedMediaType != null) {
             request.getClientInfo().getAcceptedMediaTypes().add(new Preference<MediaType>(acceptedMediaType));
         }
-
     }
 
     public void populateRestletResponseFromExchange(Exchange exchange, Response response)
throws Exception {


Mime
View raw message