Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-7075

ServletWebResponse allows writing headers to committed HttpServletResponse

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 10.0.0-M1
    • 10.0.0-M2
    • wicket-core
    • None
    • Jetty 12

    Description

      Background

      I'm in the progress of migrating a number of Wicket projects to Jakarta namespaced libraries. Due to dependencies outside of Wicket requiring Servlet API version 6, I ended up using Jetty 12 as a servlet container.

      Problem

      When running on Jetty 12, CrossOriginOpenerPolicyRequestCycleListener attempts to set headers on a response that has already been committed, resulting in an UnsupportedOperationException.

      This does not appear to affect the application's basic operation, other than polluting the logs with stacktraces.

      Proposed solution

      The current implementation of CrossOriginOpenerPolicyRequestCycleListener already checks the WebResponse's isHeaderSupported method to see if headers can be set, but the implementation of ServletWebResponse always returns true. By modifying this implementation to check the underlying HttpServletResponse if the response has been committed we can make this check work as intended.

      I have submitted a PR for this solution.

      Attachments

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              jeroenfm Jeroen Steenbeeke
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: