问题描述
我正在为满足以下要求而在JAX-RS 2.0和JDK 8中编写REST API
I am writing a REST API in JAX-RS 2.0, JDK 8 for the below requirement
POST API/server/fileUpload/(多部分表单数据),我需要在其中发送一个大的.AI(Adobe Illustrator)文件.
POST API /server/fileUpload/ (Multipart Form data) where I need to send a Big .AI (Adobe Illustrator) File in this.
服务器,获取文件并返回状态202(已接受),确认文件传输已成功完成.(从端点到服务器)
The Server, takes the file and return Status 202 (Accepted), Acknowledging that file transfer happened Successfully. (From endpoint to Server)
现在在服务器上,我正在使用Java + Imagemagik将.AI文件(20-25 MB文件)转换为小的JPG缩略图,放置在Apache HTTP服务器上并共享位置(例如 http://happyplace/thumbnail0987.jpg )
Now at the Server, I am using Java + Imagemagik to convert .AI File (20-25 MB File) to small JPG Thumbnail, place on a Apache HTTP Server and share the location (like http://happyplace/thumbnail0987.jpg)
现在,第二个响应应该来自状态为200 OK且具有缩略图URL的服务器
Now the Second Response should come from Server with Status 200 OK and Thumbnail URL
使用一个REST API是否可行?(异步/相似)
is it feasible with one REST API? (Async/similar)
或者我应该将其拆分为2个API调用,请建议
or should I split it to 2 API calls, Please suggest
推荐答案
您可以为此使用WebSockets.
You can use WebSockets for that.
这篇关于REST API单个请求-多个响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!