Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-147607

MimeResponseImpl.reset() does clear response output and header properties as required by the Portlet 3.0 Javadoc

    Details

      Description

      Problem Background

      The Javadoc for MimeResponse.reset() states:

      Clears any data that exists in the buffer as well as the properties set. If the response has been committed, this method throws an IllegalStateException.

      However, Liferay's implementation of this method only implements the IllegalStateException requirement. It does not clear response output and header properties:

      MimeResponseImpl.java
      @Override
      public void reset() {
      	if (_calledFlushBuffer) {
      		throw new IllegalStateException(
      			"Unable to reset a buffer that has been flushed");
      	}
      }
      

      One important reason why this problem has gone unnoticed, is because the Portlet 3.0 TCK does not properly test these requirements.

      Steps to Reproduce

      1. Deploy the attached com.liferay.faces.test.bridge.tck.main.portlet.war artifact to $LIFERAY_HOME/deploy

      2. Create a page named "Test"

      3. Add the portlet named "chapter6_1_3_3Tests-responseResetTest-portlet" to the page

      4. Click the "Run Test" button

      Expected Results

      The portlet renders a success message:

      PPR Result:Test: responseResetTest
      Status: SUCCESS
      Detail: externalContext.responseReset() functioned properly
      

      Actual Results

      The portlet renders a failure message:

      Response header 'foo' was incorrectly present and had a value of '1234'
      The span containing text 'This will not be present in the output' was incorrectly present
      

        Attachments

          Activity

            People

            Assignee:
            shuyang.zhou Shuyang Zhou
            Reporter:
            neil.griffin Neil Griffin
            Participants of an Issue:
            Recent user:
            Clarissa Velazquez
            Engineering Assignee:
            Neil Griffin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              25 weeks ago

                Packages

                Version Package
                Master