Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4214

The wrong content type of "text/html" is set for Ajax responses

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Invalid
    • 2.2.12, 2.3.0, 2.3.1
    • None
    • General, Portlet_Support
    • None

    Description

      Steps to reproduce:

      1. Clone the wrong-content-type-ajax-excecute-all-reproducer project:
         git clone https://github.com/stiemannkj1/wrong-content-type-ajax-excecute-all-reproducer.git
        
      2. Build the project:
         cd wrong-content-type-ajax-excecute-all-reproducer && mvn clean package -P myfaces
        
      3. Deploy the project to Tomcat:
         cp target/*.war $TOMCAT_HOME/webapps/wrong-content-type-ajax-excecute-all-reproducer.war
        
      4. Navigate to the deployed webapp at http://localhost:8080/wrong-content-type-ajax-excecute-all-reproducer/.
      5. Note that the External Context Calls: show that setResponseContentType("text/html") was correctly called before the first call to getResponseOutputWriter().
      6. Click the Execute (default) Ajax Request button.
      7. Note the External Context Calls:.
      8. Click the Execute @all Ajax Request button.

      If the bug still exists, the External Context Calls: will show that setResponseContentType("text/html") was incorrectly called before the first call to getResponseOutputWriter() during Ajax requests.

      If the bug is fixed, the External Context Calls: will show that setResponseContentType("text/xml") was called immediately before the first call to getResponseOutputWriter().

      Additional Information:

      This issue does not affect Servlets but it does affect portlets which do not allow changing the content type after the first call to ExternalContext.getResponseOutputWriter() (Portlet Spec 3.0 Section 15.5.1 Content Type):

      The setContentType method must be called before the getWriter or getPortletOutputStream methods. Otherwise, the method will have no effect.

      Attachments

        Activity

          People

            tandraschko Thomas Andraschko
            stiemannkj1 Kyle Stiemann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: