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 7054945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:41:19+00:00 2026-05-28T03:41:19+00:00

For pagination purposes, our UI guy is specifying the items ranges in the Http

  • 0

For pagination purposes, our UI guy is specifying the items ranges in the Http header as follows:

Range: items=0-15

In subsequent requests the ranges from the web can be either

Range: items=16-31
Range: items=32-45

…etc…etc

In my controller SearchRequestController.java, I am trying to extract these ranges so that I can send it over to the Solr server to return the values in the requested chucks by setting the start and the offset.

What I am doing is as follows(In SearchRequestController.java):

@RequestMapping("/billsSearch")
@ResponseBody
public SearchResult searchBills(HttpServletRequest request,@RequestBody SearchRequest searchRequest){
    String rangeRequest = request.getHeader("Range");
    //(1)Parse the rangeRequest using some mechanism
    //(2)Set the start using the first value of the range
    //(3) Add the second value to the start to get the offset
    searchRequest.setStart(startValue);
    searchRequest.setOffset(offsetValue);
    return searchHelper(request,searchRequest);
}

There are a couple of questions that I have:
Is this the best way to request data in a chunked fashion from the server?

How do I extract the ranges from the request header?

I am assuming the request.getHeader("Range") will return “items=16-31“.

Is regular expression the best way to grab 16 and 31 from this string?

If I decide to use regular expression, wouldn’t the expression break if I change the range header to be billItems=16-31?

I am a regex n00b, so it is quite possible I am thinking of this in a wrong way.

Are there alternatives to regex to parse range information like this from the http headers within SpringMVC?

  • 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-05-28T03:41:19+00:00Added an answer on May 28, 2026 at 3:41 am

    Is this the best way to request data in a chunked fashion from the server?

    Another approach is to use request parameters:

    /billsSearch?from=15&to=31
    

    BTW you can use @RequestHeader annotation:

    public SearchResult searchBills(
            @RequestBody SearchRequest searchRequest,
            @RequestHeader("Range") String range) {
        //...
    }
    

    How do I extract the ranges from the request header? […] Is regular expression the best way to grab 16 and 31 from this string?

    I would cut the trailing "items=" string, split on - character and parse two resulting numbers:

    String[] ranges = range.substring("items=".length()).split("-");
    int from = Integer.valueOf(ranges[0]);
    int to = Integer.valueOf(ranges[1]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a pagination method for displaying search results returned from my database. I'm
We just recently moved our DB from 9i to 10G (Yes..better late than never
I am implementing pagination, for that i have to iterate from 1 to totalPages
I am using the jQuery plugin DataTables ( http://datatables.net ) for pagination, search capabilities
im doing simple pagination with QSqlQueryModel select from limit query's every thing is working
I have pagination links set-up like this: http://localhost/?page=2 http://localhost/?page=3 They are wrapped in Anchor
i need to do pagination for listview.i.e i have static 10 text items.i need
I have done pagination with CodeIgniter and it is listing Results from my database
quick pagination i have downloaded the pagination from this site, ya really fine ,
I'm using php pagination to load different data from a text file. I am

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.