Author: michiel
Date: 2010-02-15 18:52:54 +0100 (Mon, 15 Feb 2010)
New Revision: 41028
Modified:
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/binaryValid.jspx
Log:
ported MMB-1910 from trunk
Modified:
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/binaryValid.jspx
===================================================================
---
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/binaryValid.jspx
2010-02-15 17:52:21 UTC (rev 41027)
+++
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/binaryValid.jspx
2010-02-15 17:52:54 UTC (rev 41028)
@@ -19,17 +19,21 @@
import="org.mmbase.datatypes.*,org.mmbase.util.*,org.mmbase.bridge.util.*,org.mmbase.datatypes.handlers.html.MultiPart"
/>
<jsp:directive.include file="get.datatype.jspxf" />
- <mm:import externid="fieldname" jspvar="fieldname" />
- <mm:import externid="length" jspvar="length" vartype="integer" />
+ <mm:import externid="fieldname" jspvar="fieldname" required="true" />
+ <mm:import externid="length" jspvar="length" vartype="integer"
required="true" />
+ <mm:import externid="type" jspvar="type" vartype="string" required="true" />
<mm:cloud uri="${param.uri}" name="${param.name}"><!-- cloud to provide
locale -->
<jsp:scriptlet>
- Object value;
+ SerializableInputStream value;
if (length == null) {
//probably using the horrible 'browser' from redmond
//MultiPart.MMultipartRequest multipart =
MultiPart.getMultipartRequest((HttpServletRequest) pageContext.getRequest(),
(HttpServletResponse) pageContext.getResponse());
length = request.getContentLength() - 224/* it's too much, we need to
guess the size of the headers, about 224 */;
}
value = new SerializableInputStream(new NullInputStream(length), length);
+ if (type.length() > 0) {
+ value.setContentType(type);
+ }
Collection<LocalizedString> errors = dataType == null ? new
ArrayList<LocalizedString>() : dataType.validate(value, node == null ?
null : new ChangedNode(node, field.getName()), field);
pageContext.setAttribute("errors", errors);
pageContext.setAttribute("node", node);
@@ -38,6 +42,7 @@
<result node="${empty node ? '' : node.number}"
field="${empty field ? '' : field.name}"
length="${length}"
+ type="${type}"
valid="${fn:length(errors) == 0}">
<jsp:scriptlet>
for (LocalizedString s : errors) {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs