Java Code Examples for java.net.CacheRequest

The following examples show how to use java.net.CacheRequest. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: reader   Source File: HttpTransport.java    License: MIT License 6 votes vote down vote up
@Override public InputStream getTransferStream(CacheRequest cacheRequest) throws IOException {
  if (!httpEngine.hasResponseBody()) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine, 0);
  }

  if (httpEngine.responseHeaders.isChunked()) {
    return new ChunkedInputStream(socketIn, cacheRequest, this);
  }

  if (httpEngine.responseHeaders.getContentLength() != -1) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine,
        httpEngine.responseHeaders.getContentLength());
  }

  // Wrap the input stream from the connection (rather than just returning
  // "socketIn" directly here), so that we can control its use after the
  // reference escapes.
  return new UnknownLengthHttpInputStream(socketIn, cacheRequest, httpEngine);
}
 
Example 2
Source Project: L.TileLayer.Cordova   Source File: HttpTransport.java    License: MIT License 6 votes vote down vote up
@Override public InputStream getTransferStream(CacheRequest cacheRequest) throws IOException {
  if (!httpEngine.hasResponseBody()) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine, 0);
  }

  if (httpEngine.responseHeaders.isChunked()) {
    return new ChunkedInputStream(socketIn, cacheRequest, this);
  }

  if (httpEngine.responseHeaders.getContentLength() != -1) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine,
        httpEngine.responseHeaders.getContentLength());
  }

  // Wrap the input stream from the connection (rather than just returning
  // "socketIn" directly here), so that we can control its use after the
  // reference escapes.
  return new UnknownLengthHttpInputStream(socketIn, cacheRequest, httpEngine);
}
 
Example 3
Source Project: IoTgo_Android_App   Source File: HttpTransport.java    License: MIT License 6 votes vote down vote up
@Override public InputStream getTransferStream(CacheRequest cacheRequest) throws IOException {
  if (!httpEngine.hasResponseBody()) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine, 0);
  }

  if (httpEngine.responseHeaders.isChunked()) {
    return new ChunkedInputStream(socketIn, cacheRequest, this);
  }

  if (httpEngine.responseHeaders.getContentLength() != -1) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine,
        httpEngine.responseHeaders.getContentLength());
  }

  // Wrap the input stream from the connection (rather than just returning
  // "socketIn" directly here), so that we can control its use after the
  // reference escapes.
  return new UnknownLengthHttpInputStream(socketIn, cacheRequest, httpEngine);
}
 
Example 4
Source Project: cordova-amazon-fireos   Source File: HttpTransport.java    License: Apache License 2.0 6 votes vote down vote up
@Override public InputStream getTransferStream(CacheRequest cacheRequest) throws IOException {
  if (!httpEngine.hasResponseBody()) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine, 0);
  }

  if (httpEngine.responseHeaders.isChunked()) {
    return new ChunkedInputStream(socketIn, cacheRequest, this);
  }

  if (httpEngine.responseHeaders.getContentLength() != -1) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine,
        httpEngine.responseHeaders.getContentLength());
  }

  // Wrap the input stream from the connection (rather than just returning
  // "socketIn" directly here), so that we can control its use after the
  // reference escapes.
  return new UnknownLengthHttpInputStream(socketIn, cacheRequest, httpEngine);
}
 
Example 5
Source Project: phonegapbootcampsite   Source File: HttpTransport.java    License: MIT License 6 votes vote down vote up
@Override public InputStream getTransferStream(CacheRequest cacheRequest) throws IOException {
  if (!httpEngine.hasResponseBody()) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine, 0);
  }

  if (httpEngine.responseHeaders.isChunked()) {
    return new ChunkedInputStream(socketIn, cacheRequest, this);
  }

  if (httpEngine.responseHeaders.getContentLength() != -1) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine,
        httpEngine.responseHeaders.getContentLength());
  }

  // Wrap the input stream from the connection (rather than just returning
  // "socketIn" directly here), so that we can control its use after the
  // reference escapes.
  return new UnknownLengthHttpInputStream(socketIn, cacheRequest, httpEngine);
}
 
Example 6
Source Project: bluemix-parking-meter   Source File: HttpTransport.java    License: MIT License 6 votes vote down vote up
@Override public InputStream getTransferStream(CacheRequest cacheRequest) throws IOException {
  if (!httpEngine.hasResponseBody()) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine, 0);
  }

  if (httpEngine.responseHeaders.isChunked()) {
    return new ChunkedInputStream(socketIn, cacheRequest, this);
  }

  if (httpEngine.responseHeaders.getContentLength() != -1) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine,
        httpEngine.responseHeaders.getContentLength());
  }

  // Wrap the input stream from the connection (rather than just returning
  // "socketIn" directly here), so that we can control its use after the
  // reference escapes.
  return new UnknownLengthHttpInputStream(socketIn, cacheRequest, httpEngine);
}
 
Example 7
Source Project: reader   Source File: HttpTransport.java    License: MIT License 6 votes vote down vote up
@Override public InputStream getTransferStream(CacheRequest cacheRequest) throws IOException {
  if (!httpEngine.hasResponseBody()) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine, 0);
  }

  if (httpEngine.responseHeaders.isChunked()) {
    return new ChunkedInputStream(socketIn, cacheRequest, this);
  }

  if (httpEngine.responseHeaders.getContentLength() != -1) {
    return new FixedLengthInputStream(socketIn, cacheRequest, httpEngine,
        httpEngine.responseHeaders.getContentLength());
  }

  // Wrap the input stream from the connection (rather than just returning
  // "socketIn" directly here), so that we can control its use after the
  // reference escapes.
  return new UnknownLengthHttpInputStream(socketIn, cacheRequest, httpEngine);
}
 
Example 8
public HttpInputStream (InputStream is, CacheRequest cacheRequest) {
    super (is);
    this.cacheRequest = cacheRequest;
    try {
        this.outputStream = cacheRequest.getBody();
    } catch (IOException ioex) {
        this.cacheRequest.abort();
        this.cacheRequest = null;
        this.outputStream = null;
    }
}
 
Example 9
public HttpInputStream (InputStream is, CacheRequest cacheRequest) {
    super (is);
    this.cacheRequest = cacheRequest;
    try {
        this.outputStream = cacheRequest.getBody();
    } catch (IOException ioex) {
        this.cacheRequest.abort();
        this.cacheRequest = null;
        this.outputStream = null;
    }
}
 
Example 10
@Override
public CacheRequest put (URI           uri,
                         URLConnection conn)
    throws IOException
{
    URL url = uri.toURL();
    service.loadResource(url, null, service.getDefaultProgressWindow());

    return null;
}
 
Example 11
public HttpInputStream (InputStream is, CacheRequest cacheRequest) {
    super (is);
    this.cacheRequest = cacheRequest;
    try {
        this.outputStream = cacheRequest.getBody();
    } catch (IOException ioex) {
        this.cacheRequest.abort();
        this.cacheRequest = null;
        this.outputStream = null;
    }
}
 
Example 12
Source Project: Bytecoder   Source File: HttpURLConnection.java    License: Apache License 2.0 5 votes vote down vote up
public HttpInputStream (InputStream is, CacheRequest cacheRequest) {
    super (is);
    this.cacheRequest = cacheRequest;
    try {
        this.outputStream = cacheRequest.getBody();
    } catch (IOException ioex) {
        this.cacheRequest.abort();
        this.cacheRequest = null;
        this.outputStream = null;
    }
}
 
Example 13
public HttpInputStream (InputStream is, CacheRequest cacheRequest) {
    super (is);
    this.cacheRequest = cacheRequest;
    try {
        this.outputStream = cacheRequest.getBody();
    } catch (IOException ioex) {
        this.cacheRequest.abort();
        this.cacheRequest = null;
        this.outputStream = null;
    }
}
 
Example 14
Source Project: openjdk-jdk9   Source File: TestCache.java    License: GNU General Public License v2.0 5 votes vote down vote up
public synchronized CacheRequest put(URI uri, URLConnection conn)
throws IOException {
    System.out.println("put: " + uri);
    Thread.currentThread().dumpStack();
    URL url = uri.toURL();
    return new DeployCacheRequest(url, conn);

}
 
Example 15
Source Project: reader   Source File: AbstractHttpInputStream.java    License: MIT License 5 votes vote down vote up
AbstractHttpInputStream(InputStream in, HttpEngine httpEngine, CacheRequest cacheRequest)
    throws IOException {
  this.in = in;
  this.httpEngine = httpEngine;

  OutputStream cacheBody = cacheRequest != null ? cacheRequest.getBody() : null;

  // some apps return a null body; for compatibility we treat that like a null cache request
  if (cacheBody == null) {
    cacheRequest = null;
  }

  this.cacheBody = cacheBody;
  this.cacheRequest = cacheRequest;
}
 
Example 16
Source Project: reader   Source File: HttpTransport.java    License: MIT License 5 votes vote down vote up
public FixedLengthInputStream(InputStream is, CacheRequest cacheRequest, HttpEngine httpEngine,
    long length) throws IOException {
  super(is, httpEngine, cacheRequest);
  bytesRemaining = length;
  if (bytesRemaining == 0) {
    endOfInput();
  }
}
 
Example 17
AbstractHttpInputStream(InputStream in, HttpEngine httpEngine, CacheRequest cacheRequest)
    throws IOException {
  this.in = in;
  this.httpEngine = httpEngine;

  OutputStream cacheBody = cacheRequest != null ? cacheRequest.getBody() : null;

  // some apps return a null body; for compatibility we treat that like a null cache request
  if (cacheBody == null) {
    cacheRequest = null;
  }

  this.cacheBody = cacheBody;
  this.cacheRequest = cacheRequest;
}
 
Example 18
public HttpInputStream (InputStream is, CacheRequest cacheRequest) {
    super (is);
    this.cacheRequest = cacheRequest;
    try {
        this.outputStream = cacheRequest.getBody();
    } catch (IOException ioex) {
        this.cacheRequest.abort();
        this.cacheRequest = null;
        this.outputStream = null;
    }
}
 
Example 19
Source Project: openjdk-8-source   Source File: TestCache.java    License: GNU General Public License v2.0 5 votes vote down vote up
public synchronized CacheRequest put(URI uri, URLConnection conn)
throws IOException {
    System.out.println("put: " + uri);
    Thread.currentThread().dumpStack();
    URL url = uri.toURL();
    return new DeployCacheRequest(url, conn);

}
 
Example 20
Source Project: phonegapbootcampsite   Source File: AbstractHttpInputStream.java    License: MIT License 5 votes vote down vote up
AbstractHttpInputStream(InputStream in, HttpEngine httpEngine, CacheRequest cacheRequest)
    throws IOException {
  this.in = in;
  this.httpEngine = httpEngine;

  OutputStream cacheBody = cacheRequest != null ? cacheRequest.getBody() : null;

  // some apps return a null body; for compatibility we treat that like a null cache request
  if (cacheBody == null) {
    cacheRequest = null;
  }

  this.cacheBody = cacheBody;
  this.cacheRequest = cacheRequest;
}
 
Example 21
Source Project: jdk8u_jdk   Source File: HttpURLConnection.java    License: GNU General Public License v2.0 5 votes vote down vote up
public HttpInputStream (InputStream is, CacheRequest cacheRequest) {
    super (is);
    this.cacheRequest = cacheRequest;
    try {
        this.outputStream = cacheRequest.getBody();
    } catch (IOException ioex) {
        this.cacheRequest.abort();
        this.cacheRequest = null;
        this.outputStream = null;
    }
}
 
Example 22
Source Project: jdk8u_jdk   Source File: TestCache.java    License: GNU General Public License v2.0 5 votes vote down vote up
public synchronized CacheRequest put(URI uri, URLConnection conn)
throws IOException {
    System.out.println("put: " + uri);
    Thread.currentThread().dumpStack();
    URL url = uri.toURL();
    return new DeployCacheRequest(url, conn);

}
 
Example 23
Source Project: L.TileLayer.Cordova   Source File: HttpTransport.java    License: MIT License 5 votes vote down vote up
public FixedLengthInputStream(InputStream is, CacheRequest cacheRequest, HttpEngine httpEngine,
    long length) throws IOException {
  super(is, httpEngine, cacheRequest);
  bytesRemaining = length;
  if (bytesRemaining == 0) {
    endOfInput();
  }
}
 
Example 24
Source Project: jdk8u-jdk   Source File: HttpURLConnection.java    License: GNU General Public License v2.0 5 votes vote down vote up
public HttpInputStream (InputStream is, CacheRequest cacheRequest) {
    super (is);
    this.cacheRequest = cacheRequest;
    try {
        this.outputStream = cacheRequest.getBody();
    } catch (IOException ioex) {
        this.cacheRequest.abort();
        this.cacheRequest = null;
        this.outputStream = null;
    }
}
 
Example 25
Source Project: android-discourse   Source File: HttpTransport.java    License: Apache License 2.0 5 votes vote down vote up
public FixedLengthInputStream(InputStream is, CacheRequest cacheRequest, HttpEngine httpEngine, int length) throws IOException {
    super(is, httpEngine, cacheRequest);
    bytesRemaining = length;
    if (bytesRemaining == 0) {
        endOfInput();
    }
}
 
Example 26
public HttpInputStream (InputStream is, CacheRequest cacheRequest) {
    super (is);
    this.cacheRequest = cacheRequest;
    try {
        this.outputStream = cacheRequest.getBody();
    } catch (IOException ioex) {
        this.cacheRequest.abort();
        this.cacheRequest = null;
        this.outputStream = null;
    }
}
 
Example 27
Source Project: jdk8u-dev-jdk   Source File: TestCache.java    License: GNU General Public License v2.0 5 votes vote down vote up
public synchronized CacheRequest put(URI uri, URLConnection conn)
throws IOException {
    System.out.println("put: " + uri);
    Thread.currentThread().dumpStack();
    URL url = uri.toURL();
    return new DeployCacheRequest(url, conn);

}
 
Example 28
Source Project: cordova-amazon-fireos   Source File: HttpTransport.java    License: Apache License 2.0 5 votes vote down vote up
public FixedLengthInputStream(InputStream is, CacheRequest cacheRequest, HttpEngine httpEngine,
    long length) throws IOException {
  super(is, httpEngine, cacheRequest);
  bytesRemaining = length;
  if (bytesRemaining == 0) {
    endOfInput();
  }
}
 
Example 29
Source Project: bluemix-parking-meter   Source File: AbstractHttpInputStream.java    License: MIT License 5 votes vote down vote up
AbstractHttpInputStream(InputStream in, HttpEngine httpEngine, CacheRequest cacheRequest)
    throws IOException {
  this.in = in;
  this.httpEngine = httpEngine;

  OutputStream cacheBody = cacheRequest != null ? cacheRequest.getBody() : null;

  // some apps return a null body; for compatibility we treat that like a null cache request
  if (cacheBody == null) {
    cacheRequest = null;
  }

  this.cacheBody = cacheBody;
  this.cacheRequest = cacheRequest;
}
 
Example 30
Source Project: bluemix-parking-meter   Source File: HttpTransport.java    License: MIT License 5 votes vote down vote up
public FixedLengthInputStream(InputStream is, CacheRequest cacheRequest, HttpEngine httpEngine,
    long length) throws IOException {
  super(is, httpEngine, cacheRequest);
  bytesRemaining = length;
  if (bytesRemaining == 0) {
    endOfInput();
  }
}