Methods Summary |
---|
public java.util.zip.GZIPOutputStream | getGZIPOutputStream()This gives the compression filter a handle on the GZIP output stream
so that it (the filter) can "finish" and flush the GZIP stream.
return this.servletGzipOS.internalGzipOS;
|
public javax.servlet.ServletOutputStream | getOutputStream()Provide access to a decorated servlet output stream.
// Allow the servlet to access a servlet output stream (SOS)
// only if the servlet has not already accessed the print writer.
if ( (streamUsed != null) && (streamUsed != servletGzipOS) ) {
throw new IllegalStateException();
}
// Wrap the original servlet output stream with our compression SOS.
// We'll look at this class in a minute.
if ( servletGzipOS == null ) {
servletGzipOS
= new GZIPServletOutputStream(getResponse()
.getOutputStream());
streamUsed = servletGzipOS;
}
return servletGzipOS;
|
public java.io.PrintWriter | getWriter()Provide access to a decorated print writer.
// Allow the servlet to access a print writer only if the
// servlet has not already accessed the servlet output stream.
if ( (streamUsed != null) && (streamUsed != pw) ) {
throw new IllegalStateException();
}
// To make a print writer, we have to first wrap the servlet output stream
// and then wrap the compression SOS in two additional OS decorators:
// OutputStreamWriter which converts characters into bytes, and then a
// PrintWriter on top of the OSWriter object.
if ( pw == null ) {
servletGzipOS
= new GZIPServletOutputStream(getResponse().getOutputStream());
// Use the response charset to create the OSWriter
OutputStreamWriter osw
= new OutputStreamWriter(servletGzipOS,
getResponse().getCharacterEncoding());
// Wrap the OSWriter in the PrintWriter
pw = new PrintWriter(osw);
streamUsed = pw;
}
return pw;
|
public void | setContentLength(int len)Ignore this method, because the real output will be compressed.
|