Apache Camel - I want to read the multipart form data request so that my Post service can read it and process it ! I cannot find any relevant data for this. Can anyone please guide
If your endpoint is using jetty component, multipart support is built-in:
The camel-jetty component supports multipart form post out of box. The
submitted form-data are mapped into the message header. Camel-jetty
creates an attachment for each uploaded file. The file name is mapped
to the name of the attachment. The content type is set as the content
type of the attachment file name.
Related
My requirement is to accept xml data file that may be gziped in HTTPS POST request and request may be chunked.
Request body WILL have the type of application/.xml.
I am using Postman to make request and java spring to write the controller and rest of the api code.
My questions is how will my request will look like, either it will be form data with xml file in input or raw body with xml selected in postman.
I am finding it hard to make a curl for it.
Here is the example request requirement:
I need to expose a POST endpoint where the user uploads an excel file and based on some validations, I either send back the file with some information added to it along with json response OR just send status code as 200 OK(no data).
I am trying to do this in spring boot. I tried following link:
https://javadigest.wordpress.com/2012/02/13/downloading-multiple-files-using-multipart-response/
This works but needs adding boundary manually. Is there any other way to do it so that I can send both the data ?
You should use #Produces as it is written here: https://docs.oracle.com/cd/E19776-01/820-4867/ghrpv/index.html
You can define the MIME-Type of your payload.
I am using postman to POST a http request with a file in form-data and want to pass the filename as a header. With file as a sink i want to get that file and save it in the name of the header value filename which i passed in the http request. Below is what i tried with spring cloud flow and i am not getting the header "filename" in the sink side the file is getting saved in the name "null"
stream create --name myfilestream --definition "http --mapped-request-headers=foo --port=5555 | file --directory-expression="'Desktop' + 'sr'" --name-expression="headers['foo']" --deploy
Could someone throw some light on this.
If you use Kafka Binder , you should consider to use this option:
spring.cloud.stream.kafka.binder.headers
The list of custom headers that will be transported by the binder.
Default: empty.
By default custom headers aren't transported.
I want to upload the file without post back.
When I select the file and click on upload, I am not able to send the file data to controller.
As result of which the Request.Files=null.
Can anyone please tell me how can I send file data to controller using ajax call.
You need to encrypt your post data in multipart and deserialize on server side.
I can recoment you FineUploader http://fineuploader.com/
IN magento, as I am using REST api to get the product details with url like http://myserver.com/magento/api/rest/products? But this url returns only in XML format. But I need it in the JSON format.
Can anyone suggest me how to get it in JSON format without using REST client??
you need to set request header explicitly to application/json then the response is served in json.