| Modifier and Type | Class and Description |
|---|---|
| public static class | AbstractGenerator.Output
Output. |
| public static class | AbstractGenerator.OutputWriter
OutputWriter. |
| Modifier and Type | Field and Description |
|---|---|
| private static Buffer[] | |
| protected Buffer | |
| protected Buffers | |
| protected boolean | |
| protected Buffer | |
| protected int | |
| protected long | |
| protected long | |
| protected EndPoint | |
| protected boolean | |
| protected Buffer | |
| protected int | |
| protected boolean | |
| protected Buffer | |
| protected boolean | |
| protected Buffer | |
| private boolean | |
| protected int | |
| protected int | |
| protected String | |
| protected int | |
| private static int | |
| private static byte[] | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int |
| Access | Constructor and Description |
|---|---|
| public | AbstractGenerator(Buffers
buffer pool buffers, EndPoint io, int Size of the buffer to allocate for HTTP header headerBufferSize, int Size of the buffer to allocate for HTTP content contentBufferSize)Constructor. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public abstract void | completeHeader(HttpFields fields, boolean allContentAdded)
Redeclares org. |
| pack-priv void | |
| public abstract long | |
| public int | Returns: Returns the contentBufferSize.Implements org. |
| public long | Returns: Returns the contentWritten.Implements org. |
| public static String | |
| protected static Buffer | |
| public boolean | |
| public int | |
| public Buffer | |
| public int | |
| public void | increaseContentBufferSize(int
The contentBufferSize to set. contentBufferSize)Implements org. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | Returns: false if the connection should be closed after a request has been read,
true if it should be used for additional requests.Implements org. |
| public boolean | |
| protected abstract int | Returns: the available space in the buffer.Prepare buffer for unchecked writes. |
| public void | |
| public void | |
| public void | sendError(int code, String reason, String content, boolean close)
Implements org. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setResponse(int
The status code to send. status, String the status message to send. reason)Implements org. |
| public void | setSendServerVersion(boolean sendServerVersion)
Implements org. |
| public void | setVersion(int
The version of the client the response is being sent to (NB. Not the version
in the response, which is the version of the server). version)Implements org. |
| pack-priv void |
| __reasons | back to summary |
|---|---|
| private static Buffer[] __reasons | |
| _buffer | back to summary |
|---|---|
| protected Buffer _buffer | |
| _buffers | back to summary |
|---|---|
| protected Buffers _buffers | |
| _close | back to summary |
|---|---|
| protected boolean _close | |
| _content | back to summary |
|---|---|
| protected Buffer _content | |
| _contentBufferSize | back to summary |
|---|---|
| protected int _contentBufferSize | |
| _contentLength | back to summary |
|---|---|
| protected long _contentLength | |
| _contentWritten | back to summary |
|---|---|
| protected long _contentWritten | |
| _endp | back to summary |
|---|---|
| protected EndPoint _endp | |
| _head | back to summary |
|---|---|
| protected boolean _head | |
| _header | back to summary |
|---|---|
| protected Buffer _header | |
| _headerBufferSize | back to summary |
|---|---|
| protected int _headerBufferSize | |
| _last | back to summary |
|---|---|
| protected boolean _last | |
| _method | back to summary |
|---|---|
| protected Buffer _method | |
| _noContent | back to summary |
|---|---|
| protected boolean _noContent | |
| _reason | back to summary |
|---|---|
| protected Buffer _reason | |
| _sendServerVersion | back to summary |
|---|---|
| private boolean _sendServerVersion | |
| _state | back to summary |
|---|---|
| protected int _state | |
| _status | back to summary |
|---|---|
| protected int _status | |
| _uri | back to summary |
|---|---|
| protected String _uri | |
| _version | back to summary |
|---|---|
| protected int _version | |
| MAX_OUTPUT_CHARS | back to summary |
|---|---|
| private static int MAX_OUTPUT_CHARS | |
| NO_BYTES | back to summary |
|---|---|
| private static byte[] NO_BYTES | |
| STATE_CONTENT | back to summary |
|---|---|
| public static final int STATE_CONTENT | |
| STATE_END | back to summary |
|---|---|
| public static final int STATE_END | |
| STATE_FLUSHING | back to summary |
|---|---|
| public static final int STATE_FLUSHING | |
| STATE_HEADER | back to summary |
|---|---|
| public static final int STATE_HEADER | |
| AbstractGenerator | back to summary |
|---|---|
| public AbstractGenerator(Buffers buffers, EndPoint io, int headerBufferSize, int contentBufferSize) Constructor.
| |
| complete | back to summary |
|---|---|
| public void complete() throws IOException Implements org. Complete the message. | |
| completeHeader | back to summary |
|---|---|
| public abstract void completeHeader(HttpFields fields, boolean allContentAdded) throws IOException Redeclares org. | |
| completeUncheckedAddContent | back to summary |
|---|---|
| pack-priv void completeUncheckedAddContent() | |
| flush | back to summary |
|---|---|
| public abstract long flush() throws IOException Redeclares org. | |
| getContentBufferSize | back to summary |
|---|---|
| public int getContentBufferSize() Implements org.
| |
| getContentWritten | back to summary |
|---|---|
| public long getContentWritten() Implements org.
| |
| getReason | back to summary |
|---|---|
| public static String getReason(int code) | |
| getReasonBuffer | back to summary |
|---|---|
| protected static Buffer getReasonBuffer(int code) | |
| getSendServerVersion | back to summary |
|---|---|
| public boolean getSendServerVersion() | |
| getState | back to summary |
|---|---|
| public int getState() | |
| getUncheckedBuffer | back to summary |
|---|---|
| public Buffer getUncheckedBuffer() | |
| getVersion | back to summary |
|---|---|
| public int getVersion() | |
| increaseContentBufferSize | back to summary |
|---|---|
| public void increaseContentBufferSize(int contentBufferSize) Implements org.
| |
| isBufferFull | back to summary |
|---|---|
| public boolean isBufferFull() Implements org. | |
| isCommitted | back to summary |
|---|---|
| public boolean isCommitted() Implements org. | |
| isComplete | back to summary |
|---|---|
| public boolean isComplete() Implements org. | |
| isContentWritten | back to summary |
|---|---|
| public boolean isContentWritten() Implements org. | |
| isHead | back to summary |
|---|---|
public boolean isHead()
| |
| isIdle | back to summary |
|---|---|
| public boolean isIdle() Implements org. | |
| isPersistent | back to summary |
|---|---|
| public boolean isPersistent() Implements org.
| |
| isState | back to summary |
|---|---|
| public boolean isState(int state) | |
| prepareUncheckedAddContent | back to summary |
|---|---|
| protected abstract int prepareUncheckedAddContent() throws IOException Prepare buffer for unchecked writes. Prepare the generator buffer to receive unchecked writes
| |
| reset | back to summary |
|---|---|
| public void reset(boolean returnBuffers) Implements org. | |
| resetBuffer | back to summary |
|---|---|
| public void resetBuffer() Implements org. | |
| sendError | back to summary |
|---|---|
| public void sendError(int code, String reason, String content, boolean close) throws IOException Implements org. Utility method to send an error response. If the builder is not committed, this call is equivalent to a setResponse, addcontent and complete call. | |
| setContentLength | back to summary |
|---|---|
| public void setContentLength(long value) Implements org. | |
| setHead | back to summary |
|---|---|
| public void setHead(boolean head) Implements org.
| |
| setPersistent | back to summary |
|---|---|
| public void setPersistent(boolean persistent) Implements org. | |
| setRequest | back to summary |
|---|---|
| public void setRequest(String method, String uri) Implements org. | |
| setResponse | back to summary |
|---|---|
| public void setResponse(int status, String reason) Implements org.
| |
| setSendServerVersion | back to summary |
|---|---|
| public void setSendServerVersion(boolean sendServerVersion) Implements org. | |
| setVersion | back to summary |
|---|---|
| public void setVersion(int version) Implements org.
| |
| uncheckedAddContent | back to summary |
|---|---|
| pack-priv void uncheckedAddContent(int b) | |
Implements javax.servlet.ServletOutputStream from the javax.servlet package.
ServletOutputStream implementation that writes content
to a AbstractGenerator. The class is designed to be reused
and can be reopened after a close.
| Modifier and Type | Field and Description |
|---|---|
| protected ByteArrayBuffer | |
| pack-priv ByteArrayOutputStream2 | |
| pack-priv String | |
| pack-priv char[] | |
| protected boolean | |
| pack-priv Writer | |
| protected AbstractGenerator | |
| protected long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| public void | close()
Overrides java. Implements java. |
| public void | flush()
Overrides java. Implements java. |
| public void | print(String
the s)String to send to the clientOverrides javax. String to the client,
without a carriage return-line feed (CRLF)
character at the end.
|
| pack-priv void | |
| public void | write(byte[]
the data. b, int the start offset in the data. off, int the number of bytes to write. len)Overrides java. len bytes from the specified byte array
starting at offset off to this output stream.
|
| public void | write(byte[]
the data. b)Overrides java. b.length bytes from the specified byte array
to this output stream.
|
| public void | write(int
the b)byte.Implements abstract java. |
| private void |
| _buf | back to summary |
|---|---|
| protected ByteArrayBuffer _buf | |
| _bytes | back to summary |
|---|---|
| pack-priv ByteArrayOutputStream2 _bytes | |
| _characterEncoding | back to summary |
|---|---|
| pack-priv String _characterEncoding | |
| _chars | back to summary |
|---|---|
| pack-priv char[] _chars | |
| _closed | back to summary |
|---|---|
| protected boolean _closed | |
| _converter | back to summary |
|---|---|
| pack-priv Writer _converter | |
| _generator | back to summary |
|---|---|
| protected AbstractGenerator _generator | |
| _maxIdleTime | back to summary |
|---|---|
| protected long _maxIdleTime | |
| Output | back to summary |
|---|---|
| public Output(AbstractGenerator generator, long maxIdleTime) | |
| blockForOutput | back to summary |
|---|---|
| pack-priv void blockForOutput() throws IOException | |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this output stream and releases any system resources
associated with this stream. The general contract of
| |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Overrides java. Implements java. Doc from java. Flushes this output stream and forces any buffered output bytes
to be written out. The general contract of If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
| |
| back to summary | |
|---|---|
| public void print(String s) throws IOException Overrides javax. Doc from javax. Writes a
| |
| reopen | back to summary |
|---|---|
| pack-priv void reopen() | |
| write | back to summary |
|---|---|
| public void write(byte[] b, int off, int len) throws IOException Overrides java. Doc from java. Writes
If
If
| |
| write | back to summary |
|---|---|
| public void write(byte[] b) throws IOException Overrides java. Doc from java. Writes
| |
| write | back to summary |
|---|---|
| public void write(int b) throws IOException Implements abstract java. Doc from java. Writes the specified byte to this output stream. The general
contract for
| |
| write | back to summary |
|---|---|
| private void write(Buffer buffer) throws IOException | |
Output stream and provide
character encodings.
The UTF-8 encoding is done by this class and no additional
buffers or Writers are used.
The UTF-8 code was inspired by http://javolution.org
| Modifier and Type | Field and Description |
|---|---|
| pack-priv AbstractGenerator | |
| pack-priv AbstractGenerator. | |
| pack-priv int | |
| pack-priv int | |
| private static final int | |
| private static final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements abstract java. Implements java. |
| public void | flush()
Implements abstract java. Implements java. |
| private Writer | |
| public void | |
| public void | write(String
A String s, int Offset from which to start writing characters offset, int Number of characters to write length)Overrides java. |
| public void | write(char[]
Array of characters s, int Offset from which to start writing characters offset, int Number of characters to write length)Implements abstract java. |
| _generator | back to summary |
|---|---|
| pack-priv AbstractGenerator _generator | |
| _out | back to summary |
|---|---|
| pack-priv AbstractGenerator. | |
| _surrogate | back to summary |
|---|---|
| pack-priv int _surrogate | |
| _writeMode | back to summary |
|---|---|
| pack-priv int _writeMode | |
| WRITE_CONV | back to summary |
|---|---|
| private static final int WRITE_CONV | |
| WRITE_ISO1 | back to summary |
|---|---|
| private static final int WRITE_ISO1 | |
| WRITE_UTF8 | back to summary |
|---|---|
| private static final int WRITE_UTF8 | |
| OutputWriter | back to summary |
|---|---|
| public OutputWriter(AbstractGenerator. | |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements abstract java. Implements java. Doc from java. Closes the stream, flushing it first. Once the stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously closed stream has no effect.
| |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Implements abstract java. Implements java. Doc from java. Flushes the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams. If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
| |
| getConverter | back to summary |
|---|---|
| private Writer getConverter() throws IOException | |
| setCharacterEncoding | back to summary |
|---|---|
| public void setCharacterEncoding(String encoding) | |
| write | back to summary |
|---|---|
| public void write(String s, int offset, int length) throws IOException Overrides java. Doc from java. Writes a portion of a string.
| |
| write | back to summary |
|---|---|
| public void write(char[] s, int offset, int length) throws IOException Implements abstract java. Doc from java. Writes a portion of an array of characters.
| |