Example usage for org.apache.http.client.cache HttpCacheEntry getStatusLine

List of usage examples for org.apache.http.client.cache HttpCacheEntry getStatusLine

Introduction

In this page you can find the example usage for org.apache.http.client.cache HttpCacheEntry getStatusLine.

Prototype

public StatusLine getStatusLine() 

Source Link

Document

Returns the StatusLine from the origin HttpResponse .

Usage

From source file:it.tidalwave.bluemarine2.downloader.impl.SimpleHttpCacheStorage.java

/*******************************************************************************************************************
 *
 * //w w w .ja v a  2s.c  om
 *
 ******************************************************************************************************************/
@Nonnull
private static HttpResponse responseFrom(final @Nonnull HttpCacheEntry entry) {
    final BasicHttpResponse response = new BasicHttpResponse(entry.getStatusLine());
    response.setHeaders(entry.getAllHeaders());
    return response;
}

From source file:gr.wavesoft.webng.io.cache.DiskCacheStorage.java

private byte[] serialize(HttpCacheEntry o) {
    ObjectOutputStream oos = null;
    try {//from   w ww.  j  a v a 2 s .c om

        // Setut vars
        ByteArrayOutputStream bos = new ByteArrayOutputStream();

        // Dump object
        oos = new ObjectOutputStream(bos);
        oos.writeLong(o.getRequestDate().getTime());
        oos.writeLong(o.getResponseDate().getTime());
        oos.writeObject(o.getStatusLine());
        oos.writeObject(o.getAllHeaders());

        // Complete stream
        oos.close();

        // Get byte array
        return bos.toByteArray();

    } catch (IOException ex) {
        systemLogger.except(ex);
    } finally {
        try {
            oos.close();
        } catch (IOException ex) {
            systemLogger.error("Error closing serialization buffer ", ex);
        }
    }
    return null;

}

From source file:org.apache.http.impl.client.cache.BasicHttpCache.java

HttpCacheEntry doGetUpdatedParentEntry(final String requestId, final HttpCacheEntry existing,
        final HttpCacheEntry entry, final String variantKey, final String variantCacheKey) throws IOException {
    HttpCacheEntry src = existing;
    if (src == null) {
        src = entry;// ww  w .j  a v a  2s  .c  om
    }

    Resource resource = resourceFactory.copy(requestId, src.getResource());
    Map<String, String> variantMap = new HashMap<String, String>(src.getVariantMap());
    variantMap.put(variantKey, variantCacheKey);
    return new HttpCacheEntry(src.getRequestDate(), src.getResponseDate(), src.getStatusLine(),
            src.getAllHeaders(), resource, variantMap);
}