Class PageOutputStream

java.lang.Object
java.io.OutputStream
jakarta.servlet.ServletOutputStream
com.opensymphony.module.sitemesh.filter.PageOutputStream
All Implemented Interfaces:
OutputBuffer, Closeable, Flushable, AutoCloseable

public class PageOutputStream extends jakarta.servlet.ServletOutputStream implements OutputBuffer
Implementation of ServletOutputStream that stores all data written to it in a temporary buffer accessible from getBuffer(java.lang.String) .
Version:
$Revision: 1.4 $
Author:
Scott Farquhar, Hani Suleiman
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    private static final String
     
    private static final boolean
     
    private final jakarta.servlet.ServletResponse
    The reason we use a response, rather than just getting the outputstream directly is that under Tomcat, when serving static resources, we need to avoid calling getOutputStream() if we are going to use a decorator.
    private OutputStream
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PageOutputStream(jakarta.servlet.ServletResponse response)
    Construct an OutputStream that will buffer the content written to it.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
     
    char[]
    get14Buffer(String encoding)
     
    char[]
    getBuffer(String encoding)
     
    boolean
     
    void
    setWriteListener(jakarta.servlet.WriteListener writeListenerIn)
     
    private static char[]
    trim(char[] ca, int len)
     
    void
    write(int b)
     

    Methods inherited from class jakarta.servlet.ServletOutputStream

    close, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, write

    Methods inherited from class java.io.OutputStream

    nullOutputStream, write, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • buffer

      private ByteArrayOutputStream buffer
    • target

      private OutputStream target
    • DEFAULT_ENCODING

      private static final String DEFAULT_ENCODING
    • JDK14

      private static final boolean JDK14
    • response

      private final jakarta.servlet.ServletResponse response
      The reason we use a response, rather than just getting the outputstream directly is that under Tomcat, when serving static resources, we need to avoid calling getOutputStream() if we are going to use a decorator.

      More information: http://marc.theaimsgroup.com/?l=tomcat-userinvalid input: '&m'=107569601410973invalid input: '&w'=2, SIM-74, SIM-82

  • Constructor Details

    • PageOutputStream

      public PageOutputStream(jakarta.servlet.ServletResponse response)
      Construct an OutputStream that will buffer the content written to it.
  • Method Details

    • write

      public void write(int b) throws IOException
      Specified by:
      write in class OutputStream
      Throws:
      IOException
    • discardBuffer

      public void discardBuffer()
      Specified by:
      discardBuffer in interface OutputBuffer
    • get14Buffer

      public char[] get14Buffer(String encoding)
    • trim

      private static char[] trim(char[] ca, int len)
    • getBuffer

      public char[] getBuffer(String encoding)
      Specified by:
      getBuffer in interface OutputBuffer
      Parameters:
      encoding - The encoding to use for decoding the buffer
    • flush

      public void flush()
      Specified by:
      flush in interface Flushable
      Specified by:
      flush in interface OutputBuffer
      Overrides:
      flush in class OutputStream
    • isReady

      public boolean isReady()
      Specified by:
      isReady in class jakarta.servlet.ServletOutputStream
    • setWriteListener

      public void setWriteListener(jakarta.servlet.WriteListener writeListenerIn)
      Specified by:
      setWriteListener in class jakarta.servlet.ServletOutputStream