You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Nicola Ken Barozzi <ni...@supereva.it> on 2000/09/14 16:04:59 UTC

Bug in Environment?

It seems there's a bug in the Enviornment subclasses.
The HttpEnvironment class returns the outputStream
directly, because of an error in its constructor:
    /**
     * Constructs a HttpEnvironment object from a HttpServletRequest
     * and HttpServletResponse objects
     */
    public HttpEnvironment (String uri, HttpServletRequest request,
                            HttpServletResponse response,
                            ServletContext servletContext)
    throws MalformedURLException, IOException {
        super(uri, request.getParameter("cocoon-view"), servletContext.getRealPath("/"));
        this.request = new HttpRequest (request, this);
        this.servletRequest = request;
        this.response = new HttpResponse (response);
        this.servletResponse = response;
        this.servletContext = servletContext;
--        this.outputStream = response.getOutputStream();
++        this.outputStream = this.response.getOutputStream();
        this.objectModel.put("request", this.request);
        this.objectModel.put("response", this.response);
        this.objectModel.put("context", this.servletContext);
    }

Response is also a local variable in fact.

nicola_ken

Nicola Ken Barozzi - AISA Industries S.p.A
http://www.aisaindustries.it/
Via Leonardo da Vinci,2 Ticengo (CR) Italy
Research Activity:
Politecnico di Milano - Dipartimento di Meccanica
Piazza Leonardo da Vinci, n.32 - 20133 Milano (Italy)