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.ServletOutputStream
Provides 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 interface
RoutableServletOutputStream.DestinationFactory
Factory to lazily instantiate the destination.
-
Field Summary
Fields Modifier and Type Field Description private javax.servlet.ServletOutputStream
destination
private RoutableServletOutputStream.DestinationFactory
factory
-
Constructor Summary
Constructors Constructor Description RoutableServletOutputStream(RoutableServletOutputStream.DestinationFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
private javax.servlet.ServletOutputStream
getDestination()
boolean
isReady()
void
print(boolean b)
void
print(char c)
void
print(double v)
void
print(float v)
void
print(int i)
void
print(long l)
void
print(String s)
void
println()
void
println(boolean b)
void
println(char c)
void
println(double v)
void
println(float v)
void
println(int i)
void
println(long l)
void
println(String s)
void
setWriteListener(javax.servlet.WriteListener listener)
void
updateDestination(RoutableServletOutputStream.DestinationFactory factory)
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
print
public void print(String s) throws IOException
- Overrides:
print
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
print
public void print(boolean b) throws IOException
- Overrides:
print
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
print
public void print(char c) throws IOException
- Overrides:
print
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
print
public void print(int i) throws IOException
- Overrides:
print
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
print
public void print(long l) throws IOException
- Overrides:
print
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
print
public void print(float v) throws IOException
- Overrides:
print
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
print
public void print(double v) throws IOException
- Overrides:
print
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
println
public void println() throws IOException
- Overrides:
println
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
println
public void println(String s) throws IOException
- Overrides:
println
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
println
public void println(boolean b) throws IOException
- Overrides:
println
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
println
public void println(char c) throws IOException
- Overrides:
println
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
println
public void println(int i) throws IOException
- Overrides:
println
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
println
public void println(long l) throws IOException
- Overrides:
println
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
println
public void println(float v) throws IOException
- Overrides:
println
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
println
public void println(double v) throws IOException
- Overrides:
println
in classjavax.servlet.ServletOutputStream
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
setWriteListener
public void setWriteListener(javax.servlet.WriteListener listener)
- Specified by:
setWriteListener
in classjavax.servlet.ServletOutputStream
-
isReady
public boolean isReady()
- Specified by:
isReady
in classjavax.servlet.ServletOutputStream
-
-