我一直无法从 SO 内部获得解决方案,因此发布。
我有一个示例 JSP 页面,该页面发布到实现和图像上传工具的供应商产品。
<script type="text/javascript">
function upload(){
document.forms[0].enctype="multipart/form-data"
document.forms[0].action="/upload"
document.forms[0].submit()
}
</script>
在监视请求的同时发布表单后,我收到以下响应,并且 servlet 默认处理内容类型 ="application/x-www-form-urlencoded"
这些是请求标头:
POST /upload HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://localhost:9001/ansHealthConsole/htmljsp/common/reattach_file.jsp?JOBNAME=RESCAN_IMAGES&RFCNAME=READ&SEQNUM=100041767&SESSIONID=62767&SECURETXNID=7309450930646918658&
Accept-Language: en-us
Content-Type: multipart/form-data; boundary=---------------------------7dc3c0d25050c
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.3; .NET4.0C; .NET4.0E)
Host: localhost:9001
Content-Length: 71671
Connection: Keep-Alive
Cache-Control: no-cache
响应头如下:
HTTP/1.1 501 Not Implemented
X-Powered-By: Servlet 2.4; Tomcat-5.0.28/JBoss-4.0.1 (build: CVSTag=JBoss_4_0_1 date=200412230944)
Content-Type: text/html;charset=utf-8
Content-Length: 989
Date: Fri, 07 Sep 2012 06:13:34 GMT
Server: Apache-Coyote/1.1
Connection: close
我无法调试"multipart/--"
Jboss 4 的 Tomcat 是否不支持 或者我有其他错误。