private void postFile(final HttpClientConfiguration httpClientConfiguration,
                          final Path file,
                          final AttributeMap effectiveAttributeMap) throws IOException {
        try {
            final HttpUriRequestBase request =
                    new HttpUriRequestBase(requestMethod, URI.create(forwardUrl));
            request.addHeader("Content-Type", contentType);
            request.setEntity(new FileEntity(file.toFile(), ContentType.create(contentType)));

            setCompressionProperties(outputStreamSupport, request);

            for (Entry<String, String> entry : effectiveAttributeMap.entrySet()) {
                addRequestProperty(request, entry.getKey(), entry.getValue());
            }

//        if (forwardChunkSize != null) {
//            LOGGER.debug(() -> "handleHeader() - setting ChunkedStreamingMode = " + forwardChunkSize);
//            connection.setChunkedStreamingMode(forwardChunkSize.intValue());
//        }
            if (LOGGER.isDebugEnabled()) {
                logConnectionToDebug();
            }


            final HttpClient httpClient = httpClientCache.get(httpClientConfiguration);
            httpClient.execute(request, response -> {

                LOGGER.debug(() -> "closeConnection() - header fields " +
                                   Arrays.toString(response.getHeaders()));
                int responseCode = response.getCode();
                try {
                    responseCode = checkResponse(response);
                } catch (final RuntimeException e) {
                    LOGGER.debug(e::getMessage, e);
                    throw e;
                } finally {
                    long bytes = getCurrentOutputSize();
                    final long duration = System.currentTimeMillis() - startTimeMs;
                    final AttributeMap attributeMap = metaDataHolder.getMetaData();
                    log(SEND_LOG, attributeMap, "SEND", forwardUrl, responseCode, bytes, duration);
                }

                return response.getCode();
            });
        } finally {
            Files.deleteIfExists(file);
        }
    }
Handler class that forwards the request to a URL.
stroom-pipeline/src/main/java/stroom/pipeline/writer/HTTPAppender.java