Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4806

How to transform PageRequest object to query string?

$
0
0

I'm writing an RESTful API which consumes another RESTful Data API, and I'm using Spring Data.

The client side send the page request using query params like:
http://api.mysite.com/products?page=1&size=20&sort=id,asc&sort=name,desc

And I transform the params to PageRequest object and transfer it to the Service Layer.

In the service, I would like to use TestTemplate to interact with the Data API which use a URL, and How can I transform the PageRequest object to a query string like

page=1&size=20&sort=id,asc&sort=name,desc

then I can request data like:

restTemplate.getForEntity("http://data.mysite.com/products?page=1&size=20&sort=id,asc&sort=name,desc",String.class)                    

Viewing all articles
Browse latest Browse all 4806

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>