camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: [CAMEL-11425] camel-olingo2 - Add ability to send/receive endpoint HTTP headers.
Date Wed, 19 Jul 2017 16:16:24 GMT
Repository: camel
Updated Branches:
  refs/heads/master 5aa5ef9ba -> a02395e00


[CAMEL-11425] camel-olingo2 - Add ability to send/receive endpoint HTTP headers.


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

Branch: refs/heads/master
Commit: a02395e00fe151154d435dd9fe5cffadc008ec5f
Parents: 5aa5ef9
Author: Sean Haynes <s.a.haynes@ieee.org>
Authored: Wed Jul 19 10:50:36 2017 -0400
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jul 19 18:15:35 2017 +0200

----------------------------------------------------------------------
 .../camel/component/olingo2/api/Olingo2App.java |  28 +++-
 .../olingo2/api/Olingo2ResponseHandler.java     |   5 +-
 .../olingo2/api/impl/Olingo2AppImpl.java        | 132 ++++++++++++++-----
 .../camel-olingo2-component/pom.xml             |   3 +-
 .../src/main/docs/olingo2-component.adoc        |  40 ++++--
 .../component/olingo2/Olingo2AppWrapper.java    |   5 +-
 .../component/olingo2/Olingo2Consumer.java      |   2 +-
 .../component/olingo2/Olingo2Endpoint.java      |   2 +
 .../component/olingo2/Olingo2Producer.java      |   8 +-
 .../src/signatures/olingo-api-signature.txt     |  16 +--
 .../component/olingo2/Olingo2AppAPITest.java    |  60 ++++-----
 11 files changed, 207 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a02395e0/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2App.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2App.java b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2App.java
index 4bddbf6..121cf3b 100644
--- a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2App.java
+++ b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2App.java
@@ -76,9 +76,11 @@ public interface Olingo2App {
      * @param resourcePath OData Resource path
      * @param queryParams OData query params
      *                    from http://www.odata.org/documentation/odata-version-2-0/uri-conventions#SystemQueryOptions
+     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
      * @param responseHandler callback handler
      */
     <T> void read(Edm edm, String resourcePath, Map<String, String> queryParams,
+                  Map<String, String> endpointHttpHeaders,
                   Olingo2ResponseHandler<T> responseHandler);
 
     /**
@@ -87,60 +89,74 @@ public interface Olingo2App {
      * @param resourcePath OData Resource path
      * @param queryParams OData query params
      *                    from http://www.odata.org/documentation/odata-version-2-0/uri-conventions#SystemQueryOptions
+     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
      * @param responseHandler callback handler
      */
     void uread(Edm edm, String resourcePath, Map<String, String> queryParams,
+               Map<String, String> endpointHttpHeaders,
                Olingo2ResponseHandler<InputStream> responseHandler);
 
     /**
      * Deletes an OData resource and invokes callback
      * with {@link org.apache.olingo.odata2.api.commons.HttpStatusCodes} on success, or with exception on failure.
      * @param resourcePath resource path for Entry
+     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
      * @param responseHandler {@link org.apache.olingo.odata2.api.commons.HttpStatusCodes} callback handler
      */
-    void delete(String resourcePath, Olingo2ResponseHandler<HttpStatusCodes> responseHandler);
+    void delete(String resourcePath, Map<String, String> endpointHttpHeaders, 
+                Olingo2ResponseHandler<HttpStatusCodes> responseHandler);
 
     /**
      * Creates a new OData resource.
      * @param edm service Edm
      * @param resourcePath resource path to create
+     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
      * @param data request data
      * @param responseHandler callback handler
      */
-    <T> void create(Edm edm, String resourcePath, Object data, Olingo2ResponseHandler<T> responseHandler);
+    <T> void create(Edm edm, String resourcePath, Map<String, String> endpointHttpHeaders, Object data, 
+                    Olingo2ResponseHandler<T> responseHandler);
 
     /**
      * Updates an OData resource.
      * @param edm service Edm
      * @param resourcePath resource path to update
+     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
      * @param data updated data
      * @param responseHandler {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry} callback handler
      */
-    <T> void update(Edm edm, String resourcePath, Object data, Olingo2ResponseHandler<T> responseHandler);
+    <T> void update(Edm edm, String resourcePath, Map<String, String> endpointHttpHeaders, Object data, 
+                    Olingo2ResponseHandler<T> responseHandler);
 
     /**
      * Patches/merges an OData resource using HTTP PATCH.
      * @param edm service Edm
      * @param resourcePath resource path to update
+     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
      * @param data patch/merge data
      * @param responseHandler {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry} callback handler
      */
-    <T> void patch(Edm edm, String resourcePath, Object data, Olingo2ResponseHandler<T> responseHandler);
+    <T> void patch(Edm edm, String resourcePath, Map<String, String> endpointHttpHeaders, Object data, 
+                   Olingo2ResponseHandler<T> responseHandler);
 
     /**
      * Patches/merges an OData resource using HTTP MERGE.
      * @param edm service Edm
      * @param resourcePath resource path to update
+     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
      * @param data patch/merge data
      * @param responseHandler {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry} callback handler
      */
-    <T> void merge(Edm edm, String resourcePath, Object data, Olingo2ResponseHandler<T> responseHandler);
+    <T> void merge(Edm edm, String resourcePath, Map<String, String> endpointHttpHeaders, Object data, 
+                   Olingo2ResponseHandler<T> responseHandler);
 
     /**
      * Executes a batch request.
      * @param edm service Edm
+     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
      * @param data ordered {@link org.apache.camel.component.olingo2.api.batch.Olingo2BatchRequest} list
      * @param responseHandler callback handler
      */
-    void batch(Edm edm, Object data, Olingo2ResponseHandler<List<Olingo2BatchResponse>> responseHandler);
+    void batch(Edm edm, Map<String, String> endpointHttpHeaders, Object data, 
+               Olingo2ResponseHandler<List<Olingo2BatchResponse>> responseHandler);
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a02395e0/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2ResponseHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2ResponseHandler.java b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2ResponseHandler.java
index e96e345..f895328 100644
--- a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2ResponseHandler.java
+++ b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2ResponseHandler.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.olingo2.api;
 
+import java.util.Map;
+
 /**
  * Callback interface to asynchronously process Olingo2 response.
  */
@@ -24,8 +26,9 @@ public interface Olingo2ResponseHandler<T> {
     /**
      * Handle response data on successful completion of Olingo2 request.
      * @param response response data from Olingo2, may be NULL for Olingo2 operations with no response data.
+     * @param responseHeaders the response HTTP headers received from the endpoint.
      */
-    void onResponse(T response);
+    void onResponse(T response, Map<String, String> responseHeaders);
 
     /**
      * Handle exception raised from Olingo2 request.

http://git-wip-us.apache.org/repos/asf/camel/blob/a02395e0/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
index 6ec94fc..f4423b7 100644
--- a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
+++ b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
@@ -24,6 +24,7 @@ import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.charset.Charset;
+import java.nio.charset.UnsupportedCharsetException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -46,6 +47,7 @@ import org.apache.http.Header;
 import org.apache.http.HttpHeaders;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
+import org.apache.http.ParseException;
 import org.apache.http.StatusLine;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpDelete;
@@ -214,16 +216,19 @@ public final class Olingo2AppImpl implements Olingo2App {
 
     @Override
     public <T> void read(final Edm edm, final String resourcePath, final Map<String, String> queryParams,
+                         final Map<String, String> endpointHttpHeaders, 
                          final Olingo2ResponseHandler<T> responseHandler) {
 
         final UriInfoWithType uriInfo = parseUri(edm, resourcePath, queryParams);
 
         execute(new HttpGet(createUri(resourcePath, queryParams)), getResourceContentType(uriInfo),
-            new AbstractFutureCallback<T>(responseHandler) {
+            endpointHttpHeaders, new AbstractFutureCallback<T>(responseHandler) {
 
                 @Override
                 public void onCompleted(HttpResponse result) throws IOException {
-                    readContent(uriInfo, result.getEntity() != null ? result.getEntity().getContent() : null,
+                    readContent(uriInfo, 
+                        headersToMap(result.getAllHeaders()),
+                        result.getEntity() != null ? result.getEntity().getContent() : null,
                         responseHandler);
                 }
 
@@ -232,16 +237,19 @@ public final class Olingo2AppImpl implements Olingo2App {
 
     @Override
     public void uread(final Edm edm, final String resourcePath, final Map<String, String> queryParams,
+                      final Map<String, String> endpointHttpHeaders, 
                       final Olingo2ResponseHandler<InputStream> responseHandler) {
 
         final UriInfoWithType uriInfo = parseUri(edm, resourcePath, queryParams);
 
         execute(new HttpGet(createUri(resourcePath, queryParams)), getResourceContentType(uriInfo),
-            new AbstractFutureCallback<InputStream>(responseHandler) {
+            endpointHttpHeaders, new AbstractFutureCallback<InputStream>(responseHandler) {
 
                 @Override
                 public void onCompleted(HttpResponse result) throws IOException {
-                    responseHandler.onResponse(result.getEntity() != null ? result.getEntity().getContent() : null);
+                    responseHandler.onResponse(
+                        (result.getEntity() != null) ? result.getEntity().getContent() : null,
+                        headersToMap(result.getAllHeaders()));
                 }
 
             });
@@ -282,56 +290,78 @@ public final class Olingo2AppImpl implements Olingo2App {
     }
 
     @Override
-    public <T> void create(Edm edm, String resourcePath, Object data, Olingo2ResponseHandler<T> responseHandler) {
+    public <T> void create(final Edm edm, 
+                           final String resourcePath, 
+                           final Map<String, String> endpointHttpHeaders, 
+                           final Object data, 
+                           final Olingo2ResponseHandler<T> responseHandler) {
         final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null);
 
-        writeContent(edm, new HttpPost(createUri(resourcePath, null)), uriInfo, data, responseHandler);
+        writeContent(edm, new HttpPost(createUri(resourcePath, null)), uriInfo, endpointHttpHeaders, data, responseHandler);
     }
 
     @Override
-    public <T> void update(Edm edm, String resourcePath, Object data, Olingo2ResponseHandler<T> responseHandler) {
+    public <T> void update(final Edm edm, 
+                           final String resourcePath, 
+                           final Map<String, String> endpointHttpHeaders, 
+                           final Object data, 
+                           final Olingo2ResponseHandler<T> responseHandler) {
         final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null);
 
-        writeContent(edm, new HttpPut(createUri(resourcePath, null)), uriInfo, data, responseHandler);
+        writeContent(edm, new HttpPut(createUri(resourcePath, null)), uriInfo, endpointHttpHeaders, data, responseHandler);
     }
 
     @Override
-    public <T> void patch(Edm edm, String resourcePath, Object data, Olingo2ResponseHandler<T> responseHandler) {
+    public <T> void patch(final Edm edm, 
+                          final String resourcePath, 
+                          final Map<String, String> endpointHttpHeaders, 
+                          final Object data, 
+                          final Olingo2ResponseHandler<T> responseHandler) {
         final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null);
 
-        writeContent(edm, new HttpPatch(createUri(resourcePath, null)), uriInfo, data, responseHandler);
+        writeContent(edm, new HttpPatch(createUri(resourcePath, null)), uriInfo, endpointHttpHeaders, data, responseHandler);
     }
 
     @Override
-    public <T> void merge(Edm edm, String resourcePath, Object data, Olingo2ResponseHandler<T> responseHandler) {
+    public <T> void merge(final Edm edm, 
+                          final String resourcePath, 
+                          final Map<String, String> endpointHttpHeaders, 
+                          final Object data, 
+                          final Olingo2ResponseHandler<T> responseHandler) {
         final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null);
 
-        writeContent(edm, new HttpMerge(createUri(resourcePath, null)), uriInfo, data, responseHandler);
+        writeContent(edm, new HttpMerge(createUri(resourcePath, null)), uriInfo, endpointHttpHeaders, data, responseHandler);
     }
 
     @Override
-    public void batch(Edm edm, Object data, Olingo2ResponseHandler<List<Olingo2BatchResponse>> responseHandler) {
+    public void batch(final Edm edm, 
+                      final Map<String, String> endpointHttpHeaders, 
+                      final Object data, 
+                      final Olingo2ResponseHandler<List<Olingo2BatchResponse>> responseHandler) {
         final UriInfoWithType uriInfo = parseUri(edm, BATCH, null);
 
-        writeContent(edm, new HttpPost(createUri(BATCH, null)), uriInfo, data, responseHandler);
+        writeContent(edm, new HttpPost(createUri(BATCH, null)), uriInfo, endpointHttpHeaders, data, responseHandler);
     }
 
     @Override
-    public void delete(String resourcePath, final Olingo2ResponseHandler<HttpStatusCodes> responseHandler) {
+    public void delete(final String resourcePath, 
+                       final Map<String, String> endpointHttpHeaders, 
+                       final Olingo2ResponseHandler<HttpStatusCodes> responseHandler) {
 
         execute(new HttpDelete(createUri(resourcePath)), contentType,
-            new AbstractFutureCallback<HttpStatusCodes>(responseHandler) {
+            endpointHttpHeaders, new AbstractFutureCallback<HttpStatusCodes>(responseHandler) {
                 @Override
                 public void onCompleted(HttpResponse result) {
                     final StatusLine statusLine = result.getStatusLine();
-                    responseHandler.onResponse(HttpStatusCodes.fromStatusCode(statusLine.getStatusCode()));
+                    responseHandler.onResponse(HttpStatusCodes.fromStatusCode(statusLine.getStatusCode()),
+                        headersToMap(result.getAllHeaders()));
                 }
             });
     }
 
-    private <T> void readContent(UriInfoWithType uriInfo, InputStream content, Olingo2ResponseHandler<T> responseHandler) {
+    private <T> void readContent(UriInfoWithType uriInfo, Map<String, String> responseHeaders, InputStream content, Olingo2ResponseHandler<T> responseHandler) {
         try {
-            responseHandler.onResponse(this.<T>readContent(uriInfo, content));
+            responseHandler.onResponse(this.<T>readContent(uriInfo, content), responseHeaders);
         } catch (Exception e) {
             responseHandler.onException(e);
         } catch (Error e) {
@@ -439,8 +469,10 @@ public final class Olingo2AppImpl implements Olingo2App {
         return response;
     }
 
-    private <T> void writeContent(final Edm edm, HttpEntityEnclosingRequestBase httpEntityRequest,
-                                  final UriInfoWithType uriInfo, final Object content,
+    private <T> void writeContent(final Edm edm, final HttpEntityEnclosingRequestBase httpEntityRequest,
+                                  final UriInfoWithType uriInfo, 
+                                  final Map<String, String> endpointHttpHeaders,
+                                  final Object content,
                                   final Olingo2ResponseHandler<T> responseHandler) {
 
         try {
@@ -467,7 +499,7 @@ public final class Olingo2AppImpl implements Olingo2App {
             final Header requestContentTypeHeader = httpEntityRequest.getFirstHeader(HttpHeaders.CONTENT_TYPE);
             final ContentType requestContentType = requestContentTypeHeader != null
                 ? ContentType.parse(requestContentTypeHeader.getValue()) : contentType;
-            execute(httpEntityRequest, requestContentType, new AbstractFutureCallback<T>(responseHandler) {
+            execute(httpEntityRequest, requestContentType, endpointHttpHeaders, new AbstractFutureCallback<T>(responseHandler) {
                 @SuppressWarnings("unchecked")
                 @Override
                 public void onCompleted(HttpResponse result)
@@ -480,7 +512,8 @@ public final class Olingo2AppImpl implements Olingo2App {
                     final boolean noEntity = result.getEntity() == null || result.getEntity().getContentLength() == 0;
                     if (statusCode == HttpStatusCodes.NO_CONTENT || noEntity) {
                         responseHandler.onResponse(
-                            (T) HttpStatusCodes.fromStatusCode(result.getStatusLine().getStatusCode()));
+                            (T) HttpStatusCodes.fromStatusCode(result.getStatusLine().getStatusCode()),
+                            headersToMap(result.getAllHeaders()));
                     } else {
 
                         switch (uriInfo.getUriType()) {
@@ -519,7 +552,7 @@ public final class Olingo2AppImpl implements Olingo2App {
                                             Locale.ENGLISH, e)));
                                 }
                             }
-                            responseHandler.onResponse((T) responses);
+                            responseHandler.onResponse((T) responses, headersToMap(result.getAllHeaders()));
                             break;
 
                         case URI4:
@@ -531,12 +564,14 @@ public final class Olingo2AppImpl implements Olingo2App {
                             if (uriInfo.isValue()) {
                                 responseHandler.onResponse(
                                     (T) EntityProvider.readPropertyValue(simpleProperty,
-                                        result.getEntity().getContent()));
+                                        result.getEntity().getContent()),
+                                    headersToMap(result.getAllHeaders()));
                             } else {
                                 responseHandler.onResponse(
                                     (T) EntityProvider.readProperty(getContentType(), simpleProperty,
                                         result.getEntity().getContent(),
-                                        EntityProviderReadProperties.init().build()));
+                                        EntityProviderReadProperties.init().build()),
+                                    headersToMap(result.getAllHeaders()));
                             }
                             break;
 
@@ -550,7 +585,8 @@ public final class Olingo2AppImpl implements Olingo2App {
                                     .getEntity()
                                     .getContent(),
                                 EntityProviderReadProperties
-                                    .init().build()));
+                                    .init().build()),
+                                headersToMap(result.getAllHeaders()));
                             break;
 
                         case URI7A:
@@ -560,7 +596,8 @@ public final class Olingo2AppImpl implements Olingo2App {
                             responseHandler.onResponse((T) EntityProvider.readLink(getContentType(),
                                 targetLinkEntitySet, result
                                     .getEntity()
-                                    .getContent()));
+                                    .getContent()),
+                                headersToMap(result.getAllHeaders()));
                             break;
 
                         case URI7B:
@@ -570,7 +607,8 @@ public final class Olingo2AppImpl implements Olingo2App {
                             responseHandler.onResponse((T) EntityProvider.readLinks(getContentType(),
                                 targetLinksEntitySet,
                                 result.getEntity()
-                                    .getContent()));
+                                    .getContent()),
+                                headersToMap(result.getAllHeaders()));
                             break;
 
                         case URI1:
@@ -582,7 +620,8 @@ public final class Olingo2AppImpl implements Olingo2App {
                             responseHandler.onResponse((T) EntityProvider.readEntry(response.getContentHeader(),
                                 uriInfo.getTargetEntitySet(),
                                 result.getEntity().getContent(),
-                                EntityProviderReadProperties.init().build()));
+                                EntityProviderReadProperties.init().build()),
+                                headersToMap(result.getAllHeaders()));
                             break;
 
                         default:
@@ -873,9 +912,14 @@ public final class Olingo2AppImpl implements Olingo2App {
         ByteArrayInputStream content = null;
         try {
             if (response.getBody() != null) {
-                final ContentType partContentType = receiveWithCharsetParameter(ContentType.parse(
-                    headers.get(HttpHeaders.CONTENT_TYPE)), Consts.UTF_8);
-                final String charset = partContentType.getCharset().toString();
+                String charset = Consts.UTF_8.toString();
+                try {
+                    final ContentType partContentType = receiveWithCharsetParameter(ContentType.parse(
+                        headers.get(HttpHeaders.CONTENT_TYPE)), Consts.UTF_8);
+                    charset = partContentType.getCharset().toString();
+                } catch (ParseException | UnsupportedCharsetException ex) {
+                    // Use default charset of UTF-8.
+                }
 
                 final String body = response.getBody();
                 content = body != null ? new ByteArrayInputStream(body.getBytes(charset)) : null;
@@ -1015,12 +1059,21 @@ public final class Olingo2AppImpl implements Olingo2App {
 
         return result;
     }
-
+    
+    private static Map<String, String> headersToMap(final Header[] headers) {
+        final Map<String, String> responseHeaders = new HashMap<>();
+        for (Header header : headers) {
+            responseHeaders.put(header.getName(), header.getValue());
+        }
+        return responseHeaders;
+    }
+    
     /**
      * public for unit test, not to be used otherwise
      */
-    public void execute(HttpUriRequest httpUriRequest, ContentType contentType,
-                        FutureCallback<HttpResponse> callback) {
+    public void execute(final HttpUriRequest httpUriRequest, final ContentType contentType, 
+                        final Map<String, String> endpointHttpHeaders,
+                        final FutureCallback<HttpResponse> callback) {
 
         // add accept header when its not a form or multipart
         if (!ContentType.APPLICATION_FORM_URLENCODED.getMimeType().equals(contentType.getMimeType())
@@ -1044,6 +1097,13 @@ public final class Olingo2AppImpl implements Olingo2App {
                 httpUriRequest.setHeader(entry.getKey(), entry.getValue());
             }
         }
+        
+        // set user specified endpoint headers
+        if ((endpointHttpHeaders != null) && !endpointHttpHeaders.isEmpty()) {
+            for (Map.Entry<String, String> entry : endpointHttpHeaders.entrySet()) {
+                httpUriRequest.setHeader(entry.getKey(), entry.getValue());
+            }
+        }
 
         // add client protocol version if not specified
         if (!httpUriRequest.containsHeader(ODataHttpHeaders.DATASERVICEVERSION)) {

http://git-wip-us.apache.org/repos/asf/camel/blob/a02395e0/components/camel-olingo2/camel-olingo2-component/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/pom.xml b/components/camel-olingo2/camel-olingo2-component/pom.xml
index dccfb03..fcaeba8 100644
--- a/components/camel-olingo2/camel-olingo2-component/pom.xml
+++ b/components/camel-olingo2/camel-olingo2-component/pom.xml
@@ -40,7 +40,7 @@
 
     <camel.osgi.export.pkg>${componentPackage}</camel.osgi.export.pkg>
     <camel.osgi.private.pkg>${outPackage}</camel.osgi.private.pkg>
-    <maven.exe.file.extension></maven.exe.file.extension>
+    <maven.exe.file.extension />
   </properties>
 
   <dependencies>
@@ -179,6 +179,7 @@
                   </extraOptions>
                   <nullableOptions>
                     <nullableOption>queryParams</nullableOption>
+                    <nullableOption>endpointHttpHeaders</nullableOption>
                   </nullableOptions>
                 </api>
               </apis>

http://git-wip-us.apache.org/repos/asf/camel/blob/a02395e0/components/camel-olingo2/camel-olingo2-component/src/main/docs/olingo2-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/docs/olingo2-component.adoc b/components/camel-olingo2/camel-olingo2-component/src/main/docs/olingo2-component.adoc
index ae4723b..a4001fb 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/docs/olingo2-component.adoc
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/docs/olingo2-component.adoc
@@ -108,13 +108,28 @@ in turn should contain the name of the endpoint option whose value will
 be contained in the Camel Exchange In message. The *inBody* option
 defaults to *data* for endpoints that take that option. 
 
+### Endpoint Options
+
 Any of the endpoint options can be provided in either the endpoint URI,
 or dynamically in a message header. The message header name must be of
 the format *`CamelOlingo2.<option>`*. Note that the *`inBody`* option
 overrides message header, i.e. the endpoint
 option *`inBody=option`* would override
 a *`CamelOlingo2.option`* header. In addition, query parameters can be
-specified 
+specified. 
+
+[width="100%",cols="10%,20%,70%",options="header",]
+|=======================================================================
+|Name |Type |Description
+|data |Object |Data with appropriate type used to create or modify the OData resource
+|keyPredicate |String |Key predicate to create a parameterized OData resource endpoint. Useful for 
+create/update operations where the key predicate value is dynamically provided in a header
+|queryParams |java.util.Map<String,String> |OData system options and custom query options. For more 
+information see http://www.odata.org/documentation/odata-version-2-0/uri-conventions/[OData 2.0 URI Conventions]
+|resourcePath |String |OData resource path, may or may not contain key predicate
+|endpointHttpHeaders |java.util.Map<String, String> |Dynamic HTTP Headers to be sent to the endpoint
+|responseHttpHeaders |java.util.Map<String, String> |Dynamic HTTP Response Headers from the endpoint 
+|=======================================================================
 
 Note that the resourcePath option can either in specified in the URI as
 a part of the URI path, as an endpoint option
@@ -128,22 +143,31 @@ _Manufacturers_ and keyPredicate option _'1'_. 
 |=======================================================================
 |Endpoint |Options |HTTP Method |Result Body Type
 
-|batch |data |POST with multipart/mixed batch request |java.util.List<org.apache.camel.component.olingo2.api.batch.Olingo2BatchResponse>
+|batch |data, endpointHttpHeaders |POST with multipart/mixed batch request |java.util.List<org.apache.camel.component.olingo2.api.batch.Olingo2BatchResponse>
 
-|create |data, resourcePath |POST |org.apache.olingo.odata2.api.ep.entry.ODataEntry for new entries
+|create |data, resourcePath, endpointHttpHeaders |POST |org.apache.olingo.odata2.api.ep.entry.ODataEntry for new entries
 org.apache.olingo.odata2.api.commons.HttpStatusCodes for other OData resources
 
-|delete |resourcePath |DELETE |org.apache.olingo.odata2.api.commons.HttpStatusCodes
+|delete |resourcePath, endpointHttpHeaders |DELETE |org.apache.olingo.odata2.api.commons.HttpStatusCodes
 
-|merge |data, resourcePath |MERGE |org.apache.olingo.odata2.api.commons.HttpStatusCodes
+|merge |data, resourcePath, endpointHttpHeaders |MERGE |org.apache.olingo.odata2.api.commons.HttpStatusCodes
 
-|patch |data, resourcePath |PATCH |org.apache.olingo.odata2.api.commons.HttpStatusCodes
+|patch |data, resourcePath, endpointHttpHeaders |PATCH |org.apache.olingo.odata2.api.commons.HttpStatusCodes
 
-|read |queryParams, resourcePath |GET |Depends on OData resource being queried as described next
+|read |queryParams, resourcePath, endpointHttpHeaders |GET |Depends on OData resource being queried as described next
 
-|update |data, resourcePath |PUT |org.apache.olingo.odata2.api.commons.HttpStatusCodes
+|update |data, resourcePath, endpointHttpHeaders |PUT |org.apache.olingo.odata2.api.commons.HttpStatusCodes
 |=======================================================================
 
+### Endpoint HTTP Headers (Since 2.20)
+The component level configuration property **httpHeaders** supplies static HTTP header information. 
+However, some systems requires dynamic header information to be passed to and received from the endpoint.
+A sample use case would be systems that require dynamic security tokens.  The **endpointHttpHeaders** 
+and **responseHttpHeaders** endpoint properties provides this capability.  Set headers that need to 
+be passed to the endpoint in the *`CamelOlingo2.endpointHttpHeaders`* property and the 
+response headers will be returned in a *`CamelOlingo2.responseHttpHeaders`* property.  
+Both properties are of the type *`java.util.Map<String, String>`*.
+
 ### OData Resource Type Mapping
 
 The result of *read* endpoint and data type of *data* option depends on

http://git-wip-us.apache.org/repos/asf/camel/blob/a02395e0/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2AppWrapper.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2AppWrapper.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2AppWrapper.java
index 63f7f97..164ad8b 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2AppWrapper.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2AppWrapper.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.olingo2;
 
+import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 
 import org.apache.camel.RuntimeCamelException;
@@ -58,10 +59,10 @@ public class Olingo2AppWrapper {
 
                     final CountDownLatch latch = new CountDownLatch(1);
                     final Exception[] error = new Exception[1];
-                    olingo2App.read(null, "$metadata", null, new Olingo2ResponseHandler<Edm>() {
+                    olingo2App.read(null, "$metadata", null, null, new Olingo2ResponseHandler<Edm>() {
 
                         @Override
-                        public void onResponse(Edm response) {
+                        public void onResponse(Edm response, Map<String, String> responseHeaders) {
                             edm = response;
                             latch.countDown();
                         }

http://git-wip-us.apache.org/repos/asf/camel/blob/a02395e0/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java
index 4a46675..3418fbe 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java
@@ -55,7 +55,7 @@ public class Olingo2Consumer extends AbstractApiConsumer<Olingo2ApiName, Olingo2
 
             args.put(Olingo2Endpoint.RESPONSE_HANDLER_PROPERTY, new Olingo2ResponseHandler<Object>() {
                 @Override
-                public void onResponse(Object response) {
+                public void onResponse(Object response, Map<String, String> responseHeaders) {
                     result[0] = response;
                     latch.countDown();
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a02395e0/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
index 652d3ae..94fdc7a 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
@@ -46,6 +46,7 @@ public class Olingo2Endpoint extends AbstractApiEndpoint<Olingo2ApiName, Olingo2
 
     private static final String KEY_PREDICATE_PROPERTY = "keyPredicate";
     private static final String QUERY_PARAMS_PROPERTY = "queryParams";
+    private static final String ENDPOINT_HTTP_HEADERS_PROPERTY = "endpointHttpHeaders";
 
     private static final String READ_METHOD = "read";
     private static final String EDM_PROPERTY = "edm";
@@ -72,6 +73,7 @@ public class Olingo2Endpoint extends AbstractApiEndpoint<Olingo2ApiName, Olingo2
         endpointPropertyNames = new HashSet<String>(getPropertiesHelper().getValidEndpointProperties(configuration));
         // avoid adding edm as queryParam
         endpointPropertyNames.add(EDM_PROPERTY);
+        endpointPropertyNames.add(ENDPOINT_HTTP_HEADERS_PROPERTY);
     }
 
     public Producer createProducer() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/a02395e0/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Producer.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Producer.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Producer.java
index b9e46a4..dcd8891 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Producer.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Producer.java
@@ -24,6 +24,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.olingo2.api.Olingo2ResponseHandler;
 import org.apache.camel.component.olingo2.internal.Olingo2ApiName;
+import org.apache.camel.component.olingo2.internal.Olingo2Constants;
 import org.apache.camel.component.olingo2.internal.Olingo2PropertiesHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.component.AbstractApiProducer;
@@ -38,6 +39,8 @@ public class Olingo2Producer extends AbstractApiProducer<Olingo2ApiName, Olingo2
 
     private static final Logger LOG = LoggerFactory.getLogger(Olingo2Producer.class);
 
+    private static final String RESPONSE_HTTP_HEADERS = "responseHttpHeaders";
+
     public Olingo2Producer(Olingo2Endpoint endpoint) {
         super(endpoint, Olingo2PropertiesHelper.getHelper());
     }
@@ -56,11 +59,14 @@ public class Olingo2Producer extends AbstractApiProducer<Olingo2ApiName, Olingo2
         // create response handler
         properties.put(Olingo2Endpoint.RESPONSE_HANDLER_PROPERTY, new Olingo2ResponseHandler<Object>() {
             @Override
-            public void onResponse(Object response) {
+            public void onResponse(Object response, Map<String, String> responseHeaders) {
                 // producer returns a single response, even for methods with List return types
                 exchange.getOut().setBody(response);
                 // copy headers
                 exchange.getOut().setHeaders(exchange.getIn().getHeaders());
+                
+                // Add http response headers
+                exchange.getOut().setHeader(Olingo2Constants.PROPERTY_PREFIX + RESPONSE_HTTP_HEADERS, responseHeaders);
 
                 interceptResult(response, exchange);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a02395e0/components/camel-olingo2/camel-olingo2-component/src/signatures/olingo-api-signature.txt
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/signatures/olingo-api-signature.txt b/components/camel-olingo2/camel-olingo2-component/src/signatures/olingo-api-signature.txt
index 006fba7..d4ba9ad 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/signatures/olingo-api-signature.txt
+++ b/components/camel-olingo2/camel-olingo2-component/src/signatures/olingo-api-signature.txt
@@ -1,8 +1,8 @@
-void read(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> queryParams, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
-void uread(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> queryParams, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
-void delete(String resourcePath, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
-void create(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
-void update(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
-void patch(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
-void merge(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
-void batch(org.apache.olingo.odata2.api.edm.Edm edm, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
+void read(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> queryParams, java.util.Map<String, String> endpointHttpHeaders, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
+void uread(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> queryParams, java.util.Map<String, String> endpointHttpHeaders, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
+void delete(String resourcePath, java.util.Map<String, String> endpointHttpHeaders, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
+void create(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
+void update(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
+void patch(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
+void merge(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
+void batch(org.apache.olingo.odata2.api.edm.Edm edm, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);

http://git-wip-us.apache.org/repos/asf/camel/blob/a02395e0/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppAPITest.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppAPITest.java b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppAPITest.java
index d0b0934..28b43a9 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppAPITest.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppAPITest.java
@@ -139,7 +139,7 @@ public class Olingo2AppAPITest {
         LOG.info("Read Edm ");
         final TestOlingo2ResponseHandler<Edm> responseHandler = new TestOlingo2ResponseHandler<Edm>();
 
-        olingoApp.read(null, Olingo2AppImpl.METADATA, null, responseHandler);
+        olingoApp.read(null, Olingo2AppImpl.METADATA, null, null, responseHandler);
 
         edm = responseHandler.await();
         LOG.info("Read default EntityContainer:  {}", responseHandler.await().getDefaultEntityContainer().getName());
@@ -158,7 +158,7 @@ public class Olingo2AppAPITest {
         final TestOlingo2ResponseHandler<ServiceDocument> responseHandler =
             new TestOlingo2ResponseHandler<ServiceDocument>();
 
-        olingoApp.read(null, "", null, responseHandler);
+        olingoApp.read(null, "", null, null, responseHandler);
 
         final ServiceDocument serviceDocument = responseHandler.await();
         final List<Collection> collections = serviceDocument.getAtomInfo().getWorkspaces().get(0).getCollections();
@@ -174,7 +174,7 @@ public class Olingo2AppAPITest {
     public void testReadFeed() throws Exception {
         final TestOlingo2ResponseHandler<ODataFeed> responseHandler = new TestOlingo2ResponseHandler<ODataFeed>();
 
-        olingoApp.read(edm, MANUFACTURERS, null, responseHandler);
+        olingoApp.read(edm, MANUFACTURERS, null, null, responseHandler);
 
         final ODataFeed dataFeed = responseHandler.await();
         assertNotNull("Data feed", dataFeed);
@@ -185,7 +185,7 @@ public class Olingo2AppAPITest {
     public void testReadUnparsedFeed() throws Exception {
         final TestOlingo2ResponseHandler<InputStream> responseHandler = new TestOlingo2ResponseHandler<InputStream>();
 
-        olingoApp.uread(edm, MANUFACTURERS, null, responseHandler);
+        olingoApp.uread(edm, MANUFACTURERS, null, null, responseHandler);
 
         final InputStream rawfeed = responseHandler.await();
         assertNotNull("Data feed", rawfeed);
@@ -199,13 +199,13 @@ public class Olingo2AppAPITest {
     public void testReadEntry() throws Exception {
         final TestOlingo2ResponseHandler<ODataEntry> responseHandler = new TestOlingo2ResponseHandler<ODataEntry>();
 
-        olingoApp.read(edm, TEST_MANUFACTURER, null, responseHandler);
+        olingoApp.read(edm, TEST_MANUFACTURER, null, null, responseHandler);
         ODataEntry entry = responseHandler.await();
         LOG.info("Single Entry:  {}", prettyPrint(entry));
 
         responseHandler.reset();
 
-        olingoApp.read(edm, TEST_CAR, null, responseHandler);
+        olingoApp.read(edm, TEST_CAR, null, null, responseHandler);
         entry = responseHandler.await();
         LOG.info("Single Entry:  {}", prettyPrint(entry));
 
@@ -213,7 +213,7 @@ public class Olingo2AppAPITest {
         final Map<String, String> queryParams = new HashMap<String, String>();
         queryParams.put(SystemQueryOption.$expand.toString(), CARS);
 
-        olingoApp.read(edm, TEST_MANUFACTURER, queryParams, responseHandler);
+        olingoApp.read(edm, TEST_MANUFACTURER, queryParams, null, responseHandler);
 
         ODataEntry entryExpanded = responseHandler.await();
         LOG.info("Single Entry with expanded Cars relation:  {}", prettyPrint(entryExpanded));
@@ -223,7 +223,7 @@ public class Olingo2AppAPITest {
     public void testReadUnparsedEntry() throws Exception {
         final TestOlingo2ResponseHandler<InputStream> responseHandler = new TestOlingo2ResponseHandler<InputStream>();
 
-        olingoApp.uread(edm, TEST_MANUFACTURER, null, responseHandler);
+        olingoApp.uread(edm, TEST_MANUFACTURER, null, null, responseHandler);
         InputStream rawentry = responseHandler.await();
         ODataEntry entry = EntityProvider.readEntry(TEST_FORMAT_STRING, edmEntitySetMap.get(MANUFACTURERS), 
                                                     rawentry, EntityProviderReadProperties.init().build());
@@ -231,7 +231,7 @@ public class Olingo2AppAPITest {
 
         responseHandler.reset();
 
-        olingoApp.uread(edm, TEST_CAR, null, responseHandler);
+        olingoApp.uread(edm, TEST_CAR, null, null, responseHandler);
         rawentry = responseHandler.await();
         entry = EntityProvider.readEntry(TEST_FORMAT_STRING, edmEntitySetMap.get(CARS),
                                          rawentry, EntityProviderReadProperties.init().build());
@@ -241,7 +241,7 @@ public class Olingo2AppAPITest {
         final Map<String, String> queryParams = new HashMap<String, String>();
         queryParams.put(SystemQueryOption.$expand.toString(), CARS);
 
-        olingoApp.uread(edm, TEST_MANUFACTURER, queryParams, responseHandler);
+        olingoApp.uread(edm, TEST_MANUFACTURER, queryParams, null, responseHandler);
 
         rawentry = responseHandler.await();
         ODataEntry entryExpanded = EntityProvider.readEntry(TEST_FORMAT_STRING, edmEntitySetMap.get(MANUFACTURERS), 
@@ -255,14 +255,14 @@ public class Olingo2AppAPITest {
         final TestOlingo2ResponseHandler<Map<String, Object>> propertyHandler =
             new TestOlingo2ResponseHandler<Map<String, Object>>();
 
-        olingoApp.read(edm, TEST_MANUFACTURER_FOUNDED_PROPERTY, null, propertyHandler);
+        olingoApp.read(edm, TEST_MANUFACTURER_FOUNDED_PROPERTY, null, null, propertyHandler);
 
         Calendar founded = (Calendar) propertyHandler.await().get(FOUNDED_PROPERTY);
         LOG.info("Founded property {}", founded.toString());
 
         final TestOlingo2ResponseHandler<Calendar> valueHandler = new TestOlingo2ResponseHandler<Calendar>();
 
-        olingoApp.read(edm, TEST_MANUFACTURER_FOUNDED_VALUE, null, valueHandler);
+        olingoApp.read(edm, TEST_MANUFACTURER_FOUNDED_VALUE, null, null, valueHandler);
 
         founded = valueHandler.await();
         LOG.info("Founded property {}", founded.toString());
@@ -274,20 +274,20 @@ public class Olingo2AppAPITest {
 
 //        olingoApp.update(edm, TEST_MANUFACTURER_FOUNDED_PROPERTY, properties, statusHandler);
         // requires a plain Date for XML
-        olingoApp.update(edm, TEST_MANUFACTURER_FOUNDED_PROPERTY, new Date(), statusHandler);
+        olingoApp.update(edm, TEST_MANUFACTURER_FOUNDED_PROPERTY, null, new Date(), statusHandler);
 
         LOG.info("Founded property updated with status {}", statusHandler.await().getStatusCode());
 
         statusHandler.reset();
 
-        olingoApp.update(edm, TEST_MANUFACTURER_FOUNDED_VALUE, new Date(), statusHandler);
+        olingoApp.update(edm, TEST_MANUFACTURER_FOUNDED_VALUE, null, new Date(), statusHandler);
 
         LOG.info("Founded property updated with status {}", statusHandler.await().getStatusCode());
 
         // test complex property Manufacturer.Address
         propertyHandler.reset();
 
-        olingoApp.read(edm, TEST_MANUFACTURER_ADDRESS_PROPERTY, null, propertyHandler);
+        olingoApp.read(edm, TEST_MANUFACTURER_ADDRESS_PROPERTY, null, null, propertyHandler);
 
         final Map<String, Object> address = propertyHandler.await();
         LOG.info("Address property {}", prettyPrint(address, 0));
@@ -303,7 +303,7 @@ public class Olingo2AppAPITest {
         address.put("Country", "Germany");
 
 //        olingoApp.patch(edm, TEST_MANUFACTURER_ADDRESS_PROPERTY, address, statusHandler);
-        olingoApp.merge(edm, TEST_MANUFACTURER_ADDRESS_PROPERTY, address, statusHandler);
+        olingoApp.merge(edm, TEST_MANUFACTURER_ADDRESS_PROPERTY, null, address, statusHandler);
 
         LOG.info("Address property updated with status {}", statusHandler.await().getStatusCode());
     }
@@ -312,7 +312,7 @@ public class Olingo2AppAPITest {
     public void testReadDeleteCreateLinks() throws Exception {
         final TestOlingo2ResponseHandler<List<String>> linksHandler = new TestOlingo2ResponseHandler<List<String>>();
 
-        olingoApp.read(edm, TEST_MANUFACTURER_LINKS_CARS, null, linksHandler);
+        olingoApp.read(edm, TEST_MANUFACTURER_LINKS_CARS, null, null, linksHandler);
 
         final List<String> links = linksHandler.await();
         assertFalse(links.isEmpty());
@@ -320,7 +320,7 @@ public class Olingo2AppAPITest {
 
         final TestOlingo2ResponseHandler<String> linkHandler = new TestOlingo2ResponseHandler<String>();
 
-        olingoApp.read(edm, TEST_CAR_LINK_MANUFACTURER, null, linkHandler);
+        olingoApp.read(edm, TEST_CAR_LINK_MANUFACTURER, null, null, linkHandler);
 
         final String link = linkHandler.await();
         LOG.info("Read link: {}", link);
@@ -377,22 +377,22 @@ public class Olingo2AppAPITest {
     public void testReadCount() throws Exception {
         final TestOlingo2ResponseHandler<Long> countHandler = new TestOlingo2ResponseHandler<Long>();
 
-        olingoApp.read(edm, MANUFACTURERS + COUNT_OPTION, null, countHandler);
+        olingoApp.read(edm, MANUFACTURERS + COUNT_OPTION, null, null, countHandler);
 
         LOG.info("Manufacturers count: {}", countHandler.await());
 
         countHandler.reset();
-        olingoApp.read(edm, TEST_MANUFACTURER + COUNT_OPTION, null, countHandler);
+        olingoApp.read(edm, TEST_MANUFACTURER + COUNT_OPTION, null, null, countHandler);
 
         LOG.info("Manufacturer count: {}", countHandler.await());
 
         countHandler.reset();
-        olingoApp.read(edm, TEST_MANUFACTURER_LINKS_CARS + COUNT_OPTION, null, countHandler);
+        olingoApp.read(edm, TEST_MANUFACTURER_LINKS_CARS + COUNT_OPTION, null, null, countHandler);
 
         LOG.info("Manufacturers links count: {}", countHandler.await());
 
         countHandler.reset();
-        olingoApp.read(edm, TEST_CAR_LINK_MANUFACTURER + COUNT_OPTION, null, countHandler);
+        olingoApp.read(edm, TEST_CAR_LINK_MANUFACTURER + COUNT_OPTION, null, null, countHandler);
 
         LOG.info("Manufacturer link count: {}", countHandler.await());
     }
@@ -403,7 +403,7 @@ public class Olingo2AppAPITest {
         // create entry to update
         final TestOlingo2ResponseHandler<ODataEntry> entryHandler = new TestOlingo2ResponseHandler<ODataEntry>();
 
-        olingoApp.create(edm, MANUFACTURERS, getEntityData(), entryHandler);
+        olingoApp.create(edm, MANUFACTURERS, null, getEntityData(), entryHandler);
 
         ODataEntry createdEntry = entryHandler.await();
         LOG.info("Created Entry:  {}", prettyPrint(createdEntry));
@@ -417,22 +417,22 @@ public class Olingo2AppAPITest {
         final TestOlingo2ResponseHandler<HttpStatusCodes> statusHandler =
             new TestOlingo2ResponseHandler<HttpStatusCodes>();
 
-        olingoApp.update(edm, TEST_CREATE_MANUFACTURER, data, statusHandler);
+        olingoApp.update(edm, TEST_CREATE_MANUFACTURER, null, data, statusHandler);
         statusHandler.await();
 
         statusHandler.reset();
         data.put("Name", "MyCarManufacturer Patched");
-        olingoApp.patch(edm, TEST_CREATE_MANUFACTURER, data, statusHandler);
+        olingoApp.patch(edm, TEST_CREATE_MANUFACTURER, null, data, statusHandler);
         statusHandler.await();
 
         entryHandler.reset();
-        olingoApp.read(edm, TEST_CREATE_MANUFACTURER, null, entryHandler);
+        olingoApp.read(edm, TEST_CREATE_MANUFACTURER, null, null, entryHandler);
 
         ODataEntry updatedEntry = entryHandler.await();
         LOG.info("Updated Entry successfully:  {}", prettyPrint(updatedEntry));
 
         statusHandler.reset();
-        olingoApp.delete(TEST_CREATE_MANUFACTURER,  statusHandler);
+        olingoApp.delete(TEST_CREATE_MANUFACTURER, null, statusHandler);
 
         HttpStatusCodes statusCode = statusHandler.await();
         LOG.info("Deletion of Entry was successful:  {}: {}", statusCode.getStatusCode(), statusCode.getInfo());
@@ -441,7 +441,7 @@ public class Olingo2AppAPITest {
             LOG.info("Verify Delete Entry");
 
             entryHandler.reset();
-            olingoApp.read(edm, TEST_CREATE_MANUFACTURER, null, entryHandler);
+            olingoApp.read(edm, TEST_CREATE_MANUFACTURER, null, null, entryHandler);
 
             entryHandler.await();
             fail("Entry not deleted!");
@@ -493,7 +493,7 @@ public class Olingo2AppAPITest {
         // read to verify delete
         batchParts.add(Olingo2BatchQueryRequest.resourcePath(TEST_CREATE_MANUFACTURER).build());
 
-        olingoApp.batch(edm, batchParts, responseHandler);
+        olingoApp.batch(edm, null, batchParts, responseHandler);
 
         final List<Olingo2BatchResponse> responseParts = responseHandler.await(15, TimeUnit.MINUTES);
         assertEquals("Batch responses expected", 8, responseParts.size());
@@ -602,7 +602,7 @@ public class Olingo2AppAPITest {
         private CountDownLatch latch = new CountDownLatch(1);
 
         @Override
-        public void onResponse(T response) {
+        public void onResponse(T response, Map<String, String> responseHeaders) {
             this.response = response;
             if (LOG.isDebugEnabled()) {
                 if (response instanceof ODataFeed) {


Mime
View raw message