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 classstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final byte[]private static final HttpGenerator.PreparedResponse[]static final booleanprivate longprivate HttpTokens.EndOfContentprivate booleanprivate booleanprivate Booleanprivate final intprivate HttpGenerator.Stateprivate Supplier<HttpFields> static final intprivate static final byte[]private static final byte[]static final MetaData.Responseprivate static final byte[]private static final byte[]private static final Loggerstatic final MetaData.Responsestatic final MetaData.Responseprivate static final byte[][]private static final intprivate static final intprivate static final byte[]private static final byte[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()private HttpGenerator.Resultcommitted(ByteBuffer chunk, ByteBuffer content, boolean last) private HttpGenerator.Resultcompleting(ByteBuffer chunk, ByteBuffer content) private voidgenerateHeaders(MetaData info, ByteBuffer header, ByteBuffer content, boolean last) generateRequest(MetaData.Request info, ByteBuffer header, ByteBuffer chunk, ByteBuffer content, boolean last) private voidgenerateRequestLine(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 voidgenerateResponseLine(MetaData.Response response, ByteBuffer header) private voidgenerateTrailers(ByteBuffer buffer, HttpFields trailer) longstatic byte[]getReasonBuffer(int code) private byte[]getReasonBytes(String reason) booleanDeprecated.getState()booleanbooleanbooleanisEnd()booleanisIdle()booleanbooleanbooleanisState(HttpGenerator.State state) booleanprivate voidprepareChunk(ByteBuffer chunk, int remaining) private static voidputContentLength(ByteBuffer header, long contentLength) private static voidputSanitisedName(String s, ByteBuffer buffer) private static voidputSanitisedValue(String s, ByteBuffer buffer) static voidputTo(HttpField field, ByteBuffer bufferInFillMode) static voidputTo(HttpFields fields, ByteBuffer bufferInFillMode) voidreset()static voidsetJettyVersion(String serverVersion) voidsetPersistent(boolean persistent) voidsetSendServerVersion(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
-