Package org.eclipse.jetty.server
Class HttpOutput
- java.lang.Object
-
- java.io.OutputStream
-
- javax.servlet.ServletOutputStream
-
- org.eclipse.jetty.server.HttpOutput
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable,java.lang.Runnable
@Deprecated(since="2021-05-27") public class HttpOutput extends ServletOutputStream implements java.lang.Runnable
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.HttpOutputimplementsServletOutputStreamas required by the Servlet specification.HttpOutputbuffers content written by the application until a further write will overflow the buffer, at which point it triggers a commit of the response.HttpOutputcan be closed and reopened, to allow requests included viaRequestDispatcher.include(ServletRequest, ServletResponse)to close the stream, to be reopened after the inclusion ends.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceHttpOutput.InterceptorDeprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
-
Constructor Summary
Constructors Constructor Description HttpOutput(HttpChannel channel)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated.voidcomplete(Callback callback)Deprecated.voidcompleted(java.lang.Throwable failure)Deprecated.Called to indicate that the request cycle has been completed.voidflush()Deprecated.java.nio.ByteBuffergetBuffer()Deprecated.intgetBufferSize()Deprecated.HttpChannelgetHttpChannel()Deprecated.HttpOutput.InterceptorgetInterceptor()Deprecated.longgetWritten()Deprecated.booleanisAsync()Deprecated.booleanisClosed()Deprecated.booleanisReady()Deprecated.Checks if a non-blocking write will succeed.booleanisWritten()Deprecated.voidonFlushed(long bytes)Deprecated.Invoked when bytes have been flushed to the network.voidprint(java.lang.String s)Deprecated.Writes aStringto the client, without a carriage return-line feed (CRLF) character at the end.voidprintln(boolean b)Deprecated.Writes abooleanvalue to the client, followed by a carriage return-line feed (CRLF).voidprintln(char c)Deprecated.Writes a character to the client, followed by a carriage return-line feed (CRLF).voidprintln(double d)Deprecated.Writes adoublevalue to the client, followed by a carriage return-line feed (CRLF).voidprintln(float f)Deprecated.Writes afloatvalue to the client, followed by a carriage return-line feed (CRLF).voidprintln(int i)Deprecated.Writes an int to the client, followed by a carriage return-line feed (CRLF) character.voidprintln(long l)Deprecated.Writes alongvalue to the client, followed by a carriage return-line feed (CRLF).voidprintln(java.lang.String s)Deprecated.Writes aStringto the client, followed by a carriage return-line feed (CRLF).voidrecycle()Deprecated.voidreopen()Deprecated.voidresetBuffer()Deprecated.voidrun()Deprecated.voidsendContent(java.io.InputStream in)Deprecated.Blocking send of stream content.voidsendContent(java.io.InputStream in, Callback callback)Deprecated.Asynchronous send of stream content.voidsendContent(java.nio.ByteBuffer content)Deprecated.Blocking send of whole content.voidsendContent(java.nio.ByteBuffer content, Callback callback)Deprecated.Asynchronous send of whole content.voidsendContent(java.nio.channels.ReadableByteChannel in)Deprecated.Blocking send of channel content.voidsendContent(java.nio.channels.ReadableByteChannel in, Callback callback)Deprecated.Asynchronous send of channel content.voidsendContent(HttpContent content)Deprecated.Blocking send of HTTP content.voidsendContent(HttpContent httpContent, Callback callback)Deprecated.Asynchronous send of HTTP content.voidsetBufferSize(int size)Deprecated.voidsetInterceptor(HttpOutput.Interceptor interceptor)Deprecated.voidsetWriteListener(WriteListener writeListener)Deprecated.Sets theWriteListenerfor thisServletOutputStreamand thereby switches to non-blocking IO.voidsoftClose()Deprecated.java.lang.StringtoString()Deprecated.voidwrite(byte[] b, int off, int len)Deprecated.voidwrite(int b)Deprecated.voidwrite(java.nio.ByteBuffer buffer)Deprecated.
-
-
-
Constructor Detail
-
HttpOutput
public HttpOutput(HttpChannel channel)
Deprecated.
-
-
Method Detail
-
getHttpChannel
public HttpChannel getHttpChannel()
Deprecated.
-
getInterceptor
public HttpOutput.Interceptor getInterceptor()
Deprecated.
-
setInterceptor
public void setInterceptor(HttpOutput.Interceptor interceptor)
Deprecated.
-
isWritten
public boolean isWritten()
Deprecated.
-
getWritten
public long getWritten()
Deprecated.
-
reopen
public void reopen()
Deprecated.
-
softClose
public void softClose()
Deprecated.
-
complete
public void complete(Callback callback)
Deprecated.
-
completed
public void completed(java.lang.Throwable failure)
Deprecated.Called to indicate that the request cycle has been completed.
-
close
public void close() throws java.io.IOExceptionDeprecated.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
getBuffer
public java.nio.ByteBuffer getBuffer()
Deprecated.
-
isClosed
public boolean isClosed()
Deprecated.
-
isAsync
public boolean isAsync()
Deprecated.
-
flush
public void flush() throws java.io.IOExceptionDeprecated.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionDeprecated.- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(java.nio.ByteBuffer buffer) throws java.io.IOExceptionDeprecated.- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOExceptionDeprecated.- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
print
public void print(java.lang.String s) throws java.io.IOExceptionDeprecated.Description copied from class:ServletOutputStreamWrites aStringto the client, without a carriage return-line feed (CRLF) character at the end.- Overrides:
printin classServletOutputStream- Parameters:
s- theStringto send to the client- Throws:
java.io.IOException- if an input or output exception occurred
-
println
public void println(java.lang.String s) throws java.io.IOExceptionDeprecated.Description copied from class:ServletOutputStreamWrites aStringto the client, followed by a carriage return-line feed (CRLF).- Overrides:
printlnin classServletOutputStream- Parameters:
s- theStringto write to the client- Throws:
java.io.IOException- if an input or output exception occurred
-
println
public void println(boolean b) throws java.io.IOExceptionDeprecated.Description copied from class:ServletOutputStreamWrites abooleanvalue to the client, followed by a carriage return-line feed (CRLF).- Overrides:
printlnin classServletOutputStream- Parameters:
b- thebooleanvalue to write to the client- Throws:
java.io.IOException- if an input or output exception occurred
-
println
public void println(char c) throws java.io.IOExceptionDeprecated.Description copied from class:ServletOutputStreamWrites a character to the client, followed by a carriage return-line feed (CRLF).- Overrides:
printlnin classServletOutputStream- Parameters:
c- the character to write to the client- Throws:
java.io.IOException- if an input or output exception occurred
-
println
public void println(int i) throws java.io.IOExceptionDeprecated.Description copied from class:ServletOutputStreamWrites an int to the client, followed by a carriage return-line feed (CRLF) character.- Overrides:
printlnin classServletOutputStream- Parameters:
i- the int to write to the client- Throws:
java.io.IOException- if an input or output exception occurred
-
println
public void println(long l) throws java.io.IOExceptionDeprecated.Description copied from class:ServletOutputStreamWrites alongvalue to the client, followed by a carriage return-line feed (CRLF).- Overrides:
printlnin classServletOutputStream- Parameters:
l- thelongvalue to write to the client- Throws:
java.io.IOException- if an input or output exception occurred
-
println
public void println(float f) throws java.io.IOExceptionDeprecated.Description copied from class:ServletOutputStreamWrites afloatvalue to the client, followed by a carriage return-line feed (CRLF).- Overrides:
printlnin classServletOutputStream- Parameters:
f- thefloatvalue to write to the client- Throws:
java.io.IOException- if an input or output exception occurred
-
println
public void println(double d) throws java.io.IOExceptionDeprecated.Description copied from class:ServletOutputStreamWrites adoublevalue to the client, followed by a carriage return-line feed (CRLF).- Overrides:
printlnin classServletOutputStream- Parameters:
d- thedoublevalue to write to the client- Throws:
java.io.IOException- if an input or output exception occurred
-
sendContent
public void sendContent(java.nio.ByteBuffer content) throws java.io.IOExceptionDeprecated.Blocking send of whole content.- Parameters:
content- The whole content to send- Throws:
java.io.IOException- if the send fails
-
sendContent
public void sendContent(java.io.InputStream in) throws java.io.IOExceptionDeprecated.Blocking send of stream content.- Parameters:
in- The stream content to send- Throws:
java.io.IOException- if the send fails
-
sendContent
public void sendContent(java.nio.channels.ReadableByteChannel in) throws java.io.IOExceptionDeprecated.Blocking send of channel content.- Parameters:
in- The channel content to send- Throws:
java.io.IOException- if the send fails
-
sendContent
public void sendContent(HttpContent content) throws java.io.IOException
Deprecated.Blocking send of HTTP content.- Parameters:
content- The HTTP content to send- Throws:
java.io.IOException- if the send fails
-
sendContent
public void sendContent(java.nio.ByteBuffer content, Callback callback)Deprecated.Asynchronous send of whole content.- Parameters:
content- The whole content to sendcallback- The callback to use to notify success or failure
-
sendContent
public void sendContent(java.io.InputStream in, Callback callback)Deprecated.Asynchronous send of stream content. The stream will be closed after reading all content.- Parameters:
in- The stream content to sendcallback- The callback to use to notify success or failure
-
sendContent
public void sendContent(java.nio.channels.ReadableByteChannel in, Callback callback)Deprecated.Asynchronous send of channel content. The channel will be closed after reading all content.- Parameters:
in- The channel content to sendcallback- The callback to use to notify success or failure
-
sendContent
public void sendContent(HttpContent httpContent, Callback callback)
Deprecated.Asynchronous send of HTTP content.- Parameters:
httpContent- The HTTP content to sendcallback- The callback to use to notify success or failure
-
getBufferSize
public int getBufferSize()
Deprecated.
-
setBufferSize
public void setBufferSize(int size)
Deprecated.
-
onFlushed
public void onFlushed(long bytes) throws java.io.IOExceptionDeprecated.Invoked when bytes have been flushed to the network.
The number of flushed bytes may be different from the bytes written by the application if an
HttpOutput.Interceptorchanged them, for example by compressing them.- Parameters:
bytes- the number of bytes flushed- Throws:
java.io.IOException- if the minimum data rate, when set, is not respected- See Also:
WriteFlusher.Listener
-
recycle
public void recycle()
Deprecated.
-
resetBuffer
public void resetBuffer()
Deprecated.
-
setWriteListener
public void setWriteListener(WriteListener writeListener)
Deprecated.Description copied from class:ServletOutputStreamSets theWriteListenerfor thisServletOutputStreamand 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:
setWriteListenerin classServletOutputStream- Parameters:
writeListener- The non-blocking IO write listener
-
isReady
public boolean isReady()
Deprecated.Description copied from class:ServletOutputStreamChecks if a non-blocking write will succeed. If this returnsfalse, it will cause a callback toWriteListener.onWritePossible()when the buffer has emptied. If this method returnsfalseno further data must be written until the contain callsWriteListener.onWritePossible().- Specified by:
isReadyin classServletOutputStream- Returns:
trueif data can be written, elsefalse
-
run
public void run()
Deprecated.- Specified by:
runin interfacejava.lang.Runnable
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toStringin classjava.lang.Object
-
-