public List<String> getPrefer() { String preferHeader = getHeader(HeaderNames.PREFER); if (isNullOrEmpty(preferHeader)) { return Collections.emptyList(); } List<String> preferList = Arrays.stream(preferHeader.split(",")).map(String::trim).collect(Collectors.toList()); return Collections.unmodifiableList(preferList); }
private String buildBatchId(ODataRequestContext requestContext) throws ODataBatchRendererException { StringBuilder sb = new StringBuilder(); String contentType = requestContext.getRequest().getHeaders().get(CONTENT_TYPE.toLowerCase()); if (contentType == null) { contentType = requestContext.getRequest().getHeader(CONTENT_TYPE); } if (isNullOrEmpty(contentType)) { throw new ODataBatchRendererException("Request Context Content-Type is missing"); } sb.append("--"); // get the batch UUID sb.append(contentType.substring(contentType.indexOf("=") + 1)); // substring existing batch id after "batch_" charset return sb.toString(); } }
private String buildBatchId(ODataRequestContext requestContext) throws ODataBatchRendererException { StringBuilder sb = new StringBuilder(); String contentType = requestContext.getRequest().getHeaders().get(CONTENT_TYPE.toLowerCase()); if (contentType == null) { contentType = requestContext.getRequest().getHeader(CONTENT_TYPE); } if (isNullOrEmpty(contentType)) { throw new ODataBatchRendererException("Request Context Content-Type is missing"); } sb.append("--"); // get the batch UUID sb.append(contentType.substring(contentType.indexOf("=") + 1)); // substring existing batch id after "batch_" charset return sb.toString(); } }
public List<String> getPrefer() { String preferHeader = getHeader(HeaderNames.PREFER); if (isNullOrEmpty(preferHeader)) { return Collections.emptyList(); } List<String> preferList = Arrays.stream(preferHeader.split(",")).map(String::trim).collect(Collectors.toList()); return Collections.unmodifiableList(preferList); }
@Override public ProcessorResult doFunction(ODataRequestContext requestContext) throws ODataException { LOG.debug("Building and executing a function or function import"); Operation operation = getFunctionOrFunctionImportOperation(requestContext); Object result; try { // get the default http1.1 te header value String te = requestContext.getRequest().getHeader(TE); // get custom te header value that comes unchanged in http2 env String xte = requestContext.getRequest().getHeader(X_ODATA_TE); boolean isChunkedRequest = TRANSFER_ENCODING_CHUNKED.equals(te) || TRANSFER_ENCODING_CHUNKED.equals(xte); if (isChunkedRequest) { result = operation.doStreamOperation(requestContext, dataSourceFactory); } else { result = operation.doOperation(requestContext, dataSourceFactory); } } catch (Exception e) { LOG.error("Unexpected exception when executing a function.", e); throw e; } return result == null ? new ProcessorResult(ODataResponse.Status.NO_CONTENT) : new ProcessorResult(ODataResponse.Status.OK, QueryResult.from(result)); }
@Override public ProcessorResult doFunction(ODataRequestContext requestContext) throws ODataException { LOG.debug("Building and executing a function or function import"); Operation operation = getFunctionOrFunctionImportOperation(requestContext); Object result; try { // get the default http1.1 te header value String te = requestContext.getRequest().getHeader(TE); // get custom te header value that comes unchanged in http2 env String xte = requestContext.getRequest().getHeader(X_ODATA_TE); boolean isChunkedRequest = TRANSFER_ENCODING_CHUNKED.equals(te) || TRANSFER_ENCODING_CHUNKED.equals(xte); if (isChunkedRequest) { result = operation.doStreamOperation(requestContext, dataSourceFactory); } else { result = operation.doOperation(requestContext, dataSourceFactory); } } catch (Exception e) { LOG.error("Unexpected exception when executing a function.", e); throw e; } return result == null ? new ProcessorResult(ODataResponse.Status.NO_CONTENT) : new ProcessorResult(ODataResponse.Status.OK, QueryResult.from(result)); }