Servlet 3.1-多部分异步处理 [英] Servlet 3.1 - Multipart async processing

查看:148
本文介绍了Servlet 3.1-多部分异步处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试Servlet 3.1 API来处理多部分请求.我对同步处理某些部分(文本字段)和异步处理其他部分(文件字段)感兴趣.乍一看,它似乎在Servlet 3.1中不可用(要么在异步上下文中完全通过request.getInputStream()异步,要么类似于apache-commons-fileupload库的多部分处理).

I am testing Servlet 3.1 API to process multipart requests. I am interested in processing some of the parts synchronously (text fields) and other asyncronously (file fields). At first sight it seems that it is not available in Servlet 3.1 (either totally async through request.getInputStream() in an async context or multipart processing similar to apache-commons-fileupload library).

有没有一种方法可以使用Servlet 3.1进行同步/异步处理?

Is there a way to get this sync/async processing using Servlet 3.1?

提前感谢您的宝贵时间! :)

Thanks in advance for your time! :)

推荐答案

Synchronoss Technologies最近开放了一个非阻塞HTTP多部分解析器,该解析器可与Servlet 3.1一起使用

Synchronoss Technologies recently open sourced a non-blocking HTTP multipart parser which can be used with Servlet 3.1 here.

您只需编写Servlet 3.1 ReadListener,即可将传入的字节传递给NioMultipartParser.解析器将为收到的每个部分回调您的代码.

You just write your Servlet 3.1 ReadListener, to pass incoming bytes to the NioMultipartParser. The parser will make callbacks to your code for each of the parts received.

免责声明:我为Synchronoss Technologies工作.我们将此开源,因为实施起来很头疼! Servlet 3.1提供的功能似乎存在差距,因此希望其他人会发现此库有用.

Disclaimer: I work for Synchronoss Technologies. We open sourced this because it was quite a headache to implement! There seems to be a gap in functionality provided by Servlet 3.1, so hopefully others will find this library useful.

这篇关于Servlet 3.1-多部分异步处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆