New KOBI documentation is available: https://adeo-ccdp.gitbook.io/kobi/

Resources

KOBI has a unique way to deal with URLs by associating each one to a Resource type and ID.
By default when creating a Page in Designer, a resource type “PAGE” and a resource ID (generated page ID) is set.

You can override this type and ID at the page creation. This allow you to categorize your contents and bind it to your systems.

When your page is created, Designer will create a Resource and URL couple through the embeded Resolver in a database.

key : RESOURCE::lmfr-site::fr-FR::EDITORIAL::1Sn7HaRiV9qWxEeCq40XcC

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "type": "RESOURCE",
  "resourceType": "EDITORIAL",
  "resourceId": "1Sn7HaRiV9qWxEeCq40XcC",
  "resourceScope": "articleMagazine",
  "siteId": "lmfr-site",
  "locale": "fr-FR",
  "tenantId": "www",
  "path": "/magazine/idees-maison/une-buanderie-dans-garage.html",
  "status": 200
}

key : URL::lmfr-site::fr-FR::www::/magazine/idees-maison/une-buanderie-dans-garage.html

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "type": "URL",
  "resourceType": "EDITORIAL",
  "resourceId": "1Sn7HaRiV9qWxEeCq40XcC",
  "siteId": "lmfr-site",
  "locale": "fr-FR",
  "tenantId": "www",
  "path": "/magazine/idees-maison/une-buanderie-dans-garage.html",
  "status": 200
}

Those two documents might look a bit redundant but it allows Gluer to quickly find a Resource matching an URL and vice-versa.

A common example would be to set a type “PRODUCT” with a reference ID, or a type “EDITORIAL” with its content ID in your systems.

A resource Type may be set on a Page Model as well, in this case all URLs that are resolved with this type will be displayed on this model (and components will received the resolved ID to change the display accordingly).

Using the last example about “PRODUCT”, you would prefer using a page Model instead of a Page (unless you want to create as much Pages as you have products…). this way a single Page model can render all of your products.

Resolution

A resolution is the action of transforming:

  • a Resource type and ID to an URL = resource resolution
  • an URL to a resource type and ID = path resolution

The resource resolution is made by Designer when creating a Page, or by Gluer when rewriting your contents.

The path resolution is made for incoming requests on Gluer, exemple for a request www.my-site.fr/home Gluer will serch Site configuration matching the domain www.my-site.fr, and do a path resolution on the /home path.
The result of this resolution will be used for routing purpose to Backends.

Resource resolution

To create the firsts URL ↔︎ RESOURCE association, a first resolution must happen.

The standard way to resolve an URL is to let the Gluer do the job. Indeed, every time the Gluer handles a request, it searches for placeholders matching the following formats: [RESOURCE_TYPE::RESOURCE_ID] or [RESOURCE_TYPE::RESOURCE_ID?formatter] or [SITE_ID:RESOURCE_TYPE::RESOURCE_ID] or [SITE_ID:RESOURCE_TYPE::RESOURCE_ID?formatter] (you should mostly find them into links, so more something like <a href="[TYPE::ID]">…</a>).
Using the parameters:

  • SITE_ID (facultative): the site identifier (default value is the current page site identifier),
  • RESOURCE_TYPE: the resource type,
  • RESOURCE_ID: the resource id,
  • formatter (facultative): the formatter used to write the url (recognized values are: ‘relative’ or ‘absolute’, default value is ‘relative’).

These placeholders will be rewritten with the resource URL. If the URL is not known for this pair of type and identifier, an URL resolution will be started. A good way to resolve a bunch of URLs at once is by exposing sitemaps.

Resource resolution Resource resolution

Path resolution

This resolution happens for an incoming request on Gluer and on each url placeholder.

Url placeholder resolution

Every time the Gluer handles a request, it searches for placeholders matching the following formats: [URL::RESOURCE_PATH] or [URL::TENANT_ID::RESOURCE_PATH].
Using the parameters:

  • URL: is not a parameter, the Gluer use this key word to recognize an url placeholder,
  • TENANT_ID (facultative): the tenant id used to determine the tenant of the resource (default value: the current page tenant identifier). This parameter must be added if you are using several tenants for your site,
  • RESOURCE_PATH: the resource path.

Incoming request

When gluer handle an incoming request, we want to know what to display for a given URL.

Path resolution Path resolution

Gluer will look for the first configured backend in your Site configuration that handles the resolved resource type.
This is a good way to handle Legacy websites, by handling new types with Kobi and forwarding the rest to your legacy application.

Remote resolution

Both resolutions methods are done through the embeded Resolver library in which you can define a custom Resolution API in your Site configuration.

If no remote resolver is set KOBI will create an URL based on the position of your page and its title (/my-category/my-page.html for example if you have a page “my-page” created as a child of the page “my-category”).

If a remote resolver is configured, KOBI will ask your API to give us the URL for the given type (PAGE + ID or your custom type and ID).

Alias

Since IDs may be different between your environments (generated page IDs and custom resource IDs), you can set an Alias on a Page. An alias is just a name that is bound to a Resource.

This is usefull when using references href in your components : See rewriting

Recap :

  • You can set custom resources to page and models
  • Resolutions are made by the embeded Resolver.
  • It’s a library used by Designer at page creation (TYPE + ID = URL) and by Gluer to resolve an URL or a path.
  • You can create your own API to create custom URLs and bind pages or models to your repositories thanks to Resources