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
- Direct Known Subclasses:
HttpInputOverHTTP
@Deprecated(since="2021-05-27") public class HttpInput extends ServletInputStream implements Runnable
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.HttpInput
provides an implementation ofServletInputStream
forHttpChannel
.Content may arrive in patterns such as [content(), content(), messageComplete()] so that this class maintains two states: the content state that tells whether there is content to consume and the EOF state that tells whether an EOF has arrived. Only once the content has been consumed the content state is moved to the EOF state.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HttpInput.ChainedInterceptor
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.static class
HttpInput.Content
Deprecated.static class
HttpInput.EofContent
Deprecated.static interface
HttpInput.Interceptor
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.static class
HttpInput.SentinelContent
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
-
Constructor Summary
Constructors Constructor Description HttpInput(HttpChannelState state)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
addContent(HttpInput.Content content)
Deprecated.Adds some content to this input stream.void
addInterceptor(HttpInput.Interceptor interceptor)
Deprecated.Set theHttpInput.Interceptor
, using aHttpInput.ChainedInterceptor
if anHttpInput.Interceptor
is already set.void
asyncReadProduce()
Deprecated.Called by channel when asynchronous IO needs to produce more contentint
available()
Deprecated.boolean
consumeAll()
Deprecated.Consume all available content without blocking.boolean
earlyEOF()
Deprecated.This method should be called to signal that an EOF has been detected before all the expected content arrived.boolean
eof()
Deprecated.This method should be called to signal that all the expected content arrived.boolean
failed(Throwable x)
Deprecated.long
getContentConsumed()
Deprecated.long
getContentReceived()
Deprecated.HttpInput.Interceptor
getInterceptor()
Deprecated.boolean
hasContent()
Deprecated.boolean
isAsync()
Deprecated.boolean
isError()
Deprecated.boolean
isFinished()
Deprecated.Has the end of this InputStream been reached?boolean
isReady()
Deprecated.Can data be read from this InputStream without blocking? Returns If this method is called and returns false, the container will invokeReadListener.onDataAvailable()
when data is available.boolean
onIdleTimeout(Throwable x)
Deprecated.int
read()
Deprecated.int
read(byte[] b, int off, int len)
Deprecated.void
recycle()
Deprecated.void
run()
Deprecated.void
setInterceptor(HttpInput.Interceptor interceptor)
Deprecated.Set the interceptor.void
setReadListener(ReadListener readListener)
Deprecated.Sets theReadListener
for thisServletInputStream
and thereby switches to non-blocking IO.String
toString()
Deprecated.void
unblock()
Deprecated.-
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, transferTo
-
-
-
-
Constructor Detail
-
HttpInput
public HttpInput(HttpChannelState state)
Deprecated.
-
-
Method Detail
-
recycle
public void recycle()
Deprecated.
-
getInterceptor
public HttpInput.Interceptor getInterceptor()
Deprecated.- Returns:
- The current Interceptor, or null if none set
-
setInterceptor
public void setInterceptor(HttpInput.Interceptor interceptor)
Deprecated.Set the interceptor.- Parameters:
interceptor
- The interceptor to use.
-
addInterceptor
public void addInterceptor(HttpInput.Interceptor interceptor)
Deprecated.Set theHttpInput.Interceptor
, using aHttpInput.ChainedInterceptor
if anHttpInput.Interceptor
is already set.- Parameters:
interceptor
- the nextHttpInput.Interceptor
in a chain
-
available
public int available()
Deprecated.- Overrides:
available
in classInputStream
-
read
public int read() throws IOException
Deprecated.- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
Deprecated.- Overrides:
read
in classInputStream
- Throws:
IOException
-
asyncReadProduce
public void asyncReadProduce() throws IOException
Deprecated.Called by channel when asynchronous IO needs to produce more content- Throws:
IOException
- if unable to produce content
-
addContent
public boolean addContent(HttpInput.Content content)
Deprecated.Adds some content to this input stream.- Parameters:
content
- the content to add- Returns:
- true if content channel woken for read
-
hasContent
public boolean hasContent()
Deprecated.
-
unblock
public void unblock()
Deprecated.
-
getContentConsumed
public long getContentConsumed()
Deprecated.
-
getContentReceived
public long getContentReceived()
Deprecated.
-
earlyEOF
public boolean earlyEOF()
Deprecated.This method should be called to signal that an EOF has been detected before all the expected content arrived.Typically this will result in an EOFException being thrown from a subsequent read rather than a -1 return.
- Returns:
- true if content channel woken for read
-
eof
public boolean eof()
Deprecated.This method should be called to signal that all the expected content arrived.- Returns:
- true if content channel woken for read
-
consumeAll
public boolean consumeAll()
Deprecated.Consume all available content without blocking. Raw content is counted in thegetContentReceived()
statistics, but is not intercepted nor counted in thegetContentConsumed()
statistics- Returns:
- True if EOF was reached, false otherwise.
-
isError
public boolean isError()
Deprecated.
-
isAsync
public boolean isAsync()
Deprecated.
-
isFinished
public boolean isFinished()
Deprecated.Description copied from class:ServletInputStream
Has the end of this InputStream been reached?- Specified by:
isFinished
in classServletInputStream
- Returns:
true
if all the data has been read from the stream, elsefalse
-
isReady
public boolean isReady()
Deprecated.Description copied from class:ServletInputStream
Can data be read from this InputStream without blocking? Returns If this method is called and returns false, the container will invokeReadListener.onDataAvailable()
when data is available.- Specified by:
isReady
in classServletInputStream
- Returns:
true
if data can be read without blocking, elsefalse
-
setReadListener
public void setReadListener(ReadListener readListener)
Deprecated.Description copied from class:ServletInputStream
Sets theReadListener
for thisServletInputStream
and thereby switches to non-blocking IO. It is only valid to switch to non-blocking IO within async processing or HTTP upgrade processing.- Specified by:
setReadListener
in classServletInputStream
- Parameters:
readListener
- The non-blocking IO read listener
-
onIdleTimeout
public boolean onIdleTimeout(Throwable x)
Deprecated.
-
failed
public boolean failed(Throwable x)
Deprecated.
-
-