pubic class demo{
public void reciveMultipartAndSend(HttpServletRequest httpServletRequest){
InputStream openStream = null;
try {
Map<String, EsbBusFile> files = new HashMap<>();
Map<String, String> texts = new HashMap<>();
Map<String, String> origTexts=new HashMap<>();
// 判断是否是表单提交的数据
if (ServletFileUpload.isMultipartContent(httpServletRequest)) {
ServletFileUpload fileUpload = new ServletFileUpload();
FileItemIterator fileItemIterator =
fileUpload.getItemIterator(httpServletRequest);
while (fileItemIterator.hasNext()) {
// 获取文件流
FileItemStream item = fileItemIterator.next();
// 返回表单中标签的name值
String name = item.getFieldName();
openStream = item.openStream();
if (item.isFormField()) {
// 如果是非文件域,设置进入map,这里要注意多值处理
if (openStream.available() > 0){
String value = S
HttpServletRequest 接收Multipart请求并转发Multipart请求
最新推荐文章于 2024-07-23 16:29:13 发布