Java 类com.bumptech.glide.load.model.Headers 实例源码

项目:GitHub    文件:VolleyStreamFetcherServerTest.java   
@Test
public void testAppliesHeadersInGlideUrl() throws Exception {
  mockWebServer.enqueue(new MockResponse().setResponseCode(200));
  String headerField = "field";
  String headerValue = "value";
  Map<String, String> headersMap = new HashMap<>();
  headersMap.put(headerField, headerValue);
  Headers headers = mock(Headers.class);
  when(headers.getHeaders()).thenReturn(headersMap);

  getFetcher(headers).loadData(Priority.HIGH, callback);
  waitForResponseLatch.await();

  assertThat(mockWebServer.takeRequest().getHeader(headerField)).isEqualTo(headerValue);
}
项目:GitHub    文件:HttpUrlFetcherServerTest.java   
@Test
public void testAppliesHeadersInGlideUrl() throws Exception {
  mockWebServer.enqueue(new MockResponse().setResponseCode(200));
  String headerField = "field";
  String headerValue = "value";
  Map<String, String> headersMap = new HashMap<>();
  headersMap.put(headerField, headerValue);
  Headers headers = mock(Headers.class);
  when(headers.getHeaders()).thenReturn(headersMap);

  getFetcher(headers).loadData(Priority.HIGH, callback);

  assertThat(mockWebServer.takeRequest().getHeader(headerField)).isEqualTo(headerValue);
}
项目:GitHub    文件:VolleyStreamFetcherServerTest.java   
@Test
public void testAppliesHeadersInGlideUrl() throws Exception {
  mockWebServer.enqueue(new MockResponse().setResponseCode(200));
  String headerField = "field";
  String headerValue = "value";
  Map<String, String> headersMap = new HashMap<>();
  headersMap.put(headerField, headerValue);
  Headers headers = mock(Headers.class);
  when(headers.getHeaders()).thenReturn(headersMap);

  getFetcher(headers).loadData(Priority.HIGH, callback);
  waitForResponseLatch.await();

  assertThat(mockWebServer.takeRequest().getHeader(headerField)).isEqualTo(headerValue);
}
项目:GitHub    文件:HttpUrlFetcherServerTest.java   
@Test
public void testAppliesHeadersInGlideUrl() throws Exception {
  mockWebServer.enqueue(new MockResponse().setResponseCode(200));
  String headerField = "field";
  String headerValue = "value";
  Map<String, String> headersMap = new HashMap<>();
  headersMap.put(headerField, headerValue);
  Headers headers = mock(Headers.class);
  when(headers.getHeaders()).thenReturn(headersMap);

  getFetcher(headers).loadData(Priority.HIGH, callback);

  assertThat(mockWebServer.takeRequest().getHeader(headerField)).isEqualTo(headerValue);
}
项目:GitHub    文件:VolleyStreamFetcherServerTest.java   
private DataFetcher<InputStream> getFetcher() {
  return getFetcher(Headers.DEFAULT);
}
项目:GitHub    文件:VolleyStreamFetcherServerTest.java   
private DataFetcher<InputStream> getFetcher(Headers headers) {
  URL url = mockWebServer.url(DEFAULT_PATH).url();
  return new VolleyStreamFetcher(requestQueue, new GlideUrl(url.toString(), headers));
}
项目:GitHub    文件:HttpUrlFetcherServerTest.java   
private HttpUrlFetcher getFetcher() {
  return getFetcher(Headers.DEFAULT);
}
项目:GitHub    文件:HttpUrlFetcherServerTest.java   
private HttpUrlFetcher getFetcher(Headers headers) {
  URL url = mockWebServer.url(DEFAULT_PATH).url();
  return new HttpUrlFetcher(new GlideUrl(url, headers), TIMEOUT_TIME_MS,
      HttpUrlFetcher.DEFAULT_CONNECTION_FACTORY);
}
项目:GitHub    文件:VolleyStreamFetcherServerTest.java   
private DataFetcher<InputStream> getFetcher() {
  return getFetcher(Headers.DEFAULT);
}
项目:GitHub    文件:VolleyStreamFetcherServerTest.java   
private DataFetcher<InputStream> getFetcher(Headers headers) {
  URL url = mockWebServer.url(DEFAULT_PATH).url();
  return new VolleyStreamFetcher(requestQueue, new GlideUrl(url.toString(), headers));
}
项目:GitHub    文件:HttpUrlFetcherServerTest.java   
private HttpUrlFetcher getFetcher() {
  return getFetcher(Headers.DEFAULT);
}
项目:GitHub    文件:HttpUrlFetcherServerTest.java   
private HttpUrlFetcher getFetcher(Headers headers) {
  URL url = mockWebServer.url(DEFAULT_PATH).url();
  return new HttpUrlFetcher(new GlideUrl(url, headers), TIMEOUT_TIME_MS,
      HttpUrlFetcher.DEFAULT_CONNECTION_FACTORY);
}
项目:S1-Next    文件:AvatarUrl.java   
public AvatarUrl(URL url, Headers headers) {
    super(url, headers);
}
项目:S1-Next    文件:AvatarUrl.java   
public AvatarUrl(String url, Headers headers) {
    super(url, headers);
}
项目:S1-Next    文件:ForcePassUrl.java   
public ForcePassUrl(URL url, Headers headers) {
    super(url, headers);
}
项目:S1-Next    文件:ForcePassUrl.java   
public ForcePassUrl(String url, Headers headers) {
    super(url, headers);
}
项目:mage-android    文件:AttachmentLoader.java   
@Override
protected Headers getHeaders(Attachment model, int width, int height) {
    String token = PreferenceManager.getDefaultSharedPreferences(context).getString(context.getString(mil.nga.giat.mage.sdk.R.string.tokenKey), null);
    return new LazyHeaders.Builder().addHeader("Authorization", "Bearer " + token).build();
}
项目:GitHub    文件:BaseGlideUrlLoader.java   
/**
 * Returns the headers for the given model and dimensions as a map of strings to sets of strings,
 * or null if no headers should be added.
 *
 * @param model The model.
 * @param width The width in pixels of the view/target the image will be loaded into.
 * @param height The height in pixels of the view/target the image will be loaded into.
 */
// Public API.
@SuppressWarnings({"unused", "WeakerAccess"})
@Nullable
protected Headers getHeaders(Model model, int width, int height, Options options) {
  return Headers.DEFAULT;
}
项目:GitHub    文件:BaseGlideUrlLoader.java   
/**
 * Returns the headers for the given model and dimensions as a map of strings to sets of strings,
 * or null if no headers should be added.
 *
 * @param model The model.
 * @param width The width in pixels of the view/target the image will be loaded into.
 * @param height The height in pixels of the view/target the image will be loaded into.
 */
@Nullable
protected Headers getHeaders(Model model, int width, int height, Options options) {
  return Headers.DEFAULT;
}