query = Query.newBuilder()
.setOptions( QueryOptions.newBuilder().setLimit( limit ).setCursor( Cursor.newBuilder().build() ).build() )
.build( queryString );
searchResults = getIndex( accountPin ).search( query );
nextCursor = searchResults.getCursor().toWebSafeString();
Result Cursor (nextCursor):
false:CqADCuUBCswB9wUnngv/////c35zdGFnaW4tY21zAP//AIuSX19mdHNfXwD//wCiYXBwZW5naW5lAP//AIyLkmluZGV4AP//AKJNUDUwVlYA//8AjIuSZG9jX2lkAP//AKI4UUk3NDQA//8AjIA4UUk3NDQA//8AAP8B//6MgYyLnpiWkdKckoz/AHRtoKCZi4ygoP8AXZ6Pj5qRmJaRmv8Ac3RtlpGbmof/AF2yr8rPqan/AHN0bZuQnKCWm/8AXceutsjLy/8Ac3/HrrbIy8v/AP/+EAohwwIDw+6dfww5AAAAAPRh2PpIARINRG9jdW1lbnRJbmRleBqfAShBTkQgKElTICJjdXN0b21lcl9uYW1lIiAiYXBwZW5naW5lIikgKElTICJncm91cF9uYW1lIiAic35zdGFnaW4tY21zIikgKElTICJuYW1lc3BhY2UiICIiKSAoSVMgImluZGV4X25hbWUiICJNUDUwVlYiKSAoT1IgKFFUICJ0ZXN0IikgKElTICJfX2dhdG9tX18iICJ0ZXN0IikpKUoFCABA6Ac=
Is the result cursor which I showed above is a websafestring? I don't think so.
If it is a websafestring, I should be able to put as parameter in URL and get the subsequent records.
For the subsequent requests, I will use the following query.
CODE:
query = Query
.newBuilder()
.setOptions(
QueryOptions.newBuilder().setLimit( limit ).setCursor( Cursor.newBuilder().build( nextCursor ) ).build() )
.build( queryType + queryString );
But when I try with the cursor what I have showed, its giving me an exception.
SAMPLE URL: http://example.appspot.com/?queryType=all&queryString=test&limit=10&cursor=false:CqADCuUBCswB9wUnngv/////c35zdGFnaW4tY21zAP//AIuSX19mdHNfXwD//wCiYXBwZW5naW5lAP//AIyLkmluZGV4AP//AKJNUDUwVlYA//8AjIuSZG9jX2lkAP//AKI4UUk3NDQA//8AjIA4UUk3NDQA//8AAP8B//6MgYyLnpiWkdKckoz/AHRtoKCZi4ygoP8AXZ6Pj5qRmJaRmv8Ac3RtlpGbmof/AF2yr8rPqan/AHN0bZuQnKCWm/8AXceutsjLy/8Ac3/HrrbIy8v/AP/ EAohwwIDw 6dfww5AAAAAPRh2PpIARINRG9jdW1lbnRJbmRleBqfAShBTkQgKElTICJjdXN0b21lcl9uYW1lIiAiYXBwZW5naW5lIikgKElTICJncm91cF9uYW1lIiAic35zdGFnaW4tY21zIikgKElTICJuYW1lc3BhY2UiICIiKSAoSVMgImluZGV4X25hbWUiICJNUDUwVlYiKSAoT1IgKFFUICJ0ZXN0IikgKElTICJfX2dhdG9tX18iICJ0ZXN0IikpKUoFCABA6Ac=
Exception:
at com.google.appengine.api.urlfetch.URLFetchServiceImpl.convertApplicationException(URLFetchServiceImpl.java:115)
at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:42)
at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.fetchResponse(URLFetchServiceStreamHandler.java:418)
at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getInputStream(URLFetchServiceStreamHandler.java:297)
I have used URLEncoder and URLDecoder for the cursor string.....But that will not work....Since it will replace '+' sign with empty space.
Please suggest me a solution to fix this problem.