use of org.apache.myfaces.renderkit.html.util.HttpPartWrapper in project myfaces by apache.
the class HtmlInputFileRendererBase method decode.
@Override
public void decode(FacesContext facesContext, UIComponent component) {
try {
String clientId = component.getClientId();
HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
Collection<Part> parts = request.getParts();
Collection<Part> submittedValues = new ArrayList<>(parts.size());
for (Part part : parts) {
if (clientId.equals(part.getName())) {
HttpPartWrapper wrapper = new HttpPartWrapper(part);
submittedValues.add(wrapper);
}
}
if (((HtmlInputFile) component).isMultiple()) {
((UIInput) component).setSubmittedValue(submittedValues);
} else if (!submittedValues.isEmpty()) {
((UIInput) component).setSubmittedValue(submittedValues.iterator().next());
}
} catch (IOException | ServletException e) {
throw new FacesException(e);
}
if (component instanceof ClientBehaviorHolder && !HtmlRendererUtils.isDisabled(component)) {
ClientBehaviorRendererUtils.decodeClientBehaviors(facesContext, component);
}
}
Aggregations