openhab-core/itests
Yannick Schaus 6e83d3f8de
"Cacheability" option for critical REST resources (#3335)
* Closes #3329.

This implements a new optional `cacheable` parameter for these REST endpoints:
- `/rest/items`
- `/rest/things`
- `/rest/rules`

When this parameter is set, a flat list of all elements excluding
non-cacheable fields (e.g. "state", "transformedState", "stateDescription",
"commandDescription" for items, "statusInfo", "firmwareStatus",
"properties" for things, "status" for rules) will be retrieved along with
a `Last-Modified` HTTP response header. When unknown, the Last-Modified
header will be set to the date of the request.

Also only when this parameter is set, and a `If-Modified-Since` header is
found in the request, that header will be compared to the last known
modified date for the corresponding cacheable list. The last modified date
will be reset when any change is made on the elements of the underlying
registry. If the `If-Modified-Since` date is equal or more recent than the
last modified date, then a 304 Not Modified response with no content will
be served instead of the usual 200 OK, informing the client that its
cache is still valid at the provided date.

All other request parameters will be ignored except for "metadata" in the
`/rest/items` endpoint. When a metadata selector is set, the resulting
item list will be considered like a completely different resource, i.e.
it will have its own last modified date. Regarding metadata, the approach
to invalidating last modified dates is very conservative: when any metadata
is changed, all cacheable lists of items will have their last modified date
reset even if the change was in a metadata namespace that wasn't requested.

This also implements the abovedescribed behavior for the
`/rest/ui/components/{namespace}` endpoint, but no `cacheable` parameter
is necessary. The last modified date is tracked by namespace.

Signed-off-by: Yannick Schaus <github@schaus.net>
2023-06-15 20:16:14 +02:00
..
org.openhab.core.addon.tests Code cleanup: Use Java 17 features (#3580) 2023-04-30 18:37:48 +02:00
org.openhab.core.auth.oauth2client.tests Code cleanup: Use Java 17 features (#3580) 2023-04-30 18:37:48 +02:00
org.openhab.core.automation.integration.tests Trigger immediately when start level already reached (#3278) 2023-05-28 10:14:03 +02:00
org.openhab.core.automation.module.core.tests Trigger immediately when start level already reached (#3278) 2023-05-28 10:14:03 +02:00
org.openhab.core.automation.module.script.tests Upgrade JUnit to 5.9.2 and Mockito to 4.11.0 (#3450) 2023-03-12 20:47:54 +01:00
org.openhab.core.automation.module.timer.tests Trigger immediately when start level already reached (#3278) 2023-05-28 10:14:03 +02:00
org.openhab.core.automation.tests Trigger immediately when start level already reached (#3278) 2023-05-28 10:14:03 +02:00
org.openhab.core.config.core.tests Code cleanup: Use Java 17 features (#3580) 2023-04-30 18:37:48 +02:00
org.openhab.core.config.discovery.mdns.tests Upgrade JUnit to 5.9.2 and Mockito to 4.11.0 (#3450) 2023-03-12 20:47:54 +01:00
org.openhab.core.config.discovery.tests Code cleanup: Use Java 17 features (#3580) 2023-04-30 18:37:48 +02:00
org.openhab.core.config.discovery.usbserial.linuxsysfs.tests Code cleanup: Use Java 17 features (#3580) 2023-04-30 18:37:48 +02:00
org.openhab.core.config.discovery.usbserial.tests Upgrade JUnit to 5.9.2 and Mockito to 4.11.0 (#3450) 2023-03-12 20:47:54 +01:00
org.openhab.core.config.dispatch.tests Upgrade JUnit to 5.9.2 and Mockito to 4.11.0 (#3450) 2023-03-12 20:47:54 +01:00
org.openhab.core.ephemeris.tests [ephemeris] Add support for overriding holiday definitions (#3573) 2023-05-02 09:11:59 +02:00
org.openhab.core.io.net.tests Integration tests for org.openhab.core.io.net (#3460) 2023-03-25 17:44:15 +01:00
org.openhab.core.io.rest.core.tests "Cacheability" option for critical REST resources (#3335) 2023-06-15 20:16:14 +02:00
org.openhab.core.model.item.tests Upgrade JUnit to 5.9.2 and Mockito to 4.11.0 (#3450) 2023-03-12 20:47:54 +01:00
org.openhab.core.model.rule.tests Upgrade JUnit to 5.9.2 and Mockito to 4.11.0 (#3450) 2023-03-12 20:47:54 +01:00
org.openhab.core.model.script.tests [uom] Add unit metadata for NumberItem (#3481) 2023-05-09 22:42:25 +02:00
org.openhab.core.model.thing.tests Code cleanup: Use Java 17 features (#3580) 2023-04-30 18:37:48 +02:00
org.openhab.core.model.thing.testsupport Code cleanup: Use Java 17 features (#3580) 2023-04-30 18:37:48 +02:00
org.openhab.core.storage.json.tests Fix recently introduced SAT issues (#3516) 2023-04-01 17:18:22 +02:00
org.openhab.core.tests [uom] Add unit metadata for NumberItem (#3481) 2023-05-09 22:42:25 +02:00
org.openhab.core.thing.tests [uom] Add unit metadata for NumberItem (#3481) 2023-05-09 22:42:25 +02:00
org.openhab.core.voice.tests Code cleanup: Use Java 17 features (#3580) 2023-04-30 18:37:48 +02:00
itest-common.bndrun Upgrade to Karaf 4.4.3 (#3252) 2023-03-01 13:09:07 +01:00
itest-include.bndrun Raise minimum JDK version to 17 (#2994) 2022-12-19 19:52:43 +01:00
pom.xml Integration tests for org.openhab.core.io.net (#3460) 2023-03-25 17:44:15 +01:00