Bug 993548 - Paging does not work for JSONP wrapping of requests
Paging does not work for JSONP wrapping of requests
Product: RHQ Project
Classification: Other
Component: REST (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified (vote)
: ---
: RHQ 4.9
Assigned To: Heiko W. Rupp
Mike Foley
Depends On:
  Show dependency treegraph
Reported: 2013-08-06 03:15 EDT by Heiko W. Rupp
Modified: 2014-03-26 04:31 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-03-26 04:31:12 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Quick test to output the results of a jsonp request with paging. (392 bytes, text/html)
2013-08-06 16:53 EDT, Josh Osgood
no flags Details

  None (edit)
Description Heiko W. Rupp 2013-08-06 03:15:40 EDT
From Community: https://community.jboss.org/message/830028

I've recently encountered what I believe to be an issue with paging/jsonp support in the REST API. According to this post by Heiko, paging metadata can be returned in one of the following ways:
In the response header
In the body of the message
Due to the nature of jsonp, I can't access the response header - the first approach won't work for me. Instead, I must use the second approach.
This is where I'm running into issues. In order to achieve the second approach, I have to include the following header in my request:
Again, due to the nature of jsonp, I cannot modify the headers in my request. It seems that I effectively have no way of getting paging information through jsonp.
Is there another recommended approach to getting paging information with jsonp? If not, is there any intention of supporting this in the future?
Comment 1 Heiko W. Rupp 2013-08-06 12:27:46 EDT
master 8e606386ce has a potential fix and a testcase.
Comment 2 Josh Osgood 2013-08-06 16:53:31 EDT
Created attachment 783509 [details]
Quick test to output the results of a jsonp request with paging.

* The jsonp request should be modified to point to your particular RHQ server.

* This test outputs the response of a simple jsonp request to the console.

* Examine the response in the console - it should include a single platform object.
* RHQ returned the first page successfully, but we have no way of accessing paging metadata.

* Be default, paging metadata is returned in the response headers. Because jsonp only passes the response body to the callback function, we have no way of accessing this metadata.
* RHQ is capable of embedding this metadata in the response body (which would solve the problem), but we can only trigger this by including a particular header with our request. Because jsonp works through a script tag, we have no way of specifying the header and triggering this response formatting.

Possible Solutions
* Allow us to include a query parameter with our request that will trigger the necessary response formatting, rather than depending on a request header.
* Alternatively - make this the default formatting when jsonp is specified, since it can't effectively use the other formatting anyway.
Comment 3 Heiko W. Rupp 2014-03-26 04:31:12 EDT
Bulk closing now that 4.10 is out.

If you think an issue is not resolved, please open a new BZ and link to the existing one.

Note You need to log in before you can comment on or make changes to this bug.