Home | History | Annotate | Download | only in webkit
      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 
     17 package android.webkit;
     18 
     19 import android.net.Uri;
     20 
     21 import java.util.Map;
     22 
     23 /**
     24  * Encompasses parameters to the {@link WebViewClient#shouldInterceptRequest} method.
     25  */
     26 public interface WebResourceRequest {
     27     /**
     28      * Gets the URL for which the resource request was made.
     29      *
     30      * @return the URL for which the resource request was made.
     31      */
     32     Uri getUrl();
     33 
     34     /**
     35      * Gets whether the request was made for the main frame.
     36      *
     37      * @return whether the request was made for the main frame. Will be false for iframes,
     38      *         for example.
     39      */
     40     boolean isForMainFrame();
     41 
     42     /**
     43      * Gets whether the request was a result of a server-side redirect.
     44      *
     45      * @return whether the request was a result of a server-side redirect.
     46      */
     47     boolean isRedirect();
     48 
     49     /**
     50      * Gets whether a gesture (such as a click) was associated with the request.
     51      * For security reasons in certain situations this method may return false even though the
     52      * sequence of events which caused the request to be created was initiated by a user gesture.
     53      *
     54      * @return whether a gesture was associated with the request.
     55      */
     56     boolean hasGesture();
     57 
     58     /**
     59      * Gets the method associated with the request, for example "GET".
     60      *
     61      * @return the method associated with the request.
     62      */
     63     String getMethod();
     64 
     65     /**
     66      * Gets the headers associated with the request. These are represented as a mapping of header
     67      * name to header value.
     68      *
     69      * @return the headers associated with the request.
     70      */
     71     Map<String, String> getRequestHeaders();
     72 }
     73