Re: [coldbox:28024] Rest Pagination

Skip to first unread message

Jon Clausen

Dec 5, 2020, 10:16:03 AM12/5/20

If you’re using one of the REST templates, then the `Response` object which generates that pagination struct is located at coldbox/system/web/context/Response.cfc

If you want to change the pagination structure, then you will need to clone that component ( or extend it ) and modify the `setPagination` method to your desired structure.

Then, add a preProcess interception ( which will fire before the aroundHandler method in the base RestHandler.cfc ) which sets prc.response to your new component. 

From that point on, it should work exactly as it currently does, with a different pagination structure.






From: <> on behalf of Roberto Marzialetti <>
Reply-To: "" <>
Date: Saturday, December 5, 2020 at 8:23 AM
To: ColdBox Platform <>
Subject: [coldbox:28024] Rest Pagination


Hi everyone


I started playing with Coldbox to create a Rest application.

In a short time I was able to get it working :-)


I have a problem: I would like to replace the default structure with a custom one. Is  possible?




I don't find anything for this in docs or config.


I'm using coldbox 6.

You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit
For Documentation, visit
For Bug Reports, visit
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Roberto Marzialetti

Dec 7, 2020, 4:47:19 AM12/7/20
to ColdBox Platform
Excuse me Jon,
but I can't set my custom response.

I added "preHandler" in my Echo.cfc, like this:

function preHandler (event, rc, prc, action, eventArguments) {
   prc.setResponse( new api.model.APIResponse() )

function index( event, rc, prc ) {


But i can't use rpc.setResponse: 
Error: The function [setResponse] does not exist in the Object  

the same for event.setResponse

prc contains only a string, like this:  

prc-Immagine 2020-12-07 100931.png

I should replace all the response object, not only pagination:


Should I replace RestHandler too?

Any hint?

Many thanks :-)

Jon Clausen

Dec 7, 2020, 8:32:11 AM12/7/20
“prc” is a struct. You would need to use dot notation to set that value.

From: <> on behalf of Roberto Marzialetti <>
Sent: Monday, December 7, 2020 4:47:19 AM
To: ColdBox Platform <>
Subject: Re: [coldbox:28034] Rest Pagination
Reply all
Reply to author
0 new messages