-
Notifications
You must be signed in to change notification settings - Fork 2
Custom Scheme Handling
Chromely supports CEF3 network request handling via the scheme handler approach. This allows for Ajax XMLHttpRequest (XHR) request handling.
For more info on CEF scheme handling please check CEF Request Handling.
Both CefGlue and CefSharp apps can be configured with custom scheme handlers. This is done in ChromelyConfiguration scheme registration method (RegisterSchemeHandler). In most cases the default scheme handler would be enough.
A custom scheme handler would require:
- The scheme name - HTTP, HTTPS and custom schemes
- The domain name - chromely.com, anydomain, google.com
- The handler factory (the actual scheme handler object must be defined in the factory).
To register a custom scheme handler please check - Configuration.
The custom scheme handler is located here.
The custom scheme handler is located here.
A complete sample url will be http://chromely.com/democontroller/movies
- where:
- scheme name - http
- domain name - chromely.com
- controller - democontroller
- action - movies
The route path "democontroller/movies" must be registered and map to a route resource. For more info please check - Restful Resources
var http = new XMLHttpRequest();
var url = "http://chromely.com/democontroller/movies";
http.open("GET", url, true);
http.onreadystatechange = function () {
if (http.readyState == 4 && http.status == 200) {
var jsonData = JSON.parse(http.responseText);
..... process response
}
}
http.send();
var moviesJson = [
{ Id: 1, Title: "The Shawshank Redemption", Year: 1994, Votes: 678790, Rating: 9.2 },
{ Id: 2, Title: "The Godfather", Year: 1972, votes: 511495, Rating: 9.2 },
{ Id: 3, Title: "The Godfather: Part II", Year: 1974, Votes: 319352, Rating: 9.0 },
{ Id: 4, Title: "The Good, the Bad and the Ugly", Year: 1966, Votes: 213030, Rating: 8.9 },
{ Id: 5, Title: "My Fair Lady", Year: 1964, Votes: 533848, Rating: 8.9 },
{ Id: 6, Title: "12 Angry Men", Year: 1957, Votes: 164558, Rating: 8.9 }
];
var http = new XMLHttpRequest();
var url = "http://chromely.com/democontroller/savemovies";
http.open("POST", url, true);
http.setRequestHeader("Content-type", "application/json");
http.onreadystatechange = function () {
if (http.readyState == 4 && http.status == 200) {
var jsonData = JSON.parse(http.responseText);
..... process response
}
}
http.send(JSON.stringify(moviesJson));
Chromely
Getting Started
The Basics
Digging Deeper
- Sub-Process
- Infrastructure
- Restful Resources
- Register Resource Assemblies
- Custom Local Resource Handling
- Custom Scheme Handling
- Expose .NET class to JavaScript
- Generic Message Routing
- Real-time with Websocket
- External Url Registration
Angular - React - Vue