Class CefResourceRequestHandlerAdapter

  • All Implemented Interfaces:
    CefResourceRequestHandler

    public abstract class CefResourceRequestHandlerAdapter
    extends java.lang.Object
    implements CefResourceRequestHandler
    An abstract adapter class for receiving browser request events. The methods in this class are empty. This class exists as convenience for creating handler objects.
    • Constructor Detail

      • CefResourceRequestHandlerAdapter

        public CefResourceRequestHandlerAdapter()
    • Method Detail

      • getCookieAccessFilter

        public CefCookieAccessFilter getCookieAccessFilter​(CefBrowser browser,
                                                           CefFrame frame,
                                                           CefRequest request)
        Description copied from interface: CefResourceRequestHandler
        Called on the IO thread before a resource is loaded. The |browser| and |frame| values represent the source of the request, and may be null for requests originating from service workers or CefURLRequest.
        Specified by:
        getCookieAccessFilter in interface CefResourceRequestHandler
        Parameters:
        browser - The corresponding browser.
        frame - The frame generating the event. Instance only valid within the scope of this method.
        request - The request itself. Cannot be modified in this callback. Instance only valid within the scope of this method.
        Returns:
        A CefCookieAccessFilter instance or null.
      • onBeforeResourceLoad

        public boolean onBeforeResourceLoad​(CefBrowser browser,
                                            CefFrame frame,
                                            CefRequest request)
        Description copied from interface: CefResourceRequestHandler
        Called on the IO thread before a resource request is loaded. The |browser| and |frame| values represent the source of the request, and may be null for requests originating from service workers or CefURLRequest. To redirect or change the resource load optionally modify |request|. Modification of the request URL will be treated as a redirect.
        Specified by:
        onBeforeResourceLoad in interface CefResourceRequestHandler
        Parameters:
        browser - The corresponding browser.
        frame - The frame generating the event. Instance only valid within the scope of this method.
        request - The request itself. May be modified in this callback. Instance only valid within the scope of this method.
        Returns:
        To cancel the request return true otherwise return false.
      • getResourceHandler

        public CefResourceHandler getResourceHandler​(CefBrowser browser,
                                                     CefFrame frame,
                                                     CefRequest request)
        Description copied from interface: CefResourceRequestHandler
        Called on the IO thread before a resource is loaded. The |browser| and |frame| values represent the source of the request, and may be null for requests originating from service workers or CefURLRequest.
        Specified by:
        getResourceHandler in interface CefResourceRequestHandler
        Parameters:
        browser - The corresponding browser.
        frame - The frame generating the event. Instance only valid within the scope of this method.
        request - The request itself. Cannot be modified in this callback. Instance only valid within the scope of this method.
        Returns:
        A CefResourceHandler instance or null.
      • onResourceRedirect

        public void onResourceRedirect​(CefBrowser browser,
                                       CefFrame frame,
                                       CefRequest request,
                                       CefResponse response,
                                       StringRef new_url)
        Description copied from interface: CefResourceRequestHandler
        Called on the IO thread when a resource load is redirected. The |browser| and |frame| values represent the source of the request, and may be null for requests originating from service workers or CefURLRequest. The |request| parameter will contain the old URL and other request-related information.
        Specified by:
        onResourceRedirect in interface CefResourceRequestHandler
        Parameters:
        browser - The corresponding browser.
        frame - The frame generating the event. Instance only valid within the scope of this method.
        request - The request itself. Cannot be modified in this callback. Instance only valid within the scope of this method.
        response - The response that resulted in the redirect. Cannot be modified in this callback. Instance only valid within the scope of this method.
        new_url - Contains the new URL and can be changed if desired.
      • onResourceResponse

        public boolean onResourceResponse​(CefBrowser browser,
                                          CefFrame frame,
                                          CefRequest request,
                                          CefResponse response)
        Description copied from interface: CefResourceRequestHandler
        Called on the IO thread when a resource response is received. The |browser| and |frame| values represent the source of the request, and may be null for requests originating from service workers or CefURLRequest. To allow the resource load to proceed without modification return false. To redirect or retry the resource load optionally modify |request| and return true. Modification of the request URL will be treated as a redirect. Requests handled using the default network loader cannot be redirected in this callback.
        Specified by:
        onResourceResponse in interface CefResourceRequestHandler
        Parameters:
        browser - The corresponding browser.
        frame - The frame generating the event. Instance only valid within the scope of this method.
        request - The request itself. May be modified in this callback. Instance only valid within the scope of this method.
        response - The request response. Cannot be modified in this callback. Instance only valid within the scope of this method.
        Returns:
        True if |request| was modified or false otherwise
      • onResourceLoadComplete

        public void onResourceLoadComplete​(CefBrowser browser,
                                           CefFrame frame,
                                           CefRequest request,
                                           CefResponse response,
                                           CefURLRequest.Status status,
                                           long receivedContentLength)
        Description copied from interface: CefResourceRequestHandler
        Called on the IO thread when a resource load has completed. The |browser| and |frame| values represent the source of the request, and may be null for requests originating from service workers or CefURLRequest. This method will be called for all requests, including requests that are aborted due to CEF shutdown or destruction of the associated browser. In cases where the associated browser is destroyed this callback may arrive after the CefLifeSpanHandler.onBeforeClose callback for that browser. The CefFrame.isValid method can be used to test for this situation, and care should be taken not to call |browser| or |frame| methods that modify state (like loadURL, sendProcessMessage, etc.) if the frame is invalid.
        Specified by:
        onResourceLoadComplete in interface CefResourceRequestHandler
        Parameters:
        browser - The corresponding browser.
        frame - The frame generating the event. Instance only valid within the scope of this method.
        request - The request itself. Cannot be modified in this callback. Instance only valid within the scope of this method.
        response - The request response. Cannot be modified in this callback. Instance only valid within the scope of this method.
        status - The load completion status.
        receivedContentLength - The number of bytes read.
      • onProtocolExecution

        public void onProtocolExecution​(CefBrowser browser,
                                        CefFrame frame,
                                        CefRequest request,
                                        BoolRef allowOsExecution)
        Description copied from interface: CefResourceRequestHandler
        Called on the IO thread to handle requests for URLs with an unknown protocol component. The |browser| and |frame| values represent the source of the request, and may be null for requests originating from service workers or CefURLRequest. SECURITY WARNING: YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
        Specified by:
        onProtocolExecution in interface CefResourceRequestHandler
        Parameters:
        browser - The corresponding browser.
        frame - The frame generating the event. Instance only valid within the scope of this method.
        request - The request itself. Cannot be modified in this callback. Instance only valid within the scope of this method.
        allowOsExecution - Set to true to attempt execution via the registered OS protocol handler, if any.