Package one.nio.http
Class Request
java.lang.Object
one.nio.http.Request
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[]private intprivate String[]private static final byte[]private booleanprivate static final byte[]private intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int(package private) static final String[]static final intprivate intprivate static final intprivate String(package private) static final byte[][] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidconsumeHeaders(String prefix, Consumer<String> suffixConsumer) voidconsumeHeaderValues(String key, Consumer<String> suffixConsumer) Consume trimmed header value after ':' delimiterbyte[]getBody()intString[]getHeaderValue(String key) Returns trimmed header value after ':' delimitergetHost()intgetParameter(String key) getParameter(String key, String defaultValue) getParameters(String key) getPath()getRequiredHeader(String key) getURI()booleanbooleanisHttp11()voidsetBody(byte[] body) voidsetBodyUtf8(String body) (package private) voidsetEarlyData(boolean earlyData) byte[]toBytes()toString()(package private) static String
-
Field Details
-
METHOD_GET
public static final int METHOD_GET- See Also:
-
METHOD_POST
public static final int METHOD_POST- See Also:
-
METHOD_HEAD
public static final int METHOD_HEAD- See Also:
-
METHOD_OPTIONS
public static final int METHOD_OPTIONS- See Also:
-
METHOD_PUT
public static final int METHOD_PUT- See Also:
-
METHOD_DELETE
public static final int METHOD_DELETE- See Also:
-
METHOD_TRACE
public static final int METHOD_TRACE- See Also:
-
METHOD_CONNECT
public static final int METHOD_CONNECT- See Also:
-
METHOD_PATCH
public static final int METHOD_PATCH- See Also:
-
NUMBER_OF_METHODS
public static final int NUMBER_OF_METHODS- See Also:
-
METHODS
-
VERBS
static final byte[][] VERBS -
HTTP10_HEADER
private static final byte[] HTTP10_HEADER -
HTTP11_HEADER
private static final byte[] HTTP11_HEADER -
PROTOCOL_HEADER_LENGTH
private static final int PROTOCOL_HEADER_LENGTH- See Also:
-
method
private int method -
uri
-
http11
private boolean http11 -
params
private int params -
headerCount
private int headerCount -
headers
-
body
private byte[] body
-
-
Constructor Details
-
Request
-
Request
-
-
Method Details
-
getMethod
public int getMethod() -
getMethodName
-
getURI
-
isHttp11
public boolean isHttp11() -
setEarlyData
void setEarlyData(boolean earlyData) -
isEarlyData
public boolean isEarlyData() -
getPath
-
getQueryString
-
getParameter
-
getParameters
-
getParameter
-
getRequiredParameter
-
getParameters
- Returns:
IterableoverStringkey[=[value]]parameters skipping empty parameters
-
getPostParams
-
getHeaderCount
public int getHeaderCount() -
getHeaders
-
getHeader
-
consumeHeaders
-
getHeaderValue
Returns trimmed header value after ':' delimiter- Parameters:
key- header name without ':'- Returns:
- trimmed value after key:
-
consumeHeaderValues
Consume trimmed header value after ':' delimiter- Parameters:
key- header name without ':'suffixConsumer- a function for processing the header value
-
getHeader
-
getRequiredHeader
-
addHeader
-
getBody
public byte[] getBody() -
setBody
public void setBody(byte[] body) -
setBodyUtf8
-
getHost
-
toBytes
public byte[] toBytes() -
toString
-
trim
-