Package org.eclipse.jetty.http
Class HttpGenerator
java.lang.Object
org.eclipse.jetty.http.HttpGenerator
HttpGenerator. Builds HTTP Messages.
If the system property "org.eclipse.jetty.http.HttpGenerator.STRICT" is set to true, then the generator will strictly pass on the exact strings received from methods and header fields. Otherwise a fast case insensitive string lookup is used that may alter the case and white space of some methods/headers
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
static enum
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final byte[]
private static final HttpGenerator.PreparedResponse[]
static final boolean
private long
private HttpTokens.EndOfContent
private boolean
private boolean
private Boolean
private final int
private HttpGenerator.State
private Supplier
<HttpFields> static final int
private static final byte[]
private static final byte[]
static final MetaData.Response
private static final byte[]
private static final byte[]
private static final Logger
static final MetaData.Response
static final MetaData.Response
private static final byte[][]
private static final int
private static final int
private static final byte[]
private static final byte[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
private HttpGenerator.Result
committed
(ByteBuffer chunk, ByteBuffer content, boolean last) private HttpGenerator.Result
completing
(ByteBuffer chunk, ByteBuffer content) private void
generateHeaders
(MetaData info, ByteBuffer header, ByteBuffer content, boolean last) generateRequest
(MetaData.Request info, ByteBuffer header, ByteBuffer chunk, ByteBuffer content, boolean last) private void
generateRequestLine
(MetaData.Request request, ByteBuffer header) generateResponse
(MetaData.Response info, boolean head, ByteBuffer header, ByteBuffer chunk, ByteBuffer content, boolean last) generateResponse
(MetaData.Response info, ByteBuffer header, ByteBuffer chunk, ByteBuffer content, boolean last) Deprecated.private void
generateResponseLine
(MetaData.Response response, ByteBuffer header) private void
generateTrailers
(ByteBuffer buffer, HttpFields trailer) long
static byte[]
getReasonBuffer
(int code) private byte[]
getReasonBytes
(String reason) boolean
Deprecated.getState()
boolean
boolean
boolean
isEnd()
boolean
isIdle()
boolean
boolean
boolean
isState
(HttpGenerator.State state) boolean
private void
prepareChunk
(ByteBuffer chunk, int remaining) private static void
putContentLength
(ByteBuffer header, long contentLength) private static void
putSanitisedName
(String s, ByteBuffer buffer) private static void
putSanitisedValue
(String s, ByteBuffer buffer) static void
putTo
(HttpField field, ByteBuffer bufferInFillMode) static void
putTo
(HttpFields fields, ByteBuffer bufferInFillMode) void
reset()
static void
setJettyVersion
(String serverVersion) void
setPersistent
(boolean persistent) void
setSendServerVersion
(boolean sendServerVersion) Deprecated.toString()
-
Field Details
-
LOG
-
__STRICT
public static final boolean __STRICT -
__colon_space
private static final byte[] __colon_space -
CONTINUE_100_INFO
-
PROGRESS_102_INFO
-
RESPONSE_500_INFO
-
CHUNK_SIZE
public static final int CHUNK_SIZE- See Also:
-
_state
-
_endOfContent
-
_contentPrepared
private long _contentPrepared -
_noContentResponse
private boolean _noContentResponse -
_persistent
-
_trailers
-
_send
private final int _send -
SEND_SERVER
private static final int SEND_SERVER- See Also:
-
SEND_XPOWEREDBY
private static final int SEND_XPOWEREDBY- See Also:
-
ASSUMED_CONTENT_METHODS
-
_needCRLF
private boolean _needCRLF -
ZERO_CHUNK
private static final byte[] ZERO_CHUNK -
LAST_CHUNK
private static final byte[] LAST_CHUNK -
CONTENT_LENGTH_0
private static final byte[] CONTENT_LENGTH_0 -
CONNECTION_CLOSE
private static final byte[] CONNECTION_CLOSE -
HTTP_1_1_SPACE
private static final byte[] HTTP_1_1_SPACE -
TRANSFER_ENCODING_CHUNKED
private static final byte[] TRANSFER_ENCODING_CHUNKED -
SEND
private static final byte[][] SEND -
__preprepared
-
-
Constructor Details
-
HttpGenerator
public HttpGenerator() -
HttpGenerator
public HttpGenerator(boolean sendServerVersion, boolean sendXPoweredBy)
-
-
Method Details
-
setJettyVersion
-
reset
public void reset() -
getSendServerVersion
Deprecated. -
setSendServerVersion
Deprecated. -
getState
-
isState
-
isIdle
public boolean isIdle() -
isEnd
public boolean isEnd() -
isCommitted
public boolean isCommitted() -
isChunking
public boolean isChunking() -
isNoContent
public boolean isNoContent() -
setPersistent
public void setPersistent(boolean persistent) -
isPersistent
public boolean isPersistent()- Returns:
- true if known to be persistent
-
isWritten
public boolean isWritten() -
getContentPrepared
public long getContentPrepared() -
abort
public void abort() -
generateRequest
public HttpGenerator.Result generateRequest(MetaData.Request info, ByteBuffer header, ByteBuffer chunk, ByteBuffer content, boolean last) throws IOException - Throws:
IOException
-
committed
-
completing
-
generateResponse
@Deprecated public HttpGenerator.Result generateResponse(MetaData.Response info, ByteBuffer header, ByteBuffer chunk, ByteBuffer content, boolean last) throws IOException Deprecated.- Throws:
IOException
-
generateResponse
public HttpGenerator.Result generateResponse(MetaData.Response info, boolean head, ByteBuffer header, ByteBuffer chunk, ByteBuffer content, boolean last) throws IOException - Throws:
IOException
-
prepareChunk
-
generateTrailers
-
generateRequestLine
-
generateResponseLine
-
getReasonBytes
-
generateHeaders
-
putContentLength
-
getReasonBuffer
public static byte[] getReasonBuffer(int code) -
toString
-
putSanitisedName
-
putSanitisedValue
-
putTo
-
putTo
-