Package org.cef.handler
Interface CefResourceHandler
-
- All Known Implementing Classes:
CefResourceHandlerAdapter
public interface CefResourceHandler
Implement this interface to handle custom resource requests. The methods of this class will always be called on the IO thread.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cancel()
Request processing has been canceled.void
getResponseHeaders(CefResponse response, IntRef responseLength, StringRef redirectUrl)
Retrieve response header information.boolean
processRequest(CefRequest request, CefCallback callback)
Begin processing the request.boolean
readResponse(byte[] dataOut, int bytesToRead, IntRef bytesRead, CefCallback callback)
Read response data.
-
-
-
Method Detail
-
processRequest
boolean processRequest(CefRequest request, CefCallback callback)
Begin processing the request.- Parameters:
request
- The request itself. Cannot be modified in this callback. Instance only valid within the scope of this method.callback
- Callback to continue or cancel the request.- Returns:
- True to handle the request and call CefCallback.Continue() once the response header information is available.
-
getResponseHeaders
void getResponseHeaders(CefResponse response, IntRef responseLength, StringRef redirectUrl)
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.- Parameters:
response
- The request response that should be returned. Instance only valid within the scope of this method.responseLength
- Optionally set the response length if known.redirectUrl
- Optionally redirect the request to a new URL.
-
readResponse
boolean readResponse(byte[] dataOut, int bytesToRead, IntRef bytesRead, CefCallback callback)
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.- Parameters:
dataOut
- Write data to this buffer.bytesToRead
- Size of the buffer.bytesRead
- Number of bytes written to the buffer.callback
- Callback to execute if data will be available asynchronously.- Returns:
- True if more data is or will be available.
-
cancel
void cancel()
Request processing has been canceled.
-
-