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

Support ExternalContext.setResponseStatus(int statusCode)

    Details

      Description

      The ExternalContext.setResponseStatus(int statusCode) method was added in JSF 2.0.

      The FacesBridge must follow the requirements in the JSF 2.2 JavaDoc. However, in a portlet environment it is only possible to set the response status during the RESOURCE_PHASE of the portlet lifecycle. Because of this, the FacesBridge will only be required to set the status code during the RESOURCE_PHASE. Rather than calling HttpServletResponse.setStatus(int statusCode), the FacesBridge must call the new Portlet 3.0 ResourceResponse.setStatus(int statusCode) method. In all other phases of the portlet lifecycle, calling ExternalContext.setResponseStatus(int statusCode) is a no-op for the FacesBridge.

      TCK: setResponseStatusTest (bridge-tck-main-portlet)

      • Dispatch an XHR that targets the ResourceURL for a known cacheable image resource such as "#{resource[myValidLibrary:myValidImage]}" and verify that the status code is HttpServletResponse.SC_OK (200).
      • Dispatch an XHR that targets the ResourceURL for the same cacheable image resource such as "#{resource[myValidLibrary:myValidImage]}" and verify that the status code is HttpServletResponse.NOT_MODIFIED (304).
      • Dispatch an XHR that targets the ResourceURL for a missing image resource such as "#{resource[myInvalidLibrary:myValidImage]}" and verify that the status code is HttpServletResponse.SC_NOT_FOUND (404).
      • Dispatch an XHR that targets the ResourceURL for a missing image resource such as "#{resource[myValidLibrary:myInvalidImage]}" and verify that the status code is HttpServletResponse.SC_NOT_FOUND (404).
      • Dispatch an XHR that targets the ResourceURL for a banned path such as "/WEB-INF" and verify that the status code is HttpServletResponse.SC_NOT_FOUND (404).
      • Dispatch an XHR that targets the ResourceURL for a banned character sequence such as "../../" and verify that the status code is HttpServletResponse.SC_NOT_FOUND (404).
      • Dispatch an XHR that targets the ResourceURL for a facelet document such as "myView.xhtml" and verify that the status code is HttpServletResponse.SC_NOT_FOUND (404).

      Note that additional TCK test assertions may need to be added as the FacesBridge ResourceHandler security requirements are fully established.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Packages

                  Version Package
                  facesbridge-api-5.0.0
                  facesbridge-tck-5.0.0
                  facesbridge-spec-5.0.0
                  bridge-impl-5.0.0