- java.lang.Object
-
- java.io.InputStream
-
- jakarta.servlet.ServletInputStream
-
- org.eclipse.jetty.server.HttpInput
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Runnable
public class HttpInput extends jakarta.servlet.ServletInputStream implements java.lang.RunnableWhile this class is-a Runnable, it should never be dispatched in it's own thread. It is a runnable only so that the calling thread can use
ContextHandler.handle(Runnable)to setup classloaders etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHttpInput.ContentA content represents the production of aHttpChannelreturned byHttpChannel.produceContent().static classHttpInput.EofContentEOF special content.static classHttpInput.ErrorContentError special content.static interfaceHttpInput.InterceptorHttpInput.Contentinterceptor that can be registered usingsetInterceptor(Interceptor)oraddInterceptor(Interceptor).static classHttpInput.SpecialContentAbstract class that implements the standard special content behavior.static classHttpInput.WrappingContentSimple non-special content wrapper allow overriding the EOF flag.
-
Constructor Summary
Constructors Constructor Description HttpInput(HttpChannelState state)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInterceptor(HttpInput.Interceptor interceptor)Set theHttpInput.Interceptor, chaining it to the existing one if anHttpInput.Interceptoris already set.intavailable()booleanconsumeAll()longgetContentConsumed()longgetContentReceived()HttpInput.InterceptorgetInterceptor()booleanhasContent()Check if this HttpInput instance has content stored internally, without fetching/parsing anything from the underlying channel.booleanisAsync()booleanisError()booleanisFinished()booleanisReady()booleanonContentProducible()intread()intread(byte[] b, int off, int len)voidrecycle()voidreopen()voidrun()voidsetInterceptor(HttpInput.Interceptor interceptor)Set the interceptor.voidsetReadListener(jakarta.servlet.ReadListener readListener)java.lang.StringtoString()
-
-
-
Constructor Detail
-
HttpInput
public HttpInput(HttpChannelState state)
-
-
Method Detail
-
recycle
public void recycle()
-
reopen
public void reopen()
-
getInterceptor
public HttpInput.Interceptor getInterceptor()
- Returns:
- The current Interceptor, or null if none set
-
setInterceptor
public void setInterceptor(HttpInput.Interceptor interceptor)
Set the interceptor.- Parameters:
interceptor- The interceptor to use.
-
addInterceptor
public void addInterceptor(HttpInput.Interceptor interceptor)
Set theHttpInput.Interceptor, chaining it to the existing one if anHttpInput.Interceptoris already set.- Parameters:
interceptor- the nextHttpInput.Interceptorin a chain
-
getContentConsumed
public long getContentConsumed()
-
getContentReceived
public long getContentReceived()
-
consumeAll
public boolean consumeAll()
-
isError
public boolean isError()
-
isAsync
public boolean isAsync()
-
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)
- Specified by:
setReadListenerin classjakarta.servlet.ServletInputStream
-
onContentProducible
public boolean onContentProducible()
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
hasContent
public boolean hasContent()
Check if this HttpInput instance has content stored internally, without fetching/parsing anything from the underlying channel.- Returns:
- true if the input contains content, false otherwise.
-
available
public int available()
- Overrides:
availablein classjava.io.InputStream
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-