private static void copyHeadersAndContext( ActionRequest actionRequest, RestRequest restRequest, Set<String> headers) { for (String usefulHeader : headers) { String headerValue = restRequest.header(usefulHeader); if (headerValue != null) { actionRequest.putHeader(usefulHeader, headerValue); } } actionRequest.copyContextFrom(restRequest); }
private static void putHeaders(ActionRequest<?> request, Map<String, String> headers) { for (Map.Entry<String, String> header : headers.entrySet()) { request.putHeader(header.getKey(), header.getValue()); } }