public interface RequestHeadersBuilder extends HttpHeadersBuilder
RequestHeaders.| Modifier and Type | Method and Description |
|---|---|
RequestHeadersBuilder |
add(CharSequence name,
Iterable<String> values)
Adds new headers with the specified
name and values. |
RequestHeadersBuilder |
add(CharSequence name,
String... values)
Adds new headers with the specified
name and values. |
RequestHeadersBuilder |
add(CharSequence name,
String value)
Adds a new header with the specified
name and value. |
RequestHeadersBuilder |
add(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
Adds all header names and values of the specified
entries. |
RequestHeadersBuilder |
addDouble(CharSequence name,
double value)
Adds a new header.
|
RequestHeadersBuilder |
addFloat(CharSequence name,
float value)
Adds a new header.
|
RequestHeadersBuilder |
addInt(CharSequence name,
int value)
Adds a new header.
|
RequestHeadersBuilder |
addLong(CharSequence name,
long value)
Adds a new header.
|
RequestHeadersBuilder |
addObject(CharSequence name,
Iterable<?> values)
Adds a new header with the specified name and values.
|
RequestHeadersBuilder |
addObject(CharSequence name,
Object... values)
Adds a new header with the specified name and values.
|
RequestHeadersBuilder |
addObject(CharSequence name,
Object value)
Adds a new header.
|
RequestHeadersBuilder |
addObject(Iterable<? extends Map.Entry<? extends CharSequence,?>> entries)
Adds all header names and values of the specified
entries. |
RequestHeadersBuilder |
addTimeMillis(CharSequence name,
long value)
Adds a new header.
|
String |
authority()
Returns the value of the
":authority" header or null if there is no such header. |
default RequestHeadersBuilder |
authority(Endpoint endpoint)
Sets the
":authority" header from the specified Endpoint. |
RequestHeadersBuilder |
authority(String authority)
Sets the
":authority" header. |
RequestHeaders |
build()
Returns a newly created
RequestHeaders with the entries in this builder. |
RequestHeadersBuilder |
clear()
Removes all headers.
|
boolean |
contains(CharSequence name)
Returns
true if a header with the name exists, false otherwise. |
boolean |
contains(CharSequence name,
String value)
Returns
true if a header with the name and value exists. |
boolean |
containsDouble(CharSequence name,
double value)
Returns
true if a header with the name and value exists. |
boolean |
containsFloat(CharSequence name,
float value)
Returns
true if a header with the name and value exists. |
boolean |
containsInt(CharSequence name,
int value)
Returns
true if a header with the name and value exists. |
boolean |
containsLong(CharSequence name,
long value)
Returns
true if a header with the name and value exists. |
boolean |
containsObject(CharSequence name,
Object value)
Returns
true if a header with the name and value exists. |
boolean |
containsTimeMillis(CharSequence name,
long value)
Returns
true if a header with the name and value exists. |
MediaType |
contentType()
Returns the parsed
"content-type" header. |
RequestHeadersBuilder |
contentType(MediaType contentType)
Sets the
"content-type" header. |
RequestHeadersBuilder |
endOfStream(boolean endOfStream)
Sets whether the headers will be the last frame in an HTTP/2 stream.
|
void |
forEach(BiConsumer<io.netty.util.AsciiString,String> action)
Invokes the specified
action for all header entries. |
void |
forEachValue(CharSequence name,
Consumer<String> action)
Invokes the specified
action for all values of the headers with the specified name. |
String |
get(CharSequence name)
Returns the value of a header with the specified
name. |
String |
get(CharSequence name,
String defaultValue)
Returns the value of a header with the specified
name. |
List<String> |
getAll(CharSequence name)
Returns all values for the header with the specified name.
|
Double |
getDouble(CharSequence name)
Returns the
double value of a header with the specified name. |
double |
getDouble(CharSequence name,
double defaultValue)
Returns the
double value of a header with the specified name. |
Float |
getFloat(CharSequence name)
Returns the
float value of a header with the specified name. |
float |
getFloat(CharSequence name,
float defaultValue)
Returns the
float value of a header with the specified name. |
Integer |
getInt(CharSequence name)
Returns the
int value of a header with the specified name. |
int |
getInt(CharSequence name,
int defaultValue)
Returns the
int value of a header with the specified name. |
Long |
getLong(CharSequence name)
Returns the
long value of a header with the specified name. |
long |
getLong(CharSequence name,
long defaultValue)
Returns the
long value of a header with the specified name. |
Long |
getTimeMillis(CharSequence name)
Returns the value of a header with the specified
name in milliseconds. |
long |
getTimeMillis(CharSequence name,
long defaultValue)
Returns the value of a header with the specified
name in milliseconds. |
boolean |
isEmpty()
Returns
true if this headers does not contain any entries. |
boolean |
isEndOfStream()
Tells whether the headers correspond to the last frame in an HTTP/2 stream.
|
Iterator<Map.Entry<io.netty.util.AsciiString,String>> |
iterator()
Returns an
Iterator that yields all header entries. |
HttpMethod |
method()
Returns the value of the
":method" header as an HttpMethod. |
RequestHeadersBuilder |
method(HttpMethod method)
Sets the
":method" header. |
Set<io.netty.util.AsciiString> |
names()
Returns a
Set of all header names. |
String |
path()
Returns the value of the
":path" header. |
RequestHeadersBuilder |
path(String path)
Sets the
":path" header. |
RequestHeadersBuilder |
removeAndThen(CharSequence name)
Removes all headers with the specified
name. |
String |
scheme()
Returns the value of the
":scheme" header or null if there is no such header. |
default RequestHeadersBuilder |
scheme(SessionProtocol sessionProtocol)
Sets the
":scheme" header from the specified SessionProtocol. |
RequestHeadersBuilder |
scheme(String scheme)
Sets the
":scheme" header. |
RequestHeadersBuilder |
set(CharSequence name,
Iterable<String> values)
Sets a new header with the specified name and values.
|
RequestHeadersBuilder |
set(CharSequence name,
String... values)
Sets a header with the specified name and values.
|
RequestHeadersBuilder |
set(CharSequence name,
String value)
Sets a header with the specified name and value.
|
RequestHeadersBuilder |
set(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
Retains all current headers but calls
HttpHeadersBuilder.set(CharSequence, String) for each header in
the specified entries. |
RequestHeadersBuilder |
setDouble(CharSequence name,
double value)
Sets a header with the specified
name to value. |
RequestHeadersBuilder |
setFloat(CharSequence name,
float value)
Sets a header with the specified
name to value. |
RequestHeadersBuilder |
setIfAbsent(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
Copies the entries missing in this headers from the specified
entries. |
RequestHeadersBuilder |
setInt(CharSequence name,
int value)
Sets a header with the specified
name to value. |
RequestHeadersBuilder |
setLong(CharSequence name,
long value)
Sets a header with the specified
name to value. |
RequestHeadersBuilder |
setObject(CharSequence name,
Iterable<?> values)
Sets a header with the specified name and values.
|
RequestHeadersBuilder |
setObject(CharSequence name,
Object... values)
Sets a header with the specified name and values.
|
RequestHeadersBuilder |
setObject(CharSequence name,
Object value)
Sets a new header.
|
RequestHeadersBuilder |
setObject(Iterable<? extends Map.Entry<? extends CharSequence,?>> entries)
Retains all current headers but calls
HttpHeadersBuilder.setObject(CharSequence, Object) for each entry in
the specified entries. |
RequestHeadersBuilder |
setTimeMillis(CharSequence name,
long value)
Sets a header with the specified
name to value. |
int |
size()
Returns the number of headers.
|
RequestHeadersBuilder |
sizeHint(int sizeHint)
Specifies the hint about the number of headers which may improve the memory efficiency and performance
of the underlying data structure.
|
default Stream<Map.Entry<io.netty.util.AsciiString,String>> |
stream()
Returns a
Stream that yields all header entries. |
URI |
uri()
Returns the request URI generated from the
":scheme", ":authority" and ":path"
headers. |
Iterator<String> |
valueIterator(CharSequence name)
Returns an
Iterator that yields all values of the headers with the specified name. |
default Stream<String> |
valueStream(CharSequence name)
Returns a
Stream that yields all values of the headers with the specified name. |
getAllAndRemove, getAndRemove, getAndRemove, getDoubleAndRemove, getDoubleAndRemove, getFloatAndRemove, getFloatAndRemove, getIntAndRemove, getIntAndRemove, getLongAndRemove, getLongAndRemove, getTimeMillisAndRemove, getTimeMillisAndRemove, removeforEach, spliteratorRequestHeaders build()
RequestHeaders with the entries in this builder.build in interface HttpHeadersBuilderIllegalStateException - if this builder does not have ":method" and
":path" headers set.RequestHeadersBuilder method(HttpMethod method)
":method" header.RequestHeadersBuilder path(String path)
":path" header.RequestHeadersBuilder scheme(String scheme)
":scheme" header.default RequestHeadersBuilder scheme(SessionProtocol sessionProtocol)
":scheme" header from the specified SessionProtocol.RequestHeadersBuilder authority(String authority)
":authority" header.default RequestHeadersBuilder authority(Endpoint endpoint)
":authority" header from the specified Endpoint.IllegalArgumentException - if the specified Endpoint refers to a groupRequestHeadersBuilder sizeHint(int sizeHint)
HttpHeadersBuildersizeHint in interface HttpHeadersBuilderthisRequestHeadersBuilder endOfStream(boolean endOfStream)
HttpHeadersBuilderendOfStream in interface HttpHeadersBuilderRequestHeadersBuilder contentType(MediaType contentType)
HttpHeadersBuilder"content-type" header.contentType in interface HttpHeadersBuilderRequestHeadersBuilder add(CharSequence name, String value)
HttpHeadersBuildername and value.add in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder add(CharSequence name, Iterable<String> values)
HttpHeadersBuildername and values. This method is semantically
equivalent to
for (String value : values) {
builder.add(name, value);
}
add in interface HttpHeadersBuildername - the header namevalues - the header valuesthisRequestHeadersBuilder add(CharSequence name, String... values)
HttpHeadersBuildername and values. This method is semantically
equivalent to
for (String value : values) {
builder.add(name, value);
}
add in interface HttpHeadersBuildername - the header namevalues - the header valuesthisRequestHeadersBuilder add(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
HttpHeadersBuilderentries.add in interface HttpHeadersBuilderthisRequestHeadersBuilder addObject(CharSequence name, Object value)
HttpHeadersBuilderString, as explained
in Specifying a non-String header value.addObject in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder addObject(CharSequence name, Iterable<?> values)
HttpHeadersBuilderStrings, as explained in Specifying a non-String
header value. This method is equivalent to:
for (Object v : values) {
builder.addObject(name, v);
}
addObject in interface HttpHeadersBuildername - the header namevalues - the header valuesthisRequestHeadersBuilder addObject(CharSequence name, Object... values)
HttpHeadersBuilderStrings, as explained in Specifying a non-String
header value. This method is equivalent to:
for (Object v : values) {
builder.addObject(name, v);
}
addObject in interface HttpHeadersBuildername - the header namevalues - the header valuesthisRequestHeadersBuilder addObject(Iterable<? extends Map.Entry<? extends CharSequence,?>> entries)
HttpHeadersBuilderentries. The specified header values are
converted into Strings, as explained in Specifying
a non-String header value.addObject in interface HttpHeadersBuilderthisRequestHeadersBuilder addInt(CharSequence name, int value)
HttpHeadersBuilderaddInt in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder addLong(CharSequence name, long value)
HttpHeadersBuilderaddLong in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder addFloat(CharSequence name, float value)
HttpHeadersBuilderaddFloat in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder addDouble(CharSequence name, double value)
HttpHeadersBuilderaddDouble in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder addTimeMillis(CharSequence name, long value)
HttpHeadersBuilderaddTimeMillis in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder set(CharSequence name, String value)
HttpHeadersBuilderset in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder set(CharSequence name, Iterable<String> values)
HttpHeadersBuilder
builder.remove(name);
for (String v : values) {
builder.add(name, v);
}
set in interface HttpHeadersBuildername - the header namevalues - the header valuesthisRequestHeadersBuilder set(CharSequence name, String... values)
HttpHeadersBuilder
builder.remove(name);
for (String v : values) {
builder.add(name, v);
}
set in interface HttpHeadersBuildername - the header namevalues - the header valuesthisRequestHeadersBuilder set(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
HttpHeadersBuilderHttpHeadersBuilder.set(CharSequence, String) for each header in
the specified entries.set in interface HttpHeadersBuilderentries - the headers used to set the header valuesthisRequestHeadersBuilder setIfAbsent(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
HttpHeadersBuilderentries.
This method is a shortcut for:
headers.names().forEach(name -> {
if (!builder.contains(name)) {
builder.set(name, headers.getAll(name));
}
});
setIfAbsent in interface HttpHeadersBuilderthisRequestHeadersBuilder setObject(CharSequence name, Object value)
HttpHeadersBuilderString, as explained in Specifying
a non-String header value.setObject in interface HttpHeadersBuildername - the header namevalue - the value of the headerthisRequestHeadersBuilder setObject(CharSequence name, Iterable<?> values)
HttpHeadersBuilderStrings, as explained in
Specifying a non-String header value.
This method is equivalent to:
builder.remove(name);
for (Object v : values) {
builder.addObject(name, v);
}
setObject in interface HttpHeadersBuildername - the header namevalues - the values of the headerthisRequestHeadersBuilder setObject(CharSequence name, Object... values)
HttpHeadersBuilderStrings, as explained in
Specifying a non-String header value.
This method is equivalent to:
builder.remove(name);
for (Object v : values) {
builder.addObject(name, v);
}
setObject in interface HttpHeadersBuildername - the header namevalues - the values of the headerthisRequestHeadersBuilder setObject(Iterable<? extends Map.Entry<? extends CharSequence,?>> entries)
HttpHeadersBuilderHttpHeadersBuilder.setObject(CharSequence, Object) for each entry in
the specified entries. The specified header values are converted into Strings,
as explained in Specifying a non-String header value.setObject in interface HttpHeadersBuilderentries - the headers used to set the values in this instancethisRequestHeadersBuilder setInt(CharSequence name, int value)
HttpHeadersBuildername to value. This will remove all previous values
associated with name.setInt in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder setLong(CharSequence name, long value)
HttpHeadersBuildername to value. This will remove all previous values
associated with name.setLong in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder setFloat(CharSequence name, float value)
HttpHeadersBuildername to value. This will remove all previous values
associated with name.setFloat in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder setDouble(CharSequence name, double value)
HttpHeadersBuildername to value. This will remove all previous values
associated with name.setDouble in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder setTimeMillis(CharSequence name, long value)
HttpHeadersBuildername to value. This will remove all previous values
associated with name.setTimeMillis in interface HttpHeadersBuildername - the header namevalue - the header valuethisRequestHeadersBuilder removeAndThen(CharSequence name)
HttpHeadersBuildername. Unlike HttpHeadersBuilder.remove(CharSequence)
this method returns itself so that the caller can chain the invocations.removeAndThen in interface HttpHeadersBuildername - the header namethisRequestHeadersBuilder clear()
HttpHeadersBuildersize() becomes 0.clear in interface HttpHeadersBuilderthisURI uri()
":scheme", ":authority" and ":path"
headers.IllegalStateException - if any of the required headers do not exist or
the resulting URI is not valid.HttpMethod method()
":method" header as an HttpMethod.
HttpMethod.UNKNOWN is returned if the value is not defined in HttpMethod.IllegalStateException - if there is no such header.String path()
":path" header.IllegalStateException - if there is no such header.String scheme()
":scheme" header or null if there is no such header.String authority()
":authority" header or null if there is no such header.boolean isEndOfStream()
MediaType contentType()
"content-type" header.MediaType if present and valid, or null otherwise.String get(CharSequence name)
name. If there are more than one value for
the specified name, the first value in insertion order is returned.name - the name of the header to retrievenull if there's no such headerString get(CharSequence name, String defaultValue)
name. If there are more than one value for
the specified name, the first value in insertion order is returned.name - the name of the header to retrievedefaultValue - the default valuedefaultValue if there is no such headerList<String> getAll(CharSequence name)
List can't be modified.Integer getInt(CharSequence name)
int value of a header with the specified name. If there are more than one
value for the specified name, the first value in insertion order is returned.name - the name of the header to retrieveint value of the first value in insertion order or null if there is no such
header or it can't be converted to int.int getInt(CharSequence name, int defaultValue)
int value of a header with the specified name. If there are more than one
value for the specified name, the first value in insertion order is returned.name - the name of the header to retrievedefaultValue - the default valueint value of the first value in insertion order or defaultValue if there is
no such header or it can't be converted to int.Long getLong(CharSequence name)
long value of a header with the specified name. If there are more than one
value for the specified name, the first value in insertion order is returned.name - the name of the header to retrievelong value of the first value in insertion order or null if there is no such
header or it can't be converted to long.long getLong(CharSequence name, long defaultValue)
long value of a header with the specified name. If there are more than one
value for the specified name, the first value in insertion order is returned.name - the name of the header to retrievedefaultValue - the default valuelong value of the first value in insertion order or defaultValue if there is
no such header or it can't be converted to long.Float getFloat(CharSequence name)
float value of a header with the specified name. If there are more than one
value for the specified name, the first value in insertion order is returned.name - the name of the header to retrievefloat value of the first value in insertion order or null if there is no
such header or it can't be converted to float.float getFloat(CharSequence name, float defaultValue)
float value of a header with the specified name. If there are more than one
value for the specified name, the first value in insertion order is returned.name - the name of the header to retrievedefaultValue - the default valuefloat value of the first value in insertion order or defaultValue if there
is no such header or it can't be converted to float.Double getDouble(CharSequence name)
double value of a header with the specified name. If there are more than one
value for the specified name, the first value in insertion order is returned.name - the name of the header to retrievedouble value of the first value in insertion order or null if there is no
such header or it can't be converted to double.double getDouble(CharSequence name, double defaultValue)
double value of a header with the specified name. If there are more than one
value for the specified name, the first value in insertion order is returned.name - the name of the header to retrievedefaultValue - the default valuedouble value of the first value in insertion order or defaultValue if there
is no such header or it can't be converted to double.Long getTimeMillis(CharSequence name)
name in milliseconds. If there are more than
one value for the specified name, the first value in insertion order is returned.name - the name of the header to retrievenull if there is no such
header or it can't be converted to milliseconds.long getTimeMillis(CharSequence name, long defaultValue)
name in milliseconds. If there are more than
one value for the specified name, the first value in insertion order is returned.name - the name of the header to retrievedefaultValue - the default valuedefaultValue if there is
no such header or it can't be converted to milliseconds.boolean contains(CharSequence name)
true if a header with the name exists, false otherwise.name - the header nameboolean contains(CharSequence name, String value)
true if a header with the name and value exists.name - the header namevalue - the header value of the header to findboolean containsObject(CharSequence name, Object value)
true if a header with the name and value exists.name - the header namevalue - the header valuetrue if the header exists. false otherwiseboolean containsInt(CharSequence name, int value)
true if a header with the name and value exists.name - the header namevalue - the header valuetrue if the header exists. false otherwiseboolean containsLong(CharSequence name, long value)
true if a header with the name and value exists.name - the header namevalue - the header valuetrue if the header exists. false otherwiseboolean containsFloat(CharSequence name, float value)
true if a header with the name and value exists.name - the header namevalue - the header valuetrue if the header exists. false otherwiseboolean containsDouble(CharSequence name, double value)
true if a header with the name and value exists.name - the header namevalue - the header valuetrue if the header exists. false otherwiseboolean containsTimeMillis(CharSequence name, long value)
true if a header with the name and value exists.name - the header namevalue - the header valuetrue if the header exists. false otherwiseint size()
boolean isEmpty()
true if this headers does not contain any entries.Set<io.netty.util.AsciiString> names()
Iterator<Map.Entry<io.netty.util.AsciiString,String>> iterator()
Iterator that yields all header entries. The iteration order is as follows:
Iterator<String> valueIterator(CharSequence name)
Iterator that yields all values of the headers with the specified name.void forEach(BiConsumer<io.netty.util.AsciiString,String> action)
action for all header entries.void forEachValue(CharSequence name, Consumer<String> action)
action for all values of the headers with the specified name.default Stream<Map.Entry<io.netty.util.AsciiString,String>> stream()
Stream that yields all header entries.default Stream<String> valueStream(CharSequence name)
Stream that yields all values of the headers with the specified name.Copyright © 2020 LeanCloud. All rights reserved.