use of com.linkedin.restli.client.uribuilders.MultiplexerUriBuilder in project rest.li by linkedin.
the class RestClient method buildMultiplexedRequest.
private RestRequest buildMultiplexedRequest(MultiplexedRequest multiplexedRequest) throws IOException {
URI requestUri = new MultiplexerUriBuilder(_uriPrefix).build();
RestRequestBuilder requestBuilder = new RestRequestBuilder(requestUri).setMethod(HttpMethod.POST.toString());
addAcceptHeaders(requestBuilder, multiplexedRequest.getRequestOptions().getAcceptTypes(), false);
final DataMap multiplexedPayload = multiplexedRequest.getContent().data();
final ContentType type = resolveContentType(requestBuilder, multiplexedPayload, multiplexedRequest.getRequestOptions().getContentType(), requestUri);
assert (type != null);
requestBuilder.setHeader(RestConstants.HEADER_CONTENT_TYPE, type.getHeaderKey());
requestBuilder.setEntity(type.getCodec().mapToByteString(multiplexedPayload));
requestBuilder.setHeader(RestConstants.HEADER_RESTLI_PROTOCOL_VERSION, AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion().toString());
return requestBuilder.build();
}
Aggregations