- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用公共(public) FileUpload 作为自定义 uploader 实现的一部分。特别是,我正在使用 ServletFileUpload 和 Streaming API ( http://commons.apache.org/fileupload/streaming.html )。 ServletFileUpload 中 getItemIterator() 方法的 API 表明它保证返回 FileItemStreams 的迭代器,按照“它们被传输的顺序”。也许这是一个愚蠢的问题,但是在提交HTML表单时,这个顺序是否保证是HTML表单输入存在于相应HTML页面的顺序?到目前为止,情况似乎是这样,但我需要确保这是有保证的行为。
示例:
<form method="post" name="test" action="/upload">
<input type="hidden" name="param1" value="1" />
<input type="hidden" name="param2" value="2" />
<input type="hidden" name="param3" value="3" />
<input type="file" name="test_file" />
</form>
// Example JAVA ...
// Is the iterator guaranteed to return streams in the order: param1, param2, param3, test_file?
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iter = upload.getItemIterator(request);
最佳答案
是的,这又在 W3C HTML Forms Spec 中指定- Chapter 17.13.4 Form content types .这是相关性的摘录(请参阅最后一段中的重点):
17.13.4 Form content types
...
application/x-www-form-urlencoded
This is the default content type. Forms submitted with this content type must be encoded as follows:
Control names and values are escaped. Space characters are replaced by
'+'
, and then reserved characters are escaped as described in [RFC1738], section 2.2: Non-alphanumeric characters are replaced by'%HH'
, a percent sign and two hexadecimal digits representing the ASCII code of the character. Line breaks are represented as "CR LF" pairs (i.e.,'%0D%0A'
).The control names/values are listed in the order they appear in the document. The name is separated from the value by
'='
and name/value pairs are separated from each other by'&'
.
关于java - ServletFileUpload - ItemIterator 的顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6591547/
我正在使用公共(public) FileUpload 作为自定义 uploader 实现的一部分。特别是,我正在使用 ServletFileUpload 和 Streaming API ( http:
我是一名优秀的程序员,十分优秀!