org.apache.http.impl.client.cache
Class ResponseCachingPolicy

java.lang.Object
  extended by org.apache.http.impl.client.cache.ResponseCachingPolicy

@Immutable
public class ResponseCachingPolicy
extends Object

Determines if an HttpResponse can be cached.

Since:
4.1

Constructor Summary
ResponseCachingPolicy(int maxObjectSizeBytes)
          Define a cache policy that limits the size of things that should be stored in the cache to a maximum of HttpResponse bytes in size.
 
Method Summary
protected  boolean hasCacheControlParameterFrom(HttpResponse response, String[] params)
           
protected  boolean isExplicitlyCacheable(HttpResponse response)
           
protected  boolean isExplicitlyNonCacheable(HttpResponse response)
           
 boolean isResponseCacheable(HttpRequest request, HttpResponse response)
          Determine if the HttpResponse gotten from the origin is a cacheable response.
 boolean isResponseCacheable(String httpMethod, HttpResponse response)
          Determines if an HttpResponse can be cached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseCachingPolicy

public ResponseCachingPolicy(int maxObjectSizeBytes)
Define a cache policy that limits the size of things that should be stored in the cache to a maximum of HttpResponse bytes in size.

Parameters:
maxObjectSizeBytes - the size to limit items into the cache
Method Detail

isResponseCacheable

public boolean isResponseCacheable(String httpMethod,
                                   HttpResponse response)
Determines if an HttpResponse can be cached.

Parameters:
httpMethod - What type of request was this, a GET, PUT, other?
response - The origin response
Returns:
true if response is cacheable

isExplicitlyNonCacheable

protected boolean isExplicitlyNonCacheable(HttpResponse response)

hasCacheControlParameterFrom

protected boolean hasCacheControlParameterFrom(HttpResponse response,
                                               String[] params)

isExplicitlyCacheable

protected boolean isExplicitlyCacheable(HttpResponse response)

isResponseCacheable

public boolean isResponseCacheable(HttpRequest request,
                                   HttpResponse response)
Determine if the HttpResponse gotten from the origin is a cacheable response.

Parameters:
request - the HttpRequest that generated an origin hit
response - the HttpResponse from the origin
Returns:
true if response is cacheable


Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.