Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3014

call to response.getOutputStream() during the rendering process fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 4.4
    • 4.2
    • None
    • None

      After the refactoring of the renderers in 4.0 we pass now the writer directly to the renderer. Which is done by calling response.getWriter(). This is very useful as this makes the rendering in general independent of the servlet API and allows direct calls to the rendering engine by Java code (for instance servlets or tests).

      Unfortunately a later call to response.getOutputStream() will fail as this violates the Servlet API specifications. There are several solutions possible.

      Workaround: registering your custom servlet (at the servlets filter) and let the request be rendered by the servlet and not by the rendering filter

      A) Pass a lazy wrapper instead of the writer
      instead of passing the writer we pass a lazy wrapper which will call response.getWriter() only once the first operation is performed on the writer

      • not very transparent
        + no changes in the API needed

      B) Change the API
      Support both variations of renderers. This can be achieved by various ways
      B.1) pass a object (magnolia response?) providing both methods which delegate to the response
      B.2) have two methods render(.., writer) and render(.. stream) (most likely by having two interfaces)

        Acceptance criteria

              tmattsson Tobias Mattsson
              pbaerfuss Philipp Bärfuss
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD