Spring webflux proxy upload file to s3 efficient? - spring

i want to upload file to AWS s3 using Mono spring webflux, but i can not calculate file size without allocate file to memory that is not efficient. Anyone help me ?

Related

How to make custom cache for spring cloud config server

Spring cloud config server caches files in tmp directory.
How can one implement own storage, hence hashmap, hazelcast cache or local db instead of file system?

Disable Spring Boot File Uploading

A pretty basic API initialized with Spring Boot + Tomcat which serves multiple (4) endpoints. This API is exposed to public and receives requests in those endpoints only.
None of those are for File uploading. We are monitoring the API and noticed the following message:
"Creating the temporary upload location [C:\Users[user]\AppData\Local\Temp\tomcat.443.338388046123984973\work\Tomcat\localhost\ROOT] as it is required by the servlet [dispatcherServlet]". I was wondering if someone tried to upload a file as an exploit because we noticed some exploits attempts before (log4j, random-requests to other non-existing endpoints, etc)
Should I be worried? How I can disable it?
You can disable mutlipart/form with the following spring property
spring.servlet.multipart.enabled = false

Spring boot - how to implement cancelling file download?

I have created a RESTful web service using spring boot to upload and download files. Now I have another requirement. When a large file is getting uploaded or downloaded, user can send a request to cancel the uploading or downloading. How can I implement this feature?

Is there anyway we can use Spring Cloud Functions + AWS Lambda adapter to process http file uploads?

I am new to AWS and FAAS. My work place is interested in processing HTTP file upload with AWS Lambda and Spring Boot. A quick research led me to Spring Cloud Functions + AWS Lambda adapter; however, documentation doesn't cover anything related to HTTP file uploads, so I wonder if it is possible to do that with Spring Cloud Function or I have to fallback to AWS Lambda Spring Boot integration (https://github.com/awslabs/aws-serverless-java-container)?
Thanks in advance for your kind enlightenment!
AWS lambda can be triggered in many ways like API gateway, S3Event, SNS notification and SQS. API gateway integrates lambda with HTTP end points. API gateway is not designed to handle file uploads. API gateway converts binary data to base64 encoded text. Handling binary data as text consumes a lot of memory and processing gets tricky as well.
Also API gateway has a 10MB limit on payload size. The best approach to upload files is using S3. Even better approach would be to use a lambda function to generate a pre-signed S3 url to upload files.
Spring cloud function when integrated with an API gateway is intended to expose a single HTTP endpoint. However AWS Lambda spring boot integration by awslabs can expose multiple end points. Choose the approach that best works you.
Hope that helps.

Spring Zero Copy file download

I have to write a Web service that will be hit by a web application to download image.Image URL is not directly exposed to client, it will be be decided by some business logic. I am using Amazon S3 for file storage so how can i implement zero copy file transfer with spring?

Resources