WebResourceRequest.java revision d72e7ba1c04b2f7b128c5710607a72867b73bf1c
1/* 2 * Copyright (C) 2014 The Android Open Source Project 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 17package android.webkit; 18 19import android.net.Uri; 20 21import java.io.InputStream; 22import java.util.Map; 23 24/** 25 * Encompasses parameters to the {@link WebViewClient#shouldInterceptRequest} method. 26 */ 27public interface WebResourceRequest { 28 /** 29 * Gets the URL for which the resource request was made. 30 * 31 * @return the URL for which the resource request was made. 32 */ 33 Uri getUrl(); 34 35 /** 36 * Gets whether the request was made for the main frame. 37 * 38 * @return whether the request was made for the main frame. Will be false for iframes, 39 * for example. 40 */ 41 boolean isForMainFrame(); 42 43 /** 44 * Gets whether a gesture was associated with the request. 45 * <p> 46 * <strong>IMPORTANT:</strong> 47 * This should not be used to implement any form of security. It is possible for the content 48 * to spoof this. 49 * 50 * @return whether a gesture was associated with the request. 51 */ 52 boolean hasUserGestureInsecure(); 53 54 /** 55 * Gets the method associated with the request, for example "GET". 56 * 57 * @return the method associated with the request. 58 */ 59 String getMethod(); 60 61 /** 62 * Gets the headers associated with the request. These are represented as a mapping of header 63 * name to header value. 64 * 65 * @return the headers associated with the request. 66 */ 67 Map<String, String> getRequestHeaders(); 68} 69