public class HttpOutput extends ServletOutputStream implements Runnable
HttpOutput
implements ServletOutputStream
as required by the Servlet specification.
HttpOutput
buffers content written by the application until a
further write will overflow the buffer, at which point it triggers a commit
of the response.
HttpOutput
can be closed and reopened, to allow requests included
via RequestDispatcher.include(ServletRequest, ServletResponse)
to
close the stream, to be reopened after the inclusion ends.
Constructor and Description |
---|
HttpOutput(HttpChannel<?> channel) |
Modifier and Type | Method and Description |
---|---|
protected SharedBlockingCallback.Blocker |
acquireWriteBlockingCallback() |
void |
close() |
void |
flush() |
int |
getBufferSize() |
HttpChannel<?> |
getHttpChannel() |
long |
getWritten() |
boolean |
isAllContentWritten() |
boolean |
isClosed() |
boolean |
isReady() |
boolean |
isWritten() |
void |
print(String s) |
void |
reopen() |
void |
reset() |
void |
resetBuffer() |
void |
run() |
void |
sendContent(ByteBuffer content)
Blocking send of content.
|
void |
sendContent(ByteBuffer content,
Callback callback)
Asynchronous send of content.
|
void |
sendContent(HttpContent content)
Blocking send of content.
|
void |
sendContent(HttpContent httpContent,
Callback callback)
Asynchronous send of content.
|
void |
sendContent(InputStream in)
Blocking send of content.
|
void |
sendContent(InputStream in,
Callback callback)
Asynchronous send of content.
|
void |
sendContent(ReadableByteChannel in)
Blocking send of content.
|
void |
sendContent(ReadableByteChannel in,
Callback callback)
Asynchronous send of content.
|
void |
setBufferSize(int size) |
void |
setWriteListener(WriteListener writeListener) |
String |
toString() |
void |
write(byte[] b,
int off,
int len) |
void |
write(ByteBuffer buffer) |
protected void |
write(ByteBuffer content,
boolean complete) |
protected void |
write(ByteBuffer content,
boolean complete,
Callback callback) |
void |
write(int b) |
print, print, print, print, print, print, println, println, println, println, println, println, println, println
write
public HttpOutput(HttpChannel<?> channel)
public HttpChannel<?> getHttpChannel()
public boolean isWritten()
public long getWritten()
public void reset()
public void reopen()
public boolean isAllContentWritten()
protected SharedBlockingCallback.Blocker acquireWriteBlockingCallback() throws IOException
IOException
protected void write(ByteBuffer content, boolean complete) throws IOException
IOException
protected void write(ByteBuffer content, boolean complete, Callback callback)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
public boolean isClosed()
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void write(ByteBuffer buffer) throws IOException
IOException
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void print(String s) throws IOException
print
in class ServletOutputStream
IOException
public void sendContent(ByteBuffer content) throws IOException
content
- The content to send.IOException
public void sendContent(InputStream in) throws IOException
in
- The content to sendIOException
public void sendContent(ReadableByteChannel in) throws IOException
in
- The content to sendIOException
public void sendContent(HttpContent content) throws IOException
content
- The content to sendIOException
public void sendContent(ByteBuffer content, Callback callback)
content
- The content to sendcallback
- The callback to use to notify success or failurepublic void sendContent(InputStream in, Callback callback)
in
- The content to send as a stream. The stream will be closed
after reading all content.callback
- The callback to use to notify success or failurepublic void sendContent(ReadableByteChannel in, Callback callback)
in
- The content to send as a channel. The channel will be closed
after reading all content.callback
- The callback to use to notify success or failurepublic void sendContent(HttpContent httpContent, Callback callback)
httpContent
- The content to sendcallback
- The callback to use to notify success or failurepublic int getBufferSize()
public void setBufferSize(int size)
public void resetBuffer()
public void setWriteListener(WriteListener writeListener)
setWriteListener
in class ServletOutputStream
public boolean isReady()
isReady
in class ServletOutputStream
ServletOutputStream.isReady()
Copyright © 1995-2015 Webtide. All Rights Reserved.