fixed item links in rest api (#1591)

Signed-off-by: Kai Kreuzer <kai@openhab.org>
pull/1594/head
Kai Kreuzer 2020-08-14 12:37:40 +02:00 committed by GitHub
parent b7193a0acb
commit 8c83b60044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -188,7 +188,6 @@ public class ItemResource implements RESTResource {
private UriBuilder uriBuilder(final UriInfo uriInfo, final HttpHeaders httpHeaders) {
final UriBuilder uriBuilder = uriInfo.getAbsolutePathBuilder();
respectForwarded(uriBuilder, httpHeaders);
uriBuilder.path("{itemName}");
return uriBuilder;
}
@ -208,6 +207,7 @@ public class ItemResource implements RESTResource {
final Set<String> namespaces = splitAndFilterNamespaces(namespaceSelector, locale);
final UriBuilder uriBuilder = uriBuilder(uriInfo, httpHeaders);
uriBuilder.path("{itemName}");
Stream<EnrichedItemDTO> itemStream = getItems(type, tags).stream() //
.map(item -> EnrichedItemDTOMapper.map(item, recursive, null, uriBuilder, locale)) //

View File

@ -497,7 +497,7 @@ public class SitemapResource
boolean isMapview = "mapview".equalsIgnoreCase(widgetTypeName);
Predicate<Item> itemFilter = (i -> CoreItemFactory.LOCATION.equals(i.getType()));
bean.item = EnrichedItemDTOMapper.map(item, isMapview, itemFilter,
UriBuilder.fromUri(uri).path("{itemName}"), locale);
UriBuilder.fromUri(uri).path("items/{itemName}"), locale);
bean.state = itemUIRegistry.getState(widget).toFullString();
// In case the widget state is identical to the item state, its value is set to null.
if (bean.state != null && bean.state.equals(bean.item.state)) {