Class RoutableServletOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- javax.servlet.ServletOutputStream
-
- com.opensymphony.module.sitemesh.filter.RoutableServletOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class RoutableServletOutputStream extends javax.servlet.ServletOutputStreamProvides a ServletOutputStream that routes through to another ServletOutputStream, however the destination can be changed at any point. The destination can be passed in using a factory, so it will not be created until it's actually needed.- Version:
- $Revision: 1.1 $
- Author:
- Joe Walnes
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRoutableServletOutputStream.DestinationFactoryFactory to lazily instantiate the destination.
-
Field Summary
Fields Modifier and Type Field Description private javax.servlet.ServletOutputStreamdestinationprivate RoutableServletOutputStream.DestinationFactoryfactory
-
Constructor Summary
Constructors Constructor Description RoutableServletOutputStream(RoutableServletOutputStream.DestinationFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()private javax.servlet.ServletOutputStreamgetDestination()booleanisReady()voidprint(boolean b)voidprint(char c)voidprint(double v)voidprint(float v)voidprint(int i)voidprint(long l)voidprint(String s)voidprintln()voidprintln(boolean b)voidprintln(char c)voidprintln(double v)voidprintln(float v)voidprintln(int i)voidprintln(long l)voidprintln(String s)voidsetWriteListener(javax.servlet.WriteListener listener)voidupdateDestination(RoutableServletOutputStream.DestinationFactory factory)voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Field Detail
-
destination
private javax.servlet.ServletOutputStream destination
-
factory
private RoutableServletOutputStream.DestinationFactory factory
-
-
Constructor Detail
-
RoutableServletOutputStream
public RoutableServletOutputStream(RoutableServletOutputStream.DestinationFactory factory)
-
-
Method Detail
-
getDestination
private javax.servlet.ServletOutputStream getDestination() throws IOException- Throws:
IOException
-
updateDestination
public void updateDestination(RoutableServletOutputStream.DestinationFactory factory)
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
print
public void print(String s) throws IOException
- Overrides:
printin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
print
public void print(boolean b) throws IOException- Overrides:
printin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
print
public void print(char c) throws IOException- Overrides:
printin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
print
public void print(int i) throws IOException- Overrides:
printin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
print
public void print(long l) throws IOException- Overrides:
printin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
print
public void print(float v) throws IOException- Overrides:
printin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
print
public void print(double v) throws IOException- Overrides:
printin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
println
public void println() throws IOException- Overrides:
printlnin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
println
public void println(String s) throws IOException
- Overrides:
printlnin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
println
public void println(boolean b) throws IOException- Overrides:
printlnin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
println
public void println(char c) throws IOException- Overrides:
printlnin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
println
public void println(int i) throws IOException- Overrides:
printlnin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
println
public void println(long l) throws IOException- Overrides:
printlnin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
println
public void println(float v) throws IOException- Overrides:
printlnin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
println
public void println(double v) throws IOException- Overrides:
printlnin classjavax.servlet.ServletOutputStream- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
setWriteListener
public void setWriteListener(javax.servlet.WriteListener listener)
- Specified by:
setWriteListenerin classjavax.servlet.ServletOutputStream
-
isReady
public boolean isReady()
- Specified by:
isReadyin classjavax.servlet.ServletOutputStream
-
-