List of usage examples for com.squareup.okhttp Headers toMultimap
public Map<String, List<String>> toMultimap()
From source file:com.frostwire.util.http.OKHTTPClient.java
License:Open Source License
private void onHeaders(Headers headers) { if (getListener() != null) { try {// w ww. j a va 2 s.c o m getListener().onHeaders(this, headers.toMultimap()); } catch (Exception e) { LOG.warn(e.getMessage(), e); } } }
From source file:com.microsoft.azure.CustomHeaderInterceptor.java
License:Open Source License
/** * Add all headers in a {@link Headers} object. * * @param headers an OkHttp {@link Headers} object. * @return the interceptor instance itself. *//*from ww w . j a v a 2 s . c o m*/ public CustomHeaderInterceptor addHeaders(Headers headers) { this.headers.putAll(headers.toMultimap()); return this; }
From source file:com.microsoft.rest.serializer.HeadersSerializer.java
License:Open Source License
@Override public void serialize(Headers value, JsonGenerator jgen, SerializerProvider provider) throws IOException { Map<String, Object> headers = new HashMap<String, Object>(); for (Map.Entry<String, List<String>> entry : value.toMultimap().entrySet()) { if (entry.getValue() != null && entry.getValue().size() == 1) { headers.put(entry.getKey(), entry.getValue().get(0)); } else if (entry.getValue() != null && entry.getValue().size() > 1) { headers.put(entry.getKey(), entry.getValue()); }//from ww w . j a va 2s .c o m } jgen.writeObject(headers); }