Note that there are some explanatory texts on larger screens.

plurals
  1. POreceiving json from message body
    primarykey
    data
    text
    <p>I'm trying to send a json String from an ajax call to a jersey web service. I've looked at many related questions and articles but I haven't been able to get anything to work. When I watch my calls from fiddler I can see the json in the body but when the method is hit the String is blank. Thanks for any help.</p> <pre><code>getFile: function() { var urlXls = 'http://localhost:8080/KodiakWebS/Kodiak/KodiakXls/generateXls'; //var json = '{"xls":[{"name":"Pokemon","row":[{"data":"Lugia"},{"data":"Charzard"}]},{"name":"Types","row":[{"data":"Special"},{"data":"Fire"}]}]}'; //encodeURI(); var json = this.get('tempJSON'); urlXls = urlXls.replace(/\s/g, ""); $.ajax({ url: urlXls, type: "POST", data: json, contentType: 'application/json; charset=utf-8', // ;charset=utf-8', success: function(json, status) window.location.assign(json.url); alert("yay"); }, error: function(xhr, err) { debugger; alert(xhr+ " || " + err); } }); }, @POST @Path("/generateXls") @Consumes("application/json") @Produces({ "application/xls" }) public Response sendWorkBook(final String json) throws Exception { createWorkbook(json); FileOutputStream sprdSht = new FileOutputStream("WorkBook.xls"); wb.write(sprdSht); sprdSht.close(); System.out.println("all done"); StreamingOutput stream = new StreamingOutput() { @Override public void write(OutputStream outPut) throws IOException, WebApplicationException { try { wb.write(outPut); } catch (Exception e) { throw new WebApplicationException(e); } } }; return Response.ok(stream).header("content-disposition", "attachment; filename = egisDoc.xls").build(); } </code></pre>
    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.
 

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