artiya4u / google-http-java-client

Automatically exported from code.google.com/p/google-http-java-client
0 stars 0 forks source link

CacheContral not work when only-if-cached #222

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-http-java-client (e.g. 1.15.0-rc)?
1.15.0

Java environment (e.g. Java 6, Android 2.3, App Engine)?
Java 6, Android 4.0.3+

Describe the problem.

private static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
HttpRequestFactory requestFactory = HTTP_TRANSPORT.createRequestFactory();
HttpRequest request = requestFactory.buildGetRequest(new GenericUrl(url));
// If offline
request.getHeaders().setCacheControl("only-if-cached");
HttpResponse response = request.execute()

If use URLConnection directly, will get inputstream from the cache

google-http-java-client throws HttpResponseException: 504 Gateway Timeout

Original issue reported on code.google.com by nyssa...@gmail.com on 17 May 2013 at 10:16

GoogleCodeExporter commented 9 years ago
I made a mistake, the error not 504 Gateway, it's "No address associated with 
hostname"

Original comment by nyssa...@gmail.com on 17 May 2013 at 10:44