Open
Description
I'm trying to write link like this
/resources?page=11&size=100&sort=name,asc.
var pageRessources = ressourceRepository.findAll(pageable);
model.addAllAttributes(
Map.of(
"pageResources", pageResources,
"pageable", pageable
));
return "resource/list";
}
And my thymleaf templates looks like this
<a
class="item icon"
th:href="@{/ressoures(page=1, size=${pageable.pageSize}, sort=${pageable.sort})}"
>
<i class="ui icon angle double left"></i>
</a>
My issue is that this template, will produce the following link
/ressources?page=1&size=100&sort=name:ASC
But this is not handeled correctly by spring mvc. I could not found a way to easely build the given link with the current API.
So I ended up writing this
var currentSort = pageable.getSort().stream().map((s) -> "%s,%s".formatted(s.getProperty(), s.getDirection())).findFirst().orElse("");
Maybe the best solution is not in spring-data-core but in spring mvc. Or maybe there is a solution that I wasnt able to find.