Change default for max attribute on results for @Resource on domain classes for Grails 2.3.x

I'm working on an app that serves domain classes as json results. Is there a way to change the default max for the results?

What I'm doing is http://site/domain-class.json and I'm only getting 10 results. I want to avoid creating all the links as http://site/domain-class.json?max=999

Is there a way to increase that default value to something different? I tried searching the source code without any luck. :(

Answers


That's not configurable using the @Resource annotation.

However, you can always generate your controller for your domain and modify the implementation of the list() method to have a different default maximum.

Here is the controller which backs a domain which is marked with the @Resource interface annotation. As you can see the default maximum value is not driven by any configuration value.

Using grails generate-controller for your domain will allow you to change that value in the generated controller for your domain.


Need Your Help

How do I include packages in different directory with CMake?

c++ cmake centos

I am trying to compile a piece of C++ code on a server with CentOS. I need to include a library (NLopt) that is installed as a module at the location "/services/tools". I have tried "module load NL...

Method level profiling of newly launched JVM

java jvm profiling yourkit

In my application, a new JVM is launched when ever a new resource is created. I am able to profile the newly launched JVM by connecting it in yourkit.