kendo upload - angular-js + jax-rs (java on backend) gives unsupported media type (415 error)

2 posts, 0 answers
  1. Labhesh
    Labhesh avatar
    23 posts
    Member since:
    Sep 2015

    Posted 13 Oct Link to this post

    Hi, 

     

    I've been trying kendo-upload with angular. 

     

    I keep getting unsupported media type from the server (error: 415). I am wondering if the 

    boundary=----WebKitFormBoundaryARilQnC5oS7lnLVU

    is making server have any issues or is there something else that's causing this?

    Can you please provide guidance on how to have java service (jax-rs) based handle the request from UI? (in the same way you've given for asp.net)

    Here's the angular configuration

    <div class="demo-section k-content" ng-controller="UploadController"><input name="files"                          id="files"                          type="file"                          kendo-upload="uploader"                          k-select="onSelect"                          k-async="{ saveUrl: 'http://localhost:8080/path/to/upload', autoUpload: true }"/></div>

     

    The java server side code for handling post

    @POST@Consumes(MediaType.MULTIPART_FORM_DATA)public void uploadFiles(@FormDataParam("files") List<InputStream> files) {System.out.println("Reached UploadFiles");}

     

    This is the request made as seen on Chrome/Developer tools/Network

    Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryARilQnC5oS7lnLVURequest Payload------WebKitFormBoundaryARilQnC5oS7lnLVUContent-Disposition: form-data; name="files"; filename="test_blah.txt"Content-Type: text/plain ------WebKitFormBoundaryARilQnC5oS7lnLVU--
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2156 posts

    Posted 14 Oct Link to this post

    Hello Labhesh,

    The problem does not seem related to the Upload widget, but to the server configuration instead. You could assure this by removing the Upload widget and posting a separate FormData request. Since we are not tight specialists in jax rs, we cannot state what is the exact problem, but I found the following threads here and here that might help.

    Regards,
    Dimiter Madjarov
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
Back to Top