Codota Logo
CacheResponse
Code IndexAdd Codota to your IDE (free)

How to use
CacheResponse
in
java.net

Best Java code snippets using java.net.CacheResponse (Showing top 14 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: square/okhttp

/**
 * Creates an OkHttp Response.Body containing the supplied information.
 */
private static ResponseBody createOkBody(final Headers okHeaders,
  final CacheResponse cacheResponse) throws IOException {
 final BufferedSource body = Okio.buffer(Okio.source(cacheResponse.getBody()));
 return new ResponseBody() {
  @Override
  public MediaType contentType() {
   String contentTypeHeader = okHeaders.get("Content-Type");
   return contentTypeHeader == null ? null : MediaType.parse(contentTypeHeader);
  }
  @Override
  public long contentLength() {
   return HttpHeaders.contentLength(okHeaders);
  }
  @Override public BufferedSource source() {
   return body;
  }
 };
}
origin: square/okhttp

/**
 * Extracts OkHttp headers from the supplied {@link java.net.CacheResponse}. Only real headers are
 * extracted. See {@link #extractStatusLine(java.net.CacheResponse)}.
 */
private static Headers extractOkHeaders(
  CacheResponse javaResponse, Response.Builder okResponseBuilder) throws IOException {
 Map<String, List<String>> javaResponseHeaders = javaResponse.getHeaders();
 return extractOkHeaders(javaResponseHeaders, okResponseBuilder);
}
origin: candrews/HttpResponseCache

Map<String, List<String>> responseHeadersMap = candidate.getHeaders();
cachedResponseBody = candidate.getBody();
if (!acceptCacheResponseType(candidate)
    || responseHeadersMap == null
origin: ibinti/bugvm

if (candidate == null) return;
Map<String, List<String>> responseHeadersMap = candidate.getHeaders();
cachedResponseBody = candidate.getBody();
if (!acceptCacheResponseType(candidate)
  || responseHeadersMap == null
origin: com.bugvm/bugvm-rt

if (candidate == null) return;
Map<String, List<String>> responseHeadersMap = candidate.getHeaders();
cachedResponseBody = candidate.getBody();
if (!acceptCacheResponseType(candidate)
  || responseHeadersMap == null
origin: square/okhttp

/**
 * Extracts the status line from the supplied Java API {@link java.net.CacheResponse}. As per the
 * spec, the status line is held as the header with the null key. Throws a {@link
 * ProtocolException} if there is no status line.
 */
private static String extractStatusLine(CacheResponse javaResponse) throws IOException {
 Map<String, List<String>> javaResponseHeaders = javaResponse.getHeaders();
 return extractStatusLine(javaResponseHeaders);
}
origin: com.squareup.okhttp3/okhttp-android-support

/**
 * Creates an OkHttp Response.Body containing the supplied information.
 */
private static ResponseBody createOkBody(final Headers okHeaders,
  final CacheResponse cacheResponse) throws IOException {
 final BufferedSource body = Okio.buffer(Okio.source(cacheResponse.getBody()));
 return new ResponseBody() {
  @Override
  public MediaType contentType() {
   String contentTypeHeader = okHeaders.get("Content-Type");
   return contentTypeHeader == null ? null : MediaType.parse(contentTypeHeader);
  }
  @Override
  public long contentLength() {
   return HttpHeaders.contentLength(okHeaders);
  }
  @Override public BufferedSource source() {
   return body;
  }
 };
}
origin: candrews/HttpResponseCache

RawHeaders rawResponseHeaders = RawHeaders.fromMultimap(cacheResponse.getHeaders());
setResponse(new ResponseHeaders(uri, rawResponseHeaders), cacheResponse.getBody());
origin: square/okhttp

Headers responseHeaders = createHeaders(javaResponse.getHeaders());
Headers varyHeaders;
if (HttpHeaders.hasVaryAll(responseHeaders)) {
origin: ibinti/bugvm

RawHeaders rawResponseHeaders = RawHeaders.fromMultimap(cacheResponse.getHeaders(), true);
setResponse(new ResponseHeaders(uri, rawResponseHeaders), cacheResponse.getBody());
origin: com.squareup.okhttp3/okhttp-android-support

/**
 * Extracts OkHttp headers from the supplied {@link java.net.CacheResponse}. Only real headers are
 * extracted. See {@link #extractStatusLine(java.net.CacheResponse)}.
 */
private static Headers extractOkHeaders(
  CacheResponse javaResponse, Response.Builder okResponseBuilder) throws IOException {
 Map<String, List<String>> javaResponseHeaders = javaResponse.getHeaders();
 return extractOkHeaders(javaResponseHeaders, okResponseBuilder);
}
origin: com.bugvm/bugvm-rt

RawHeaders rawResponseHeaders = RawHeaders.fromMultimap(cacheResponse.getHeaders(), true);
setResponse(new ResponseHeaders(uri, rawResponseHeaders), cacheResponse.getBody());
origin: com.squareup.okhttp3/okhttp-android-support

/**
 * Extracts the status line from the supplied Java API {@link java.net.CacheResponse}. As per the
 * spec, the status line is held as the header with the null key. Throws a {@link
 * ProtocolException} if there is no status line.
 */
private static String extractStatusLine(CacheResponse javaResponse) throws IOException {
 Map<String, List<String>> javaResponseHeaders = javaResponse.getHeaders();
 return extractStatusLine(javaResponseHeaders);
}
origin: com.squareup.okhttp3/okhttp-android-support

Headers responseHeaders = createHeaders(javaResponse.getHeaders());
Headers varyHeaders;
if (HttpHeaders.hasVaryAll(responseHeaders)) {
java.netCacheResponse

Javadoc

A response cache entry. A CacheResponse object provides an InputStream to access the response body and a Map for the response headers.

Most used methods

  • getBody
    Returns an InputStream to access the response body.
  • getHeaders
    Returns an immutable Map which contains the response headers information. Note that URLConnection ma

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSharedPreferences (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now