Could not upload file with prettyfaces filter

Splash Forums PrettyFaces Users Could not upload file with prettyfaces filter

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Christian Kaltepoth 1 year, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #27099

    sujith ps
    Participant

    When I am adding the filter codes in my web.xml

    <filter>
    		<filter-name>Pretty Filter</filter-name>
    		<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
    		<async-supported>true</async-supported>
    	</filter>
    	
    	<filter-mapping>
    		<filter-name>Pretty Filter</filter-name>
    		<url-pattern>/*</url-pattern>
    		<dispatcher>FORWARD</dispatcher>
    		<dispatcher>REQUEST</dispatcher>
    		<dispatcher>ASYNC</dispatcher>
    		<dispatcher>ERROR</dispatcher>
    	</filter-mapping>

    I am unable to upload a file and getting exception :

     javax.servlet.ServletException: 0
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    ........
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
    	at com.ocpsoft.pretty.faces.servlet.PrettyFacesWrappedRequest.getParameter(PrettyFacesWrappedRequest.java:55) [prettyfaces-jsf2-3.3.3.jar:]
    	at com.sun.faces.context.RequestParameterMap.containsKey(RequestParameterMap.java:147) [jsf-impl-2.2.8-jbossorg-1.jar:]
    ......

    The jsf code is

    <h:form enctype="multipart/form-data" id="myForm">
    					<h:inputFile id="file" label="file"
    						value="#{myBean.uploadedFile}" required="true"
    						requiredMessage="File not selected !!">
    						 
    					</h:inputFile>
    					<h:message style="color: red" for="file" />
    					<br />
    
    					<h:commandButton id="submit"
    						action="#{myBean.process}" value="upload file">
    						<f:param name="product" value="#{param.product}"></f:param>
    					</h:commandButton>
    					<br />
     
    				</h:form>

    If I remove the filter code from web.xml, I am able to upload file and submit the form , otherwise I am getting the above mentioned exception.

    #27102

    See my comment on stackoverflow:

    http://stackoverflow.com/a/29840418/395181

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Comments are closed.