List of usage examples for com.squareup.okhttp Headers.Builder Headers.Builder
Headers.Builder
From source file:com.netflix.spinnaker.clouddriver.artifacts.config.BaseHttpArtifactCredentials.java
License:Apache License
protected Headers getHeaders(T account) { Headers.Builder headers = new Headers.Builder(); Optional<String> authHeader = getAuthHeader(account); if (authHeader.isPresent()) { headers.set("Authorization", authHeader.get()); log.info("Loaded credentials for artifact account {}", account.getName()); } else {/*w ww . j a v a 2s .c om*/ log.info("No credentials included for artifact account {}", account.getName()); } return headers.build(); }
From source file:org.wso2.carbon.identity.authenticator.duo.DuoHttp.java
License:Open Source License
public DuoHttp(String in_method, String in_host, String in_uri) { method = in_method.toUpperCase();/* w w w . jav a 2 s .c o m*/ host = in_host; uri = in_uri; headers = new Headers.Builder(); headers.add("Host", host); proxy = null; }
From source file:twitter4j.AlternativeHttpClientImpl.java
License:Apache License
private Headers getHeaders(HttpRequest req) { Headers.Builder builder = new Headers.Builder(); if (logger.isDebugEnabled()) { logger.debug("Request: "); logger.debug(req.getMethod().name() + " ", req.getURL()); }//from w w w .j a v a 2s.c o m String authorizationHeader; if (req.getAuthorization() != null && (authorizationHeader = req.getAuthorization().getAuthorizationHeader(req)) != null) { if (logger.isDebugEnabled()) { logger.debug("Authorization: ", authorizationHeader.replaceAll(".", "*")); } builder.add("Authorization", authorizationHeader); } if (req.getRequestHeaders() != null) { for (Map.Entry<String, String> entry : req.getRequestHeaders().entrySet()) { builder.add(entry.getKey(), entry.getValue()); logger.debug(entry.getKey() + ": " + entry.getValue()); } } return builder.build(); }