Package org.eclipse.jetty.server
Class HttpInput
java.lang.Object
java.io.InputStream
javax.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
Modifier and TypeClassDescriptionstatic class
A content represents the production of aHttpChannel
returned byHttpChannel.produceContent()
.static final class
EOF special content.static final class
Error special content.static interface
HttpInput.Content
interceptor that can be registered usingsetInterceptor(Interceptor)
oraddInterceptor(Interceptor)
.static class
Abstract class that implements the standard special content behavior.static class
Simple non-special content wrapper allow overriding the EOF flag. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addInterceptor
(HttpInput.Interceptor interceptor) Set theHttpInput.Interceptor
, chaining it to the existing one if anHttpInput.Interceptor
is already set.int
boolean
long
long
boolean
Check if this HttpInput instance has content stored internally, without fetching/parsing anything from the underlying channel.boolean
isAsync()
boolean
isError()
boolean
boolean
isReady()
boolean
int
read()
int
read
(byte[] b, int off, int len) int
read
(ByteBuffer buffer) void
recycle()
void
reopen()
void
run()
void
setInterceptor
(HttpInput.Interceptor interceptor) Set the interceptor.void
setReadListener
(javax.servlet.ReadListener readListener) toString()
Methods inherited from class javax.servlet.ServletInputStream
readLine
Methods 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.Interceptor
is already set.- Parameters:
interceptor
- the nextHttpInput.Interceptor
in 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:
isFinished
in classjavax.servlet.ServletInputStream
-
isReady
public boolean isReady()- Specified by:
isReady
in classjavax.servlet.ServletInputStream
-
setReadListener
public void setReadListener(javax.servlet.ReadListener readListener) - Specified by:
setReadListener
in classjavax.servlet.ServletInputStream
-
onContentProducible
public boolean onContentProducible() -
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in 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:
available
in classInputStream
-
run
public void run() -
toString
-