Red Hat Bugzilla – Bug 993548
Paging does not work for JSONP wrapping of requests
Last modified: 2014-03-26 04:31:12 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?
master 8e606386ce has a potential fix and a testcase.
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.
* 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.
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.