Primefaces 2.2RC2 fileupload problems with SpringWebFlow

UI Components for JSF
Post Reply
jeffg
Posts: 8
Joined: 07 Dec 2010, 20:06

07 Dec 2010, 20:45

I'm using primefaces 2.2.RC2, Springframework 3.0.4.RELEASE, and SpringWebFlow (2.2.1.RELEASE) with Tomcat 6 and we're unable to successfully upload files with our web app.

Project dependencies from my POM:
------------------------------------------
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>2.2.RC2</version>
</dependency>

From the applications web.xml
-----------------------------------
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>51200</param-value>
</init-param>
<init-param>
<param-name>uploadDirectory</param-name>
<param-value>c:/temp</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

From the xhtml page:
-------------------------
<p:layoutUnit position="center" header="Form">
<h:form enctype="multipart/form-data" prependId="false">
<br/>
<p:growl id="messages" showSummary="true" showDetail="true"/>
<p:fileUpload fileUploadListener="#{testModel.handleFileUpload}" multiple="true" update="messages" sizeLimit="1073741824" allowTypes="*.pdf;*.txt;*.doc;" description="Documents"/>
</h:form>
</p:layoutUnit>

Here is what the client source shows:
-------------------------------------
<object width="110" height="30" type="application/x-shockwave-flash" data="/SpringWebFlow-0.0.1/spring/javax.faces.resource/fileupload/uploadify.swf?ln=primefaces&amp;v=2.2.RC2" id="j_idt14_fileUploader" style="visibility: visible;">
<param name="quality" value="high">
<param name="wmode" value="opaque">
<param name="allowScriptAccess" value="sameDomain">
<param name="flashvars" value="uploadifyID=j_idt14_file&pagepath=/SpringWebFlow-0.0.1/spring/&script=/SpringWebFlow-0.0.1/spring/fileupload;jsessionid=5F3E1ECDEFB613A7AB10D361AAD6DF4A?execution=e1s1&folder=&scriptData=javax.faces.partial.ajax%3Dtrue%26javax.faces.partial.execute%3Dj_idt14%26javax.faces.source%3Dj_idt14%26javax.faces.ViewState%3De1s1%26javax.faces.partial.render%3Dmessages%26cid%3D%23%7Bjavax.enterprise.context.conversation.id%7D&width=110&height=30&wmode=opaque&method=POST&queueSizeLimit=999&simUploadLimit=1&fileDesc=Documents&fileExt=*.pdf;*.txt;*.doc;&multi=true&sizeLimit=1073741824&fileDataName=j_idt14_file">
</object>

Steps taken to test:
-----------------------
I click the browse button then find a file to upload.
Then the component shows the name of the file and its size (as if its ready to do a file upload).
Then I click the upload link but nothing really happens after that on the server side.
The client side says it was successfully uploaded but no file is uploaded.


Here is what my log file states:

2010-12-07 10:33:16 Mapping request with URI '/SpringWebFlow-0.0.1/spring/fileupload' to flow with id 'fileupload'
2010-12-07 10:33:16 Resuming flow execution with key 'e2s1
2010-12-07 10:33:16 Locking conversation 2
2010-12-07 10:33:16 Getting flow execution with key 'e2s1'
2010-12-07 10:33:16 Getting FlowDefinition with id 'fileupload'
2010-12-07 10:33:16 Loaded [1] of possible 1 listeners for this execution request for flow 'fileupload', the listeners to attach are list[org.springframework.faces.webflow.FlowFacesContextLifecycleListener@e4e358]
2010-12-07 10:33:16 Resuming in org.springframework.webflow.mvc.servlet.MvcExternalContext@14510ac
2010-12-07 10:33:16 Restoring [FlowVariable@1f13b08 name = 'testModel', valueFactory = [BeanFactoryVariableValueFactory@5a936b type = ValidationAnnotationsModel]]
2010-12-07 10:33:16 Entering JSF Phase: RESTORE_VIEW 1
2010-12-07 10:33:16 UIViewRoot restored for 'test.xhtml'
2010-12-07 10:33:16 Rendering + [JSFView = '/WEB-INF/flows/fileupload/test.xhtml']
2010-12-07 10:33:16 Flash scope = map[[empty]]
2010-12-07 10:33:16 Messages = [DefaultMessageContext@b99e4c sourceMessages = map[[null] -> list[[empty]]]]
2010-12-07 10:33:16 Asking faces lifecycle to render
2010-12-07 10:33:16 Entering JSF Phase: RENDER_RESPONSE 6
2010-12-07 10:33:16 View rendering complete
2010-12-07 10:33:16 Putting flow execution '[FlowExecutionImpl@47c130 flow = 'fileupload', flowSessions = list[[FlowSessionImpl@dc5434 flow = 'fileupload', state = 'test', scope = map['testModel' -> com.costco.eforms.models.ValidationAnnotationsModel@11c4123, 'viewScope' -> map['flowSerializedViewState' -> [FlowSerializedView@1f873dd viewId = '/WEB-INF/flows/fileupload/test.xhtml']]]]]]' into repository
2010-12-07 10:33:16 Adding snapshot to group with id 1
2010-12-07 10:33:16 Putting conversation attribute 'scope' with value map['flashScope' -> map['messagesMemento' -> map[[empty]]]]
2010-12-07 10:33:16 Unlocking conversation 2


Any ideas as to what I'm doing wrong???

Thanks in advance,

JeffG

PS. I did patch my fileupload.js script at the end with the following:

PrimeFaces.widget.Uploader.prototype._createPostParams = function() {
var b = {}; b[PrimeFaces.PARTIAL_REQUEST_PARAM] = true;
b[PrimeFaces.PARTIAL_PROCESS_PARAM] = this.id;
b[PrimeFaces.PARTIAL_SOURCE_PARAM] = this.id;
b[PrimeFaces.VIEW_STATE] = PrimeFaces.ajax.AjaxUtils.encodeViewState();
if (this.cfg.update) {
b[PrimeFaces.PARTIAL_UPDATE_PARAM] = this.cfg.update
}
var a = PrimeFaces.getCookie("JSESSIONID");
if (this.cfg.script.indexOf("jsessionid") == -1) {
paramIndex = this.cfg.script.indexOf('?');
if (paramIndex != -1) {
this.cfg.script = this.cfg.script.substring(0, paramIndex)
+ ";jsessionid=" + a
+ this.cfg.script.substring(paramIndex);
} else {
this.cfg.script = this.cfg.script + ";jsessionid=" + a;
}
}
b['cid'] = "#{javax.enterprise.context.conversation.id}";
return b;
};

PrimeFaces.widget.Uploader.prototype.createPostParams = PrimeFaces.widget.Uploader.prototype._createPostParams;

jeffg
Posts: 8
Joined: 07 Dec 2010, 20:06

28 Dec 2010, 18:32

Here is what my uploadify object looks like:

<object width="110" height="30" type="application/x-shockwave-flash" data="/SpringWebFlow-0.0.1/spring/javax.faces.resource/fileupload/uploadify.swf?ln=primefaces&amp;v=2.2.RC2" id="j_idt12_j_idt14_fileUploader" style="visibility: visible;">
<param name="quality" value="high">
<param name="wmode" value="opaque">
<param name="allowScriptAccess" value="sameDomain">
<param name="flashvars" value="uploadifyID=j_idt12_j_idt14_file&pagepath=/SpringWebFlow-0.0.1/spring/&script=/SpringWebFlow-0.0.1/spring/fileupload;jsessionid=9AC418F1F899BA38653D73A3E5F5D7EF?execution=e1s1&folder=&scriptData=javax.faces.partial.ajax%3Dtrue%26javax.faces.partial.execute%3Dj_idt12%3Aj_idt14%26javax.faces.source%3Dj_idt12%3Aj_idt14%26javax.faces.ViewState%3De1s1%26javax.faces.partial.render%3Dj_idt12%3Amessages%26cid%3D%23%7Bjavax.enterprise.context.conversation.id%7D&width=110&height=30&wmode=opaque&method=POST&queueSizeLimit=999&simUploadLimit=1&fileDesc=Documents&fileExt=*.pdf;*.txt;*.doc;&multi=true&sizeLimit=1073741824&fileDataName=j_idt12_j_idt14_file">
</object>

Uploading of the file shows up as being successful but nothing in the way of a file shows up within my defined upload directory. :(

Jeffg

aareshchanka
Posts: 15
Joined: 04 Nov 2010, 02:31

29 Dec 2010, 19:58

check your web.xml file:
file upload component needs server STATE_SAVING_METHOD

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>

also check if upload filter is defined too.
PrimeFaces 5.2-SNAPSHOT, Mojarra 2.2.7, Tomcat 7.0.55, Oracle JDK 7

jeffg
Posts: 8
Joined: 07 Dec 2010, 20:06

03 Jan 2011, 20:02

Hey aareshchanka,

I really appreciate your response.

So I modified my web.xml to make sure it included the following:

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>

No difference. My event handler still isn't being invoked. :(

Jeff

aareshchanka
Posts: 15
Joined: 04 Nov 2010, 02:31

04 Jan 2011, 15:46

Try to compare your configuration with

https://src.springframework.org/svn/spr ... s-showcase

this is an example of SWF + primefaces, there is also fileupload example there and it works fine.
PrimeFaces 5.2-SNAPSHOT, Mojarra 2.2.7, Tomcat 7.0.55, Oracle JDK 7

jeffg
Posts: 8
Joined: 07 Dec 2010, 20:06

24 Jan 2011, 21:08

Still working the issue.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

24 Jan 2011, 21:34

Try 2.2. snapshot nightly.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests