private static Map<String, String> writeOutBoundHeaders(final MultivaluedMap<String, Object> headers, final com.ning.http.client.Request request) { Map<String, String> stringHeaders = HeaderUtils.asStringHeadersSingleValue(headers); for (Map.Entry<String, String> e : stringHeaders.entrySet()) { request.getHeaders().add(e.getKey(), e.getValue()); } return stringHeaders; }
public T addHeader(String name, String value) { if (value == null) { logger.warn("Value was null, set to \"\""); value = ""; } request.headers.add(name, value); return derived.cast(this); }
public FluentCaseInsensitiveStringsMap(FluentCaseInsensitiveStringsMap src) { if (src != null) { for (Map.Entry<String, List<String>> header : src) { add(header.getKey(), header.getValue()); } } }
public FluentCaseInsensitiveStringsMap(Map<String, Collection<String>> src) { if (src != null) { for (Map.Entry<String, Collection<String>> header : src.entrySet()) { add(header.getKey(), header.getValue()); } } }
/** * Adds all key-values pairs from the given object to this object and returns this object. * * @param src The source object * @return This object */ public FluentCaseInsensitiveStringsMap addAll(FluentCaseInsensitiveStringsMap src) { if (src != null) { for (Map.Entry<String, List<String>> header : src) { add(header.getKey(), header.getValue()); } } return this; }
private FluentCaseInsensitiveStringsMap computerHeaders() { FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap(); for (Map.Entry<String, String> header : responseHeaders) { h.add(header.getKey(), header.getValue()); } if (trailingHeaders != null) { for (Map.Entry<String, String> header : trailingHeaders) { h.add(header.getKey(), header.getValue()); } } return h; }
/** * Adds all key-values pairs from the given map to this object and returns this object. * * @param src The source map * @return This object */ public FluentCaseInsensitiveStringsMap addAll(Map<String, Collection<String>> src) { if (src != null) { for (Map.Entry<String, Collection<String>> header : src.entrySet()) { add(header.getKey(), header.getValue()); } } return this; }
private FluentCaseInsensitiveStringsMap computerHeaders(HttpURLConnection urlConnection) { FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap(); Map<String, List<String>> uh = urlConnection.getHeaderFields(); for (Map.Entry<String, List<String>> e : uh.entrySet()) { if (e.getKey() != null) { h.add(e.getKey(), e.getValue()); } } return h; }
private static void addNTLMAuthorizationHeader( FluentCaseInsensitiveStringsMap headers, String challengeHeader, boolean proxyInd) { headers.add(authorizationHeaderName(proxyInd), "NTLM " + challengeHeader); }
/** * Adds the specified values and returns this object. * * @param key The key * @param values The value(s); if the array is null then this method has no effect. Individual null values are turned into empty strings * @return This object */ public FluentCaseInsensitiveStringsMap add(String key, String... values) { if (isNonEmpty(values)) { add(key, Arrays.asList(values)); } return this; }
private void addNTLMAuthorizationHeader(FluentCaseInsensitiveStringsMap headers, String challengeHeader, boolean proxyInd) { headers.add(authorizationHeaderName(proxyInd), "NTLM " + challengeHeader); }
private void configureTransferAdapter(AsyncHandler<?> handler, HttpRequest httpRequest) { FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap(); for (Map.Entry<String, String> entries : httpRequest.headers()) { h.add(entries.getKey(), entries.getValue()); } TransferCompletionHandler.class.cast(handler).headers(h); }
@Override public FluentCaseInsensitiveStringsMap getHeaders() { if (!initialized) { synchronized (headers) { if (!initialized) { initialized = true; final MimeHeaders headersLocal = response.getHeaders(); for (int i = 0; i < headersLocal.size(); i++) { headers.add(headersLocal.getName(i).toString(Charsets.ASCII_CHARSET), headersLocal.getValue(i).toString(Charsets.ASCII_CHARSET)); } } } } return headers; }
public T addHeader(String name, String value) { if (value == null) { logger.warn("Value was null, set to \"\""); value = ""; } request.headers.add(name, value); return derived.cast(this); }
public FluentCaseInsensitiveStringsMap(FluentCaseInsensitiveStringsMap src) { if (src != null) { for (Map.Entry<String, List<String>> header : src) { add(header.getKey(), header.getValue()); } } }
public FluentCaseInsensitiveStringsMap(Map<String, Collection<String>> src) { if (src != null) { for (Map.Entry<String, Collection<String>> header : src.entrySet()) { add(header.getKey(), header.getValue()); } } }
private FluentCaseInsensitiveStringsMap computerHeaders() { FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap(); for (Map.Entry<String, String> header : responseHeaders) { h.add(header.getKey(), header.getValue()); } if (trailingHeaders != null) { for (Map.Entry<String, String> header : trailingHeaders) { h.add(header.getKey(), header.getValue()); } } return h; }
private Realm kerberosProxyChallenge(Channel channel,// List<String> proxyAuth,// Request request,// ProxyServer proxyServer,// FluentCaseInsensitiveStringsMap headers,// NettyResponseFuture<?> future) throws NTLMEngineException { Uri uri = request.getUri(); try { String challengeHeader = SpnegoEngine.INSTANCE.generateToken(proxyServer.getHost()); headers.remove(HttpHeaders.Names.AUTHORIZATION); headers.add(HttpHeaders.Names.AUTHORIZATION, "Negotiate " + challengeHeader); return proxyServer.realmBuilder()// .setUri(uri)// .setMethodName(request.getMethod())// .setScheme(Realm.AuthScheme.KERBEROS)// .build(); } catch (Throwable throwable) { String ntlmAuthenticate = getNTLM(proxyAuth); if (ntlmAuthenticate != null) { return ntlmProxyChallenge(ntlmAuthenticate, request, proxyServer, headers, future); } requestSender.abort(channel, future, throwable); return null; } }
private Realm kerberosChallenge(Channel channel,// List<String> authHeaders,// Request request,// FluentCaseInsensitiveStringsMap headers,// Realm realm,// NettyResponseFuture<?> future) throws NTLMEngineException { Uri uri = request.getUri(); String host = request.getVirtualHost() == null ? uri.getHost() : request.getVirtualHost(); try { String challengeHeader = SpnegoEngine.INSTANCE.generateToken(host); headers.remove(HttpHeaders.Names.AUTHORIZATION); headers.add(HttpHeaders.Names.AUTHORIZATION, "Negotiate " + challengeHeader); return new Realm.RealmBuilder().clone(realm)// .setUri(uri)// .setMethodName(request.getMethod())// .setScheme(Realm.AuthScheme.KERBEROS)// .build(); } catch (Throwable throwable) { String ntlmAuthenticate = getNTLM(authHeaders); if (ntlmAuthenticate != null) { return ntlmChallenge(ntlmAuthenticate, request, headers, realm, future); } requestSender.abort(channel, future, throwable); return null; } }
private static Map<String, String> writeOutBoundHeaders(final MultivaluedMap<String, Object> headers, final com.ning.http.client.Request request) { Map<String, String> stringHeaders = HeaderUtils.asStringHeadersSingleValue(headers); for (Map.Entry<String, String> e : stringHeaders.entrySet()) { request.getHeaders().add(e.getKey(), e.getValue()); } return stringHeaders; }