[richfaces-issues] [JBoss JIRA] (RF-13719) rich.fileUpload breaks form action in portal

Jonáš Trantina (JIRA) issues at jboss.org
Mon Jul 14 06:00:36 EDT 2014


    [ https://issues.jboss.org/browse/RF-13719?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12984612#comment-12984612 ] 

Jonáš Trantina commented on RF-13719:
-------------------------------------

This is why I think this is a bug in RF:
RF looks for content of input[name='javax.faces.encodedURL'] and restores it to form action with higher priority than prior action in form.
However, content of input[name='javax.faces.encodedURL'] is a URL for submitting partial AJAX requests. According to [1] the input is created only if action URL (used for submitting normal requests) and partial action URL (used for submitting partial requests) are different.

Therefore in my opinion partial action URL should never be put into form's action url. Is that right?

[1] https://javaserverfaces.java.net/docs/2.0/pdldocs/facelets/h/form.html

> rich.fileUpload breaks form action in portal
> --------------------------------------------
>
>                 Key: RF-13719
>                 URL: https://issues.jboss.org/browse/RF-13719
>             Project: RichFaces
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: component-input
>    Affects Versions: 4.3.5
>         Environment: JBoss Portal 6.1.1
>            Reporter: Jonáš Trantina
>              Labels: gss
>         Attachments: reproducer.zip, reproducer2.zip
>
>
> When a rich:fileUpload si submitted (i.e. files are uploaded) action of the form is not preserved well.
> In fileupload.js __submit method there is the following code:
> {code:JavaScript}
> var encodedURLInputs = this.form.children("input[name='javax.faces.encodedURL']");
> var originalAction = encodedURLInputs.length > 0 ? encodedURLInputs.val() : this.form.attr("action");
> {code}
> the var "originalAction" is then used to revert to the original action url of the form. However, encodedURLInputs and form action prop does not contain the same url. Because encodedURLInputs has bigger priority URL from that input is restored into the form and not the original form action. This breaks the form as the next submission fails.
> In portal the solution is
> {code:JavaScript}
> var originalFormAction =this.form.attr("action");
> {code}
> and then restore "originalFormAction" instead of "originalAction", but I am not sure if this doesn't break anything in other environments.
> Is this a bug in richfaces or is the content of input[name='javax.faces.encodedURL'] set badly?
> To reproduce you can use the reproducer attached.
> Example URLs:
> form action
> {code}
> /portal/classic/home/uploadform?portal:componentId=834fa198-ff3d-4a5c-a1c7-33c85e8a410d&interactionstate=JBPNS_rO0ABXcsABBfanNmQnJpZGdlVmlld0lkAAAAAQALL2hvbWUueGh0bWwAB19fRU9GX18*&portal:type=action
> {code}
> input[name='javax.faces.encodedURL']
> {code}
> /portal/classic/home/uploadform?portal:windowState=normal&portal:componentId=834fa198-ff3d-4a5c-a1c7-33c85e8a410d&portal:cacheLevel=PAGE&resourcestate=JBPNS_rO0ABXdAABBfanNmQnJpZGdlVmlld0lkAAAAAQALL2hvbWUueGh0bWwACF9wYnJBamF4AAAAAQAEdHJ1ZQAHX19FT0ZfXw**&portal:type=resource&portal:portletMode=view
> {code}



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)



More information about the richfaces-issues mailing list