Skip to content

Commit

Permalink
fixed item links in rest api (openhab#1591)
Browse files Browse the repository at this point in the history
Signed-off-by: Kai Kreuzer <kai@openhab.org>
  • Loading branch information
kaikreuzer committed Aug 14, 2020
1 parent b7193a0 commit 8c83b60
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public ItemResource(//
private UriBuilder uriBuilder(final UriInfo uriInfo, final HttpHeaders httpHeaders) {
final UriBuilder uriBuilder = uriInfo.getAbsolutePathBuilder();
respectForwarded(uriBuilder, httpHeaders);
uriBuilder.path("{itemName}");
return uriBuilder;
}

Expand All @@ -208,6 +207,7 @@ public Response getItems(final @Context UriInfo uriInfo, final @Context HttpHead
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)) //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ private PageDTO createPageBean(String sitemapName, @Nullable String title, @Null
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)) {
Expand Down

0 comments on commit 8c83b60

Please sign in to comment.