org.owasp.esapi.waf.internal
Class InterceptingServletOutputStream
java.lang.Object
java.io.OutputStream
javax.servlet.ServletOutputStream
org.owasp.esapi.waf.internal.InterceptingServletOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class InterceptingServletOutputStream
- extends javax.servlet.ServletOutputStream
This class was inspired by ModSecurity for Java by Ivan Ristic. We hook
the response stream and queue up all outbound data so that we can apply
egress rules. For efficiency, we decide off the bat if we need to buffer
responses to accomplish any of the rules in the policy file.
If not, we just forward everything through, otherwise we write data to our
byte stream that we will eventually forward en totale to the user agent.
- Author:
- Arshan Dabirsiaghi
Methods inherited from class javax.servlet.ServletOutputStream |
print, print, print, print, print, print, print, println, println, println, println, println, println, println, println |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InterceptingServletOutputStream
public InterceptingServletOutputStream(javax.servlet.ServletOutputStream os,
boolean buffered)
throws FileNotFoundException,
IOException
- Throws:
FileNotFoundException
IOException
reset
public void reset()
throws IOException
- Throws:
IOException
getResponseBytes
public byte[] getResponseBytes()
throws IOException
- Throws:
IOException
setResponseBytes
public void setResponseBytes(byte[] responseBytes)
throws IOException
- Throws:
IOException
write
public void write(int i)
throws IOException
- Specified by:
write
in class OutputStream
- Throws:
IOException
write
public void write(byte[] b)
throws IOException
- Overrides:
write
in class OutputStream
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Overrides:
write
in class OutputStream
- Throws:
IOException
flush
public void flush()
throws IOException
- Specified by:
flush
in interface Flushable
- Overrides:
flush
in class OutputStream
- Throws:
IOException
commit
public void commit()
throws IOException
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Overrides:
close
in class OutputStream
- Throws:
IOException
Copyright © 2013 The Open Web Application Security Project (OWASP). All Rights Reserved.