Click or drag to resize
ResourceHandler Class
Version 51.0.0
Default implementation of IResourceHandler. This latest implementation provides some simplification, at a minimum you only need to override ProcessRequestAsync. See the project source on GitHub for working examples. used to implement a custom request handler interface. The methods of this class will always be called on the IO thread. Static helper methods are included like FromStream and FromString that make dealing with fixed resources easy.
Inheritance Hierarchy
SystemObject
  CefSharpResourceHandler

Namespace: CefSharp
Assembly: CefSharp (in CefSharp.dll) Version: 51.0.0.0 (51.0.0.0)
Syntax
public class ResourceHandler : IResourceHandler, 
	IDisposable

The ResourceHandler type exposes the following members.

Constructors
  NameDescription
Public methodResourceHandler
Default Constructor
Top
Properties
  NameDescription
Public propertyAutoDisposeStream
When true the Stream will be Disposed when this instance is Disposed. The default value for this property is false.
Public propertyFilePath
Path of the underlying file
Public propertyHeaders
Gets or sets the headers.
Public propertyMimeType
Gets or sets the Mime Type.
Public propertyResponseLength
Gets or sets ResponseLength, when you know the size of your Stream (Response) set this property. This is optional. If you use a MemoryStream and don't provide a value here then it will be cast and it's size used
Public propertyStatusCode
Gets or sets the http status code.
Public propertyStatusText
Gets or sets the status text.
Public propertyStream
Gets or sets the resource stream.
Public propertyType
Specify which type of resource handle represnets
Top
Methods
  NameDescription
Public methodCancel
Called if the request is cancelled
Public methodDispose
Dispose of resources here
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodStatic memberFromFileName
Gets the resource from the file.
Public methodStatic memberFromStream
Gets the resource from a stream.
Public methodStatic memberFromString(String, String)
Gets the resource from the string.
Public methodStatic memberFromString(String, Encoding, Boolean, String)
Gets a ResourceHandler that represents a string. Without a Preamble, Cef will use BrowserSettings.DefaultEncoding to load the html.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodStatic memberGetMimeType
Gets the MIME type of the content.
Public methodGetResponse
Populate the response stream, response length. When this method is called the response should be fully populated with data. It is possible to redirect to another url at this point in time. NOTE: It's no longer manditory to implement this method, you can simply populate the properties of this instance and they will be set by the default implementation.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodProcessRequestAsync
Begin processing the request. If you have the data in memory you can execute the callback immediately and return true. For Async processing you would typically spawn a Task to perform processing, then return true. When the processing is complete execute callback.Continue(); In your processing Task, simply set the StatusCode, StatusText, MimeType, ResponseLength and Stream
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
See Also