Version 9

    I'm using a SpringMVC portlet with JBossPortal2.0.

    Spring has a lot of different ways to output your pages - with various View implementations.

    One of those is also AbstractXsltView.

    There you have to have to define a XML source and a XSLT templete and then the view simply renders it to the response.

    It uses response.getOutputStream() to define the result of your transformation.

    But that didn't work for me (see Julien's reasons).

    Simple chat with Julien solved my problems - change the result of your transformation from 'new StreamResult(new BufferedOutputStream(response.getOutputStream()))' to 'new StreamResult(new BufferedWriter(response.getWriter()))'.

     

    Overridden code from AbstractXsltView:

        protected void doTransform(Map model, Source source, HttpServletRequest request, HttpServletResponse response) throws Exception 
        {
            doTransform(
                    source, 
                    getParameters(request),
                    new StreamResult(new BufferedWriter(response.getWriter())),
                    response.getCharacterEncoding()
            );
        }