/*
 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

/*
 * $Id: BufferedResponseWrapper.java 62525 2011-04-15 12:14:31Z dougd $
 */
package com.sun.ts.tests.jsf.api.javax_faces.component.common;

import java.io.StringWriter;
import java.io.PrintWriter;
import java.io.IOException;

import javax.servlet.http.HttpServletResponseWrapper;
import javax.servlet.http.HttpServletResponse;

public class BufferedResponseWrapper extends HttpServletResponseWrapper {

    //HttpServletResponse response;
    StringWriter writer;

    public BufferedResponseWrapper(HttpServletResponse response) {

        super(response);
        //this.response = response;

    }


    public PrintWriter getWriter() throws IOException {

        writer = new StringWriter();
        return new PrintWriter(writer);

    }

    public StringWriter getBufferedWriter() {

        if (writer == null) {
            return new StringWriter();
        }
        return writer;

    }

}
