Spring HATEOAS Links

304 Views Asked by At

I'm just trying to learn, building a Spring HATEOAS app.

I have added a custom query to my repository:

    @Query("SELECT c from Customer c WHERE (:basedOnCustomer = '' or c.basedOnCustomer =   :basedOnCustomer) "
        +                           " and (:defaultReleaseLevel = '' or c.defaultReleaseLevel = :defaultReleaseLevel) "
        +                           " and (:targetReleaseLevel = '' or c.targetReleaseLevel = :targetReleaseLevel)")
    @RestResource(path = "filteredList", rel = "filteredList")
    List <Customer> findAllFitered( @Param(value="basedOnCustomer") String basedOnCustomer,
                                @Param(value="defaultReleaseLevel") String defaultReleaseLevel,
                                @Param(value="targetReleaseLevel") String targetReleaseLevel,
                                Pageable pageable);

And I'm getting the JSON response fine, but as this is pageable I'd like a links section... with prev/next.

How do I add that?

The main url provides a list of all customers, with links no problems, I'd just like to add these links to custom pageable methods.

-- EDIT--

doh!

Make the findAllFitered method return a Page instead of a List...

1

There are 1 best solutions below

0
On

Make the findAllFitered method return a Page instead of a List...