Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8332419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:43:08+00:00 2026-06-09T02:43:08+00:00

Using latest Spring-MVC (3.1.2.RELEASE) I have a pagable REST method something like: @RequestMapping(value =

  • 0

Using latest Spring-MVC (3.1.2.RELEASE)

I have a pagable REST method something like:

@RequestMapping(value = "/myThings", method = RequestMethod.GET)
public @ResponseBody
Page<MyThings> findMyThings(@Valid PageRequest pageRequest) {
    Page<MyThings> myThings = myService.findMyThings(pageRequest);
    return myThings;
}

Trying to test with org.springframework.web.client.RestOperations. Everything works okay, especially for non-pagable requests. However, with pagable ones, the ‘pageRequest’ object received in the REST method is one created by the default constructor and not the one created and passed into the call.

This is what I tried (where restTemplate is an instance of “RestOperations”:

    .... // make the pageRequest object
    if (pageRequest != null) {
        params.put("pageRequest", pageRequest);
    }
    String json = restTemplate.getForObject(restEndpoint + "/myThings", 
                    String.class, Collections.unmodifiableMap(params));

I know the problem/issue is on this side – if I deploy to Tomcat and pass the pageRequest params through the URL the paging on the server-side works perfectly. Additionally, I stepped down through the Spring code and it looks like if the pageRequest is put into the Model, it will be pulled out, otherwise one gets the default which is what I am getting.

Can anyone help?

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:43:10+00:00Added an answer on June 9, 2026 at 2:43 am

    The parameter for getForObject where you are passing Collections.unmodifiableMap(params) is actually Object... urlVariables, where the variables are placeholders for @PathVariable type declaration, so this will only work for declarations where you have @PathVariables

    An alternative is to have it the way you have it but have support for query parameters this way:

    String json = restTemplate.getForObject(restEndpoint + "/myThings?pagerequest={pageRequest}", 
                        String.class, Collections.unmodifiableMap(params));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery(Latest release) and have a function called calculate() which gets called
I am using latest Pyramid to build a web app. Somehow we have started
I want to make spring MVC 3.0.3 portlet using DispatcherPortlet class With JSON support.
I am using the latest version Telerik MVC controls . I am using ASP.NET
I am using the latest version of Telerik MVC controls on my ASP.NET MVC3
I am using latest Apache CXF to create a webservice. I have configured ws-security
I have been trying to integrate Spring (3.0.4 and 3.0.5) MVC with Apache Tiles
OS: Windows Vista, Framework: Jqgrid (latest), Spring (latest), JQuery (latest) I am using Jqgrid
We are starting a new Java EE web application using Spring, Sping MVC and
I am using .Net Framework 4, mvc 3 and entity framework (latest stable) On

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.