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;