Package org.cef.handler
Class CefResourceHandlerAdapter
- java.lang.Object
-
- org.cef.handler.CefResourceHandlerAdapter
-
- All Implemented Interfaces:
CefResourceHandler
public abstract class CefResourceHandlerAdapter extends java.lang.Object implements CefResourceHandler
An abstract adapter class for receiving resource requests. The methods in this class are empty. This class exists as convenience for creating handler objects.
-
-
Constructor Summary
Constructors Constructor Description CefResourceHandlerAdapter()
-
Method Summary
All Methods Instance Methods Concrete 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
public boolean processRequest(CefRequest request, CefCallback callback)
Description copied from interface:CefResourceHandler
Begin processing the request.- Specified by:
processRequest
in interfaceCefResourceHandler
- 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
public void getResponseHeaders(CefResponse response, IntRef responseLength, StringRef redirectUrl)
Description copied from interface:CefResourceHandler
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.- Specified by:
getResponseHeaders
in interfaceCefResourceHandler
- 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
public boolean readResponse(byte[] dataOut, int bytesToRead, IntRef bytesRead, CefCallback callback)
Description copied from interface:CefResourceHandler
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.- Specified by:
readResponse
in interfaceCefResourceHandler
- 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
public void cancel()
Description copied from interface:CefResourceHandler
Request processing has been canceled.- Specified by:
cancel
in interfaceCefResourceHandler
-
-