Class CachedBodyServletInputStream
java.lang.Object
java.io.InputStream
jakarta.servlet.ServletInputStream
org.trustdeck.security.audittrail.request.CachedBodyServletInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
public class CachedBodyServletInputStream
extends jakarta.servlet.ServletInputStream
Enables the servlet input stream to be read multiple times without being destroyed.
Adapted from Baeldung: Reading HttpServletRequest Multiple Times.
- Author:
- Baeldung, Armin Müller
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanisReady()intread()voidsetReadListener(jakarta.servlet.ReadListener readListener) This re-implementation will always throw an UnsupportedOperationException.Methods inherited from class jakarta.servlet.ServletInputStream
readLineMethods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
CachedBodyServletInputStream
public CachedBodyServletInputStream(byte[] cachedBody) Constructor.- Parameters:
cachedBody- the byte-array of the cached body.
-
-
Method Details
-
isFinished
public boolean isFinished()- Specified by:
isFinishedin classjakarta.servlet.ServletInputStream
-
isReady
public boolean isReady()- Specified by:
isReadyin classjakarta.servlet.ServletInputStream
-
setReadListener
public void setReadListener(jakarta.servlet.ReadListener readListener) This re-implementation will always throw an UnsupportedOperationException.- Specified by:
setReadListenerin classjakarta.servlet.ServletInputStream
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-