Package org.eclipse.jetty.server
Class HttpInput
java.lang.Object
java.io.InputStream
jakarta.servlet.ServletInputStream
org.eclipse.jetty.server.HttpInput
- All Implemented Interfaces:
Closeable,AutoCloseable,Runnable
While 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 ClassesModifier and TypeClassDescriptionstatic classA content represents the production of aHttpChannelreturned byHttpChannel.produceContent().static final classEOF special content.static final classError special content.static interfaceHttpInput.Contentinterceptor that can be registered usingsetInterceptor(Interceptor)oraddInterceptor(Interceptor).static classAbstract class that implements the standard special content behavior.static classSimple non-special content wrapper allow overriding the EOF flag. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInterceptor(HttpInput.Interceptor interceptor) Set theHttpInput.Interceptor, chaining it to the existing one if anHttpInput.Interceptoris already set.intbooleanlonglongbooleanCheck if this HttpInput instance has content stored internally, without fetching/parsing anything from the underlying channel.booleanisAsync()booleanisError()booleanbooleanisReady()booleanintread()intread(byte[] b, int off, int len) intread(ByteBuffer buffer) voidrecycle()voidreopen()voidrun()voidsetInterceptor(HttpInput.Interceptor interceptor) Set the interceptor.voidsetReadListener(jakarta.servlet.ReadListener readListener) toString()Methods inherited from class jakarta.servlet.ServletInputStream
readLineMethods inherited from class java.io.InputStream
close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
HttpInput
-
-
Method Details
-
recycle
public void recycle() -
reopen
public void reopen() -
getInterceptor
- Returns:
- The current Interceptor, or null if none set
-
setInterceptor
Set the interceptor.- Parameters:
interceptor- The interceptor to use.
-
addInterceptor
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
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Throws:
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 classInputStream
-
run
public void run() -
toString
-