From eff9b984a5ffc3d4d035ad5e9333c1941645437a Mon Sep 17 00:00:00 2001 From: ramya vasanth Date: Fri, 9 Oct 2020 10:21:22 +0530 Subject: [PATCH] [OLINGO-1238]Handle all header values in Accept and Accept-Charset for batch calls --- .../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 407264cb3..68f4e2f0a 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 supportedContentTypes = getSupportedContentTypes(customContentTypeSupport, representationType); - final String acceptHeaderValue = request.getHeader(HttpHeader.ACCEPT); - String acceptCharset = request.getHeader(HttpHeader.ACCEPT_CHARSET); + final List acceptHeaderValueList = request.getHeaders(HttpHeader.ACCEPT); + final String acceptHeaderValue = acceptHeaderValueList != null ? + acceptHeaderValueList.stream().collect(Collectors.joining(", ")) : null; + List acceptCharsetValueList = request.getHeaders(HttpHeader.ACCEPT_CHARSET); + String acceptCharset = acceptCharsetValueList != null ? + acceptCharsetValueList.stream().collect(Collectors.joining(", ")) : null; List charsets = null; ContentType result = null;