如何将 JSP 中的多部分/混合内容解析为 servlet

发布于 2024-08-29 11:23:46 字数 366 浏览 3 评论 0原文

我正在从 JSP 向 servlet 发送 multipart/mixed 内容消息,但是当我使用

ServletFileUpload.isMultipartContent(请求);

方法来检查请求是否是多部分的,我得到的输出为“false”。我的消息的内容类型标头如下所示:

multipart/mixed; 
    boundary="----=_Part_26_2184190.1271924416255"

谁能告诉我如何使用 Apache fileupload API 解析请求?上述方法如何将输出返回为“true”

I'm sending multipart/mixed content message from JSP to servlets but when I used

ServletFileUpload.isMultipartContent(request);

method to check if the request is Multipart or not, I'm getting the output as "false". This is how content type header of my message is looking like:

multipart/mixed; 
    boundary="----=_Part_26_2184190.1271924416255"

Could anyone please tell me how can I parse the request using Apache fileupload API? How the above method can return me an output as "true"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

婴鹅 2024-09-05 11:23:46

条件是:

  • 请求方法必须是 post
  • 内容类型必须以 multipart/ 开头 通过

request.getMethod() 检查这两个并request.getContentType()

The conditions are:

  • the request method must be post
  • the content-type must start with multipart/

Check these two via request.getMethod() and request.getContentType()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文