Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does GAE BlobstoreService#createUploadUrl(String) include the request query parameter
    primarykey
    data
    text
    <p>I am using the GAE Blobstore with Jersey REST on ther server side. I send a GET request to the server via Android and include a query parameter called <code>logindx</code>. My server side code snippet looks like this:</p> <pre><code>@Path("/getuploadurl") @GET @Produces(MediaType.TEXT_PLAIN) public Response getUploadUrl(@QueryParam("logindx") Long logIndx ) { BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); String uurl = blobstoreService.createUploadUrl("/logblobkey"); logger.severe("urltest: " + uurl); return Response.ok(uurl).build(); } </code></pre> <p>The problem is that the result String I get back at Android (and which is also logged) is:</p> <pre><code>urltest: http://bardroid123.appspot.com/_ah/upload/?logindx=-43803902306520/AMmfu6b2Ubvf17gD_5uheZeDhTIsr8nm582oaNi0_SDPWfuxqHmYgtkWqVVP52QbBwnnNbWyJf_lDdf9GDmFKtdHU_eUn5gjjtrOSAB32HSu3HiVgLovO5pYeYDkapBPfu7uuo460Ez0/ALBNUaYAAAAAUeuzYniVLlTqyYCjIkfK7-n0ARv5yoo1/ </code></pre> <p>The part <code>?logindx=-43803902306520/</code> in the above upload URL should surely not be there? Ho does the <code>createUploadUrl</code> function even know how to get hold of the <code>HttpRequest</code> object to extract the query parameter? </p> <p>The problem is when I try to use the above uri in my android app like so:</p> <pre><code>HttpPost postRequest = new HttpPost(uri); </code></pre> <p>I get the following error:</p> <pre><code>java.lang.IllegalArgumentException: Illegal character in query at index 253: http://bardroid123.appspot.com/_ah/upload/?logindx=-43803902306520/AMmfu6ZDQr7WenGd0N3ZkbI3zfSl0xPcY56XS5p_VQiS_MWxtTwtc1xm8NbhdrhK-PxopCIolsWci_06DQ3EsUJXSlbiavtJKX9JXT7RU3vTnwj-H0yY5DZKv9hbYR0brfOezaVwob1k/ALBNUaYAAAAAUevBZWOmVC0m1tipSR7Lk9WcwePsXBzf/ </code></pre> <p>Even more confusing is that I don't get the <code>?logindx=-43803902306520/</code> part when I do the get request on my local server (from Eclipse provided by App Engine):</p> <pre><code>http://localhost:8888/res/logs/getuploadurl?logindx=1234567. </code></pre> <p>In that case the browser returns something like:</p> <pre><code>http://localhost:8888/_ah/upload/agtiYXJkcm9pZDEyM3IbCxIVX19CbG9iVXBsb2FkU2Vzc2lvbl9fGDIM </code></pre> <p>Clearly it has got nothing to do with Android and I can't see how this can be Jersey specific either.</p> <p>Any help would be greatly appreciated. </p> <p>Thanks - from Africa.</p> <p>EDIT:</p> <p>I got it right now by simply dropping the last slash (/) in the uri and the <code>Illegal character in query</code> error went away. The uri was working perfectly with the Blobstore with the <code>?logindx=-43803902306520/</code> part included. Don't matter now, but still wondering why it is included in the upload uri?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload