/** Sets HTTP request headers based on the Axis message context. */ private void setHttpRequestHeaders(MessageContext msgContext, HttpRequest httpRequest) { @SuppressWarnings("unchecked") Map<Object, Object> requestHeaders = (Map<Object, Object>) msgContext.getProperty(HTTPConstants.REQUEST_HEADERS); if (requestHeaders != null) { for (Entry<Object, Object> headerEntry : requestHeaders.entrySet()) { Object headerKey = headerEntry.getKey(); if (headerKey == null) { continue; } String headerName = headerKey.toString().trim(); Object headerValue = headerEntry.getValue(); if (HTTPConstants.HEADER_AUTHORIZATION.equals(headerName) && (headerValue instanceof String)) { // HttpRequest expects the Authorization header to be a list of values, // so handle the case where it is simply a string. httpRequest.getHeaders().setAuthorization((String) headerValue); } else { httpRequest.getHeaders().set(headerName, headerValue); } } } if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) { httpRequest.getHeaders().setContentEncoding(HTTPConstants.COMPRESSION_GZIP); } }
/** Sets HTTP request headers based on the Axis message context. */ private void setHttpRequestHeaders(MessageContext msgContext, HttpRequest httpRequest) { @SuppressWarnings("unchecked") Map<Object, Object> requestHeaders = (Map<Object, Object>) msgContext.getProperty(HTTPConstants.REQUEST_HEADERS); if (requestHeaders != null) { for (Entry<Object, Object> headerEntry : requestHeaders.entrySet()) { Object headerKey = headerEntry.getKey(); if (headerKey == null) { continue; } String headerName = headerKey.toString().trim(); Object headerValue = headerEntry.getValue(); if (HTTPConstants.HEADER_AUTHORIZATION.equals(headerName) && (headerValue instanceof String)) { // HttpRequest expects the Authorization header to be a list of values, // so handle the case where it is simply a string. httpRequest.getHeaders().setAuthorization((String) headerValue); } else { httpRequest.getHeaders().set(headerName, headerValue); } } } if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) { httpRequest.getHeaders().setContentEncoding(HTTPConstants.COMPRESSION_GZIP); } }
headers.fromHttpHeaders(part.headers); headers.setContentEncoding(null) .setUserAgent(null) .setContentType(null) streamingContent = content; } else { headers.setContentEncoding(encoding.getName()); streamingContent = new HttpEncodingStreamingContent(content, encoding);
headers.fromHttpHeaders(request.getHeaders()); headers.setAcceptEncoding(null).setUserAgent(null) .setContentEncoding(null).setContentType(null).setContentLength(null);
final byte[] json = gzipJson(payload); payloadSize = json.length; headers.setContentEncoding(GZIP); headers.setContentLength((long) json.length); headers.setContentType(APPLICATION_JSON_UTF8);