if (request.getStreamingAttachments() != null)
private <T> void sendRequestNoScatterGather(final Request<T> request, final RequestContext requestContext, final Callback<Response<T>> callback) { //Here we need to decide if we want to use StreamRequest/StreamResponse or RestRequest/RestResponse. //Eventually we will move completely to StreamRequest/StreamResponse for all traffic. //However for the time being we will only use StreamRequest/StreamResponse for traffic that contains attachments. // //Therefore the decision is made as follows: //1. If the content-type OR accept-type is multipart/related then we use StreamRequest/StreamResponse, //otherwise we use RestRequest/RestResponse. //2. The content-type will be decided based on the presence of attachments in the request. //3. The accept-type will be based on the RestLiRequestOptions. //Note that it is not possible for the list of streaming attachments to be non-null and have 0 elements. If the //list of streaming attachments is non null then it must have at least one attachment. The request builders enforce //this invariant. if (_restLiClientConfig.isUseStreaming() || request.getStreamingAttachments() != null || request.getRequestOptions().getAcceptResponseAttachments()) { //Set content type and accept type correctly and use StreamRequest/StreamResponse sendStreamRequest(request, requestContext, new RestLiStreamCallbackAdapter<T>(request.getResponseDecoder(), callback)); } else { sendRestRequest(request, requestContext, new RestLiCallbackAdapter<T>(request.getResponseDecoder(), callback)); } }
@Override public void onSuccess(ProtocolVersion protocolVersion) { URI requestUri = RestliUriBuilderUtil.createUriBuilder(request, _uriPrefix, protocolVersion).build(); final ResourceMethod method = request.getMethod(); final String methodName = request.getMethodName(); addDisruptContext(request.getBaseUriTemplate(), method, methodName, requestContext); sendStreamRequestImpl(requestContext, requestUri, method, input != null ? RequestBodyTransformer.transform(request, protocolVersion) : null, request.getHeaders(), CookieUtil.encodeCookies(request.getCookies()), methodName, protocolVersion, request.getRequestOptions(), request.getStreamingAttachments(), callback); } });