This is an automated email from the ASF dual-hosted git repository.

ramyav pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/olingo-odata4.git


The following commit(s) were added to refs/heads/master by this push:
     new eff9b98  [OLINGO-1238]Handle all header values in Accept and 
Accept-Charset for batch calls
eff9b98 is described below

commit eff9b984a5ffc3d4d035ad5e9333c1941645437a
Author: ramya vasanth <ramya.vasa...@sap.com>
AuthorDate: Fri Oct 9 10:21:22 2020 +0530

    [OLINGO-1238]Handle all header values in Accept and Accept-Charset for 
batch calls
---
 .../java/org/apache/olingo/server/core/ContentNegotiator.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
index 407264c..68f4e2f 100644
--- 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
+++ 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
@@ -24,6 +24,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 import org.apache.olingo.commons.api.format.AcceptCharset;
 import org.apache.olingo.commons.api.format.AcceptType;
@@ -92,8 +93,12 @@ public final class ContentNegotiator {
           throws ContentNegotiatorException {
     final List<ContentType> supportedContentTypes =
         getSupportedContentTypes(customContentTypeSupport, representationType);
-    final String acceptHeaderValue = request.getHeader(HttpHeader.ACCEPT);
-    String acceptCharset = request.getHeader(HttpHeader.ACCEPT_CHARSET);
+    final List<String> acceptHeaderValueList = 
request.getHeaders(HttpHeader.ACCEPT);
+    final String acceptHeaderValue = acceptHeaderValueList != null ? 
+               acceptHeaderValueList.stream().collect(Collectors.joining(", 
")) : null;
+    List<String> acceptCharsetValueList = 
request.getHeaders(HttpHeader.ACCEPT_CHARSET);
+    String acceptCharset = acceptCharsetValueList != null ? 
+               acceptCharsetValueList.stream().collect(Collectors.joining(", 
")) : null;
     List<AcceptCharset> charsets = null;
       
     ContentType result = null;

Reply via email to