Search in sources :

Example 1 with GrailsRoutablePrintWriter

use of org.grails.web.sitemesh.GrailsRoutablePrintWriter in project grails-core by grails.

the class GSPResponseWriter method getInstance.

/**
     * Static factory method to create the writer.
     *
     * TODO: this can be removed?
     *
     * @param target The target writer to write too
     * @param max
     * @return  A GSPResponseWriter instance
     */
@SuppressWarnings("unused")
private static GSPResponseWriter getInstance(Writer target, int max) {
    if (BUFFERING_ENABLED && !(target instanceof GrailsRoutablePrintWriter) && !(target instanceof StreamCharBufferWriter)) {
        StreamCharBuffer streamBuffer = new StreamCharBuffer(max, 0, max);
        streamBuffer.connectTo(target, false);
        target = streamBuffer.getWriter();
    }
    if (instantiator == null) {
        return new GSPResponseWriter(target);
    }
    GSPResponseWriter instance = (GSPResponseWriter) instantiator.newInstance();
    instance.initialize(target);
    return instance;
}
Also used : GrailsRoutablePrintWriter(org.grails.web.sitemesh.GrailsRoutablePrintWriter) StreamCharBufferWriter(org.grails.buffer.StreamCharBuffer.StreamCharBufferWriter) StreamCharBuffer(org.grails.buffer.StreamCharBuffer)

Aggregations

StreamCharBuffer (org.grails.buffer.StreamCharBuffer)1 StreamCharBufferWriter (org.grails.buffer.StreamCharBuffer.StreamCharBufferWriter)1 GrailsRoutablePrintWriter (org.grails.web.sitemesh.GrailsRoutablePrintWriter)1