1 /* 2 * Copyright (C) 2013 Square, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.squareup.okhttp.internal.http; 17 18 import com.squareup.okhttp.OkResponseCache; 19 import com.squareup.okhttp.ResponseSource; 20 import java.io.IOException; 21 import java.net.CacheRequest; 22 import java.net.CacheResponse; 23 import java.net.HttpURLConnection; 24 import java.net.ResponseCache; 25 import java.net.URI; 26 import java.net.URLConnection; 27 import java.util.List; 28 import java.util.Map; 29 30 public final class OkResponseCacheAdapter implements OkResponseCache { 31 private final ResponseCache responseCache; 32 public OkResponseCacheAdapter(ResponseCache responseCache) { 33 this.responseCache = responseCache; 34 } 35 36 @Override public CacheResponse get(URI uri, String requestMethod, 37 Map<String, List<String>> requestHeaders) throws IOException { 38 return responseCache.get(uri, requestMethod, requestHeaders); 39 } 40 41 @Override public CacheRequest put(URI uri, URLConnection urlConnection) throws IOException { 42 return responseCache.put(uri, urlConnection); 43 } 44 45 @Override public void maybeRemove(String requestMethod, URI uri) throws IOException { 46 } 47 48 @Override public void update(CacheResponse conditionalCacheHit, HttpURLConnection connection) 49 throws IOException { 50 } 51 52 @Override public void trackConditionalCacheHit() { 53 } 54 55 @Override public void trackResponse(ResponseSource source) { 56 } 57 } 58