public static class DynamicMappingFilter.TempBufferWriter extends Writer
A Writer that passes characters to a PrintWriter. It buffers the first
N characters written to it and automatically overflows when the number of characters
written exceeds the limit. The size of the buffer defaults to 1024 characters, but it can be
changed using the IncludeBufferSize filter init-param in web.xml. If
IncludeBufferSize is zero or negative, then a DynamicMappingFilter.TempBufferWriter will not be
used at all. This is only a good idea if your servlet container does not write an error
message to output when it can't find an included resource or if you only include resources
that do not depend on this filter to be delivered, such as other servlets, JSPs, static
resources, ActionBeans that are mapped with a prefix (/action/*) or suffix (*.action),
etc.
This writer is used to partially buffer the output of includes. Some (all?) servlet
containers write a message to the output stream indicating if an included resource is missing
because if the response has already been committed, they cannot send a 404 error. Since the
filter depends on getting a 404 before it attempts to dispatch an ActionBean, that
is problematic. So in using this writer, we assume that the length of the "missing resource"
message will be less than the buffer size and we discard that message if we're able to map
the included URL to an ActionBean. If there is no 404 then the output will be sent
normally. If there is a 404 and the URL does not match an ActionBean then the "missing
resource" message is sent through.
| Constructor and Description |
|---|
DynamicMappingFilter.TempBufferWriter(PrintWriter out) |
public DynamicMappingFilter.TempBufferWriter(PrintWriter out)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class WriterIOExceptionpublic void write(char[] chars,
int offset,
int length)
throws IOException
write in class WriterIOExceptionprotected void overflow()
overflow(), all future writes to this writer will pass directly to the
underlying writer.© Copyright 2005-2006, Stripes Development Team.