aspose file tools*
The moose likes Web Services and the fly likes Paging Large Result Sets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Paging Large Result Sets" Watch "Paging Large Result Sets" New topic
Author

Paging Large Result Sets

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
Hello,

If you have a large XML (thousands of rows) Response from a Spring Web Service, how is the best way to implement paging or is paging the best way to approach this issue? The pipe between the client and service only allows so much data so we need to handle this situation somehow.

Should there be some unique ID sent from the client with the Request and follow up Requests (incremented somehow) so you know which chunk of Response data to send back in subsequent Requests?

Just wondering how this should best be done..

Thanks in advance for any suggestions.

mike
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

I frequently send 4 items of metadata with each request/response that could be paged:
  • the property (column) to sort on
  • the sort order
  • the page size
  • the page number


  • [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    Mike London
    Ranch Hand

    Joined: Jul 12, 2002
    Posts: 1075
    Bear Bibeault wrote:I frequently send 4 items of metadata with each request/response that could be paged:
  • the property (column) to sort on
  • the sort order
  • the page size
  • the page number


  • Hey Bear,

    Good to hear from you.

    But, what about a "requesterId" or something so you could keep all the paging progress in sync for the various Requesting clients?

    And these metadata values would have to be attributes or elements in the Request method's XSD definition, right (Spring WS: XSD only)?

    - mike
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 61433
        
      67

    Any other filters are outside the scope of this metadata.

    And sorry, I have no idea about the XML. I work exclusively with JSON.
    Mike London
    Ranch Hand

    Joined: Jul 12, 2002
    Posts: 1075
    Bear Bibeault wrote:Any other filters are outside the scope of this metadata.

    And sorry, I have no idea about the XML. I work exclusively with JSON.


    JSON, ahhhhhh......

    In any case, it seems that we'd just accept the information about how many rows to send back (and possibly some of your other metadata) in the Request and then do the SQL for that Response. I was thinking that the entire request would be cached on the server and need to coordinate future requests with multiple clients, but that doesn't make sense with hundreds of potential simultaneous clients.

    Appreciate your reply.

    mike
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 61433
        
      67

    I never do any state on the server. That violates RESTful principles.

    The metadata is sent with the request, and is sent back to the client in the response (along with other metadata such as counts). It's the responsibility of the client to keep track of things.
     
    Don't get me started about those stupid light bulbs.
     
    subject: Paging Large Result Sets