This is a migrated thread and some comments may be shown as answers.

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

1 Answer 235 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Labhesh
Top achievements
Rank 1
Labhesh asked on 13 Oct 2016, 08:54 PM

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--

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 14 Oct 2016, 07:44 AM

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.
 
Tags
Upload
Asked by
Labhesh
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or