Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-2958

bridge creates invalid URLs when view params contain spaces in liferay

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: bridge-ext-1.0.0, bridge-ext-2.0.0, bridge-ext-3.0.0, bridge-ext-4.0.0, bridge-ext-5.0.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      Steps to reproduce:

      1. Change the jsf-applicant-portlet code:

      ApplicantBackingBean.java
      /* ... */
      
      public String getRenderRedirURL() {
      
      	HashMap<String, List<String>> parameters = new HashMap<String, List<String>>();
      	ArrayList<String> values = new ArrayList<String>();
      	values.add("adsf asdf ");
      	parameters.put("param", values);
      
      	return FacesContext.getCurrentInstance().getExternalContext().encodeRedirectURL("/o/com.liferay.faces.demo.jsf.applicant.portlet/WEB-INF/views/search.xhtml", parameters);
      }
      
      /* ... */
      
      portletViewMode.xhtml
      <f:view xmlns="http://www.w3.org/1999/xhtml"
      		xmlns:f="http://java.sun.com/jsf/core"
      		xmlns:h="http://java.sun.com/jsf/html">
      
      	<h:head />
      
      	<f:metadata>
      		<f:viewParam name="param" value="asdf asdf " />
      	</f:metadata>
      
      	<h:body>
      		<h:form>
      			<h:commandButton value="portletViewMode ajax" action="portletViewMode?faces-redirect=true&amp;includeViewParams=true">
      				<f:ajax />
      			</h:commandButton>
      			<h:commandButton value="portletViewMode" action="portletViewMode?faces-redirect=true&amp;includeViewParams=true" />
      			<br />
      			#{applicantBackingBean.renderRedirURL}
      		</h:form>
      	</h:body>
      </f:view>
      

      2. Deploy and navigate to the jsf-applicant-portlet.
      3. Observe the url that appears (generated dureing RENDER_PHASE).
      4. If the url contains param=adsf asdf }} then the bug still exists for redirect urls generated during the {{RENDER_PHASE. If the url contains param=adsf+asdf+, then the bug is fixed for the RENDER_PHASE.
      5. Click the search ajax button.
      6. If the portlet navigates back to portletViewMode.xhtml via ajax and the url contains param=adsf+asdf+, the bug is fixed. Otherwise the bug still exists.

      Workaround

      Since the redirect url parameters are generated correctly in the ACTION_PHASE, you can use a non-ajax command button to redirect to views view parameters with spaces in them:

      <h:commandButton value="portletViewMode" action="portletViewMode?faces-redirect=true&amp;includeViewParams=true" />
      

        Activity

        Hide
        kyle.stiemann Kyle Stiemann added a comment -

        Progress is being made on this branch: https://github.com/stiemannkj1/liferay-faces-bridge-ext/tree/view-params-fail-with-spaces-FACES-2958-5.x

        However, the current commit causes two tck failures:

        eventScopeNotRestoredRedirectTest(com.liferay.faces.bridge.tck.harness.TckTestCase): 1 full page request action(s) have been performed on this portlet without any final result or test components to exercise.(..)
        
        encodeActionURLWithInvalidWindowStateResourceTest(com.liferay.faces.bridge.tck.harness.TckTestCase): No valid response to PPR action.(..)
        
        Show
        kyle.stiemann Kyle Stiemann added a comment - Progress is being made on this branch: https://github.com/stiemannkj1/liferay-faces-bridge-ext/tree/view-params-fail-with-spaces-FACES-2958-5.x However, the current commit causes two tck failures: eventScopeNotRestoredRedirectTest(com.liferay.faces.bridge.tck.harness.TckTestCase): 1 full page request action(s) have been performed on this portlet without any final result or test components to exercise.(..) encodeActionURLWithInvalidWindowStateResourceTest(com.liferay.faces.bridge.tck.harness.TckTestCase): No valid response to PPR action.(..)

          People

          • Assignee:
            kyle.stiemann Kyle Stiemann
            Reporter:
            kyle.stiemann Kyle Stiemann
            Participants of an Issue:
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development

                Subcomponents