jsf - javax.servlet.ServletException: UT010016: Not a multi part request at io.undertow.servlet.spec.HttpServletRequestImpl.loadParts -
i've jsf 2.2 page below file upload form deployed wildfly 8.2.0.
<h:form> <h:inputfile value="#{filepair.miscpart}" /> <h:commandbutton value="submit" action="validationresult" /> </h:form>
when submit it, below exception:
javax.servlet.servletexception: ut010016: not multi part request @ io.undertow.servlet.spec.httpservletrequestimpl.loadparts(httpservletrequestimpl.java:508) @ io.undertow.servlet.spec.httpservletrequestimpl.getparts(httpservletrequestimpl.java:459) @ com.sun.faces.renderkit.html_basic.filerenderer.decode(filerenderer.java:91) @ javax.faces.component.uicomponentbase.decode(uicomponentbase.java:831) @ javax.faces.component.uiinput.decode(uiinput.java:771) @ javax.faces.component.uicomponentbase.processdecodes(uicomponentbase.java:1226) @ javax.faces.component.uiinput.processdecodes(uiinput.java:676) @ javax.faces.component.uiform.processdecodes(uiform.java:225) @ javax.faces.component.uicomponentbase.processdecodes(uicomponentbase.java:1221) @ javax.faces.component.uicomponentbase.processdecodes(uicomponentbase.java:1221) @ javax.faces.component.uiviewroot.processdecodes(uiviewroot.java:929) @ com.sun.faces.lifecycle.applyrequestvaluesphase.execute(applyrequestvaluesphase.java:78) @ com.sun.faces.lifecycle.phase.dophase(phase.java:101) @ com.sun.faces.lifecycle.lifecycleimpl.execute(lifecycleimpl.java:198) @ javax.faces.webapp.facesservlet.service(facesservlet.java:646) @ io.undertow.servlet.handlers.servlethandler.handlerequest(servlethandler.java:85) @ io.undertow.servlet.handlers.security.servletsecurityrolehandler.handlerequest(servletsecurityrolehandler.java:61) @ io.undertow.servlet.handlers.servletdispatchinghandler.handlerequest(servletdispatchinghandler.java:36) @ org.wildfly.extension.undertow.security.securitycontextassociationhandler.handlerequest(securitycontextassociationhandler.java:78) @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43) @ io.undertow.servlet.handlers.security.sslinformationassociationhandler.handlerequest(sslinformationassociationhandler.java:131) @ io.undertow.servlet.handlers.security.servletauthenticationcallhandler.handlerequest(servletauthenticationcallhandler.java:56) @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43) @ io.undertow.security.handlers.authenticationconstrainthandler.handlerequest(authenticationconstrainthandler.java:51) @ io.undertow.security.handlers.abstractconfidentialityhandler.handlerequest(abstractconfidentialityhandler.java:45) @ io.undertow.servlet.handlers.security.servletconfidentialityconstrainthandler.handlerequest(servletconfidentialityconstrainthandler.java:63) @ io.undertow.servlet.handlers.security.servletsecurityconstrainthandler.handlerequest(servletsecurityconstrainthandler.java:56) @ io.undertow.security.handlers.authenticationmechanismshandler.handlerequest(authenticationmechanismshandler.java:58) @ io.undertow.servlet.handlers.security.cachedauthenticatedsessionhandler.handlerequest(cachedauthenticatedsessionhandler.java:70) @ io.undertow.security.handlers.securityinitialhandler.handlerequest(securityinitialhandler.java:76) @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43) @ org.wildfly.extension.undertow.security.jacc.jacccontextidhandler.handlerequest(jacccontextidhandler.java:61) @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43) @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43) @ io.undertow.servlet.handlers.servletinitialhandler.handlefirstrequest(servletinitialhandler.java:261) @ io.undertow.servlet.handlers.servletinitialhandler.dispatchrequest(servletinitialhandler.java:247) @ io.undertow.servlet.handlers.servletinitialhandler.access$000(servletinitialhandler.java:76) @ io.undertow.servlet.handlers.servletinitialhandler$1.handlerequest(servletinitialhandler.java:166) @ io.undertow.server.connectors.executeroothandler(connectors.java:197) @ io.undertow.server.httpserverexchange$1.run(httpserverexchange.java:759) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745)
how caused , how can solve it?
you forgot set form encoding type via enctype
attribute.
<h:form>
it defaults application/x-www-form-urlencoded
insuitable sending binary data such binary files sent via <input type="file">
. need set multipart/form-data
per html specification when using <input type="file">
element (as generated jsf <h:inputfile>
). here's cite of relevance html specification:
enctype
= attribute specifies content type used submit form server (when value ofmethod
"post"). default value attribute "application/x-www-form-urlencoded". value "multipart/form-data" should used in combinationinput
element,type="file"
.
thus, fix accordingly:
<h:form enctype="multipart/form-data">
Comments
Post a Comment