forked from CinemaMod/java-cef
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCefResourceHandler.java
More file actions
59 lines (53 loc) · 2.74 KB
/
CefResourceHandler.java
File metadata and controls
59 lines (53 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
package org.cef.handler;
import org.cef.callback.CefCallback;
import org.cef.misc.IntRef;
import org.cef.misc.StringRef;
import org.cef.network.CefCookie;
import org.cef.network.CefRequest;
import org.cef.network.CefResponse;
/**
* Implement this interface to handle custom resource requests. The methods of
* this class will always be called on the IO thread.
*/
public interface CefResourceHandler {
/**
* Begin processing the request.
* @param request The request itself. Cannot be modified in this callback. Instance only valid
* within the scope of this method.
* @param callback Callback to continue or cancel the request.
* @return True to handle the request and call CefCallback.Continue() once the response header
* information is available.
*/
boolean processRequest(CefRequest request, CefCallback callback);
/**
* Retrieve response header information. If the response length is not known set
* |responseLength| to -1 and readResponse() will be called until it returns false. If the
* response length is known set |responseLength| to a positive value and readResponse() will be
* called until it returns false or the specified number of bytes have been read. Use the
* |response| object to set the mime type, http status code and other optional header values.
* @param response The request response that should be returned. Instance only valid within the
* scope of this method.
* @param responseLength Optionally set the response length if known.
* @param redirectUrl Optionally redirect the request to a new URL.
*/
void getResponseHeaders(CefResponse response, IntRef responseLength, StringRef redirectUrl);
/**
* Read response data. If data is available immediately copy up to |bytesToRead| bytes into
* |dataOut|, set |bytesRead| to the number of bytes copied, and return true. To read the data
* at a later time set |bytesRead| to 0, return true and call CefCallback.Continue() when the
* data is available. To indicate response completion return false.
* @param dataOut Write data to this buffer.
* @param bytesToRead Size of the buffer.
* @param bytesRead Number of bytes written to the buffer.
* @param callback Callback to execute if data will be available asynchronously.
* @return True if more data is or will be available.
*/
boolean readResponse(byte[] dataOut, int bytesToRead, IntRef bytesRead, CefCallback callback);
/**
* Request processing has been canceled.
*/
void cancel();
}