public interface ResponseHeadersBuilder extends HttpHeadersBuilder
ResponseHeaders.| Modifier and Type | Method and Description |
|---|---|
ResponseHeadersBuilder |
add(CharSequence name,
Iterable<String> values)
Adds new headers with the specified
name and values. |
ResponseHeadersBuilder |
add(CharSequence name,
String... values)
Adds new headers with the specified
name and values. |
ResponseHeadersBuilder |
add(CharSequence name,
String value)
Adds a new header with the specified
name and value. |
ResponseHeadersBuilder |
add(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
Adds all header names and values of the specified
entries. |
ResponseHeadersBuilder |
addDouble(CharSequence name,
double value)
Adds a new header.
|
ResponseHeadersBuilder |
addFloat(CharSequence name,
float value)
Adds a new header.
|
ResponseHeadersBuilder |
addInt(CharSequence name,
int value)
Adds a new header.
|
ResponseHeadersBuilder |
addLong(CharSequence name,
long value)
Adds a new header.
|
ResponseHeadersBuilder |
addObject(CharSequence name,
Iterable<?> values)
Adds a new header with the specified name and values.
|
ResponseHeadersBuilder |
addObject(CharSequence name,
Object... values)
Adds a new header with the specified name and values.
|
ResponseHeadersBuilder |
addObject(CharSequence name,
Object value)
Adds a new header.
|
ResponseHeadersBuilder |
addObject(Iterable<? extends Map.Entry<? extends CharSequence,?>> entries)
Adds all header names and values of the specified
entries. |
ResponseHeadersBuilder |
addTimeMillis(CharSequence name,
long value)
Adds a new header.
|
ResponseHeaders |
build()
Returns a newly created
ResponseHeaders with the entries in this builder. |
ResponseHeadersBuilder |
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. |
ResponseHeadersBuilder |
contentType(MediaType contentType)
Sets the
"content-type" header. |
ResponseHeadersBuilder |
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. |
Set<io.netty.util.AsciiString> |
names()
Returns a
Set of all header names. |
ResponseHeadersBuilder |
removeAndThen(CharSequence name)
Removes all headers with the specified
name. |
ResponseHeadersBuilder |
set(CharSequence name,
Iterable<String> values)
Sets a new header with the specified name and values.
|
ResponseHeadersBuilder |
set(CharSequence name,
String... values)
Sets a header with the specified name and values.
|
ResponseHeadersBuilder |
set(CharSequence name,
String value)
Sets a header with the specified name and value.
|
ResponseHeadersBuilder |
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. |
ResponseHeadersBuilder |
setDouble(CharSequence name,
double value)
Sets a header with the specified
name to value. |
ResponseHeadersBuilder |
setFloat(CharSequence name,
float value)
Sets a header with the specified
name to value. |
ResponseHeadersBuilder |
setIfAbsent(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
Copies the entries missing in this headers from the specified
entries. |
ResponseHeadersBuilder |
setInt(CharSequence name,
int value)
Sets a header with the specified
name to value. |
ResponseHeadersBuilder |
setLong(CharSequence name,
long value)
Sets a header with the specified
name to value. |
ResponseHeadersBuilder |
setObject(CharSequence name,
Iterable<?> values)
Sets a header with the specified name and values.
|
ResponseHeadersBuilder |
setObject(CharSequence name,
Object... values)
Sets a header with the specified name and values.
|
ResponseHeadersBuilder |
setObject(CharSequence name,
Object value)
Sets a new header.
|
ResponseHeadersBuilder |
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. |
ResponseHeadersBuilder |
setTimeMillis(CharSequence name,
long value)
Sets a header with the specified
name to value. |
int |
size()
Returns the number of headers.
|
ResponseHeadersBuilder |
sizeHint(int sizeHint)
Specifies the hint about the number of headers which may improve the memory efficiency and performance
of the underlying data structure.
|
HttpStatus |
status()
Returns the value of the
":status" header as an HttpStatus. |
ResponseHeadersBuilder |
status(HttpStatus status)
Sets the
":status" header. |
ResponseHeadersBuilder |
status(int statusCode)
Sets the
":status" header. |
default Stream<Map.Entry<io.netty.util.AsciiString,String>> |
stream()
Returns a
Stream that yields all header entries. |
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, spliteratorResponseHeaders build()
ResponseHeaders with the entries in this builder.build in interface HttpHeadersBuilderIllegalStateException - if this builder does not have ":status" header set.ResponseHeadersBuilder status(int statusCode)
":status" header.ResponseHeadersBuilder status(HttpStatus status)
":status" header.ResponseHeadersBuilder sizeHint(int sizeHint)
HttpHeadersBuildersizeHint in interface HttpHeadersBuilderthisResponseHeadersBuilder endOfStream(boolean endOfStream)
HttpHeadersBuilderendOfStream in interface HttpHeadersBuilderResponseHeadersBuilder contentType(MediaType contentType)
HttpHeadersBuilder"content-type" header.contentType in interface HttpHeadersBuilderResponseHeadersBuilder add(CharSequence name, String value)
HttpHeadersBuildername and value.add in interface HttpHeadersBuildername - the header namevalue - the header valuethisResponseHeadersBuilder 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 valuesthisResponseHeadersBuilder 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 valuesthisResponseHeadersBuilder add(Iterable<? extends Map.Entry<? extends CharSequence,String>> entries)
HttpHeadersBuilderentries.add in interface HttpHeadersBuilderthisResponseHeadersBuilder addObject(CharSequence name, Object value)
HttpHeadersBuilderString, as explained
in Specifying a non-String header value.addObject in interface HttpHeadersBuildername - the header namevalue - the header valuethisResponseHeadersBuilder 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 valuesthisResponseHeadersBuilder 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 valuesthisResponseHeadersBuilder 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 HttpHeadersBuilderthisResponseHeadersBuilder addInt(CharSequence name, int value)
HttpHeadersBuilderaddInt in interface HttpHeadersBuildername - the header namevalue - the header valuethisResponseHeadersBuilder addLong(CharSequence name, long value)
HttpHeadersBuilderaddLong in interface HttpHeadersBuildername - the header namevalue - the header valuethisResponseHeadersBuilder addFloat(CharSequence name, float value)
HttpHeadersBuilderaddFloat in interface HttpHeadersBuildername - the header namevalue - the header valuethisResponseHeadersBuilder addDouble(CharSequence name, double value)
HttpHeadersBuilderaddDouble in interface HttpHeadersBuildername - the header namevalue - the header valuethisResponseHeadersBuilder addTimeMillis(CharSequence name, long value)
HttpHeadersBuilderaddTimeMillis in interface HttpHeadersBuildername - the header namevalue - the header valuethisResponseHeadersBuilder set(CharSequence name, String value)
HttpHeadersBuilderset in interface HttpHeadersBuildername - the header namevalue - the header valuethisResponseHeadersBuilder 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 valuesthisResponseHeadersBuilder 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 valuesthisResponseHeadersBuilder 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 valuesthisResponseHeadersBuilder 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 HttpHeadersBuilderthisResponseHeadersBuilder 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 headerthisResponseHeadersBuilder 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 headerthisResponseHeadersBuilder 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 headerthisResponseHeadersBuilder 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 instancethisResponseHeadersBuilder 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 valuethisResponseHeadersBuilder 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 valuethisResponseHeadersBuilder 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 valuethisResponseHeadersBuilder 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 valuethisResponseHeadersBuilder 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 valuethisResponseHeadersBuilder 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 namethisResponseHeadersBuilder clear()
HttpHeadersBuildersize() becomes 0.clear in interface HttpHeadersBuilderthisHttpStatus status()
":status" header as an HttpStatus.
If the value is malformed, HttpStatus.UNKNOWN will be returned.IllegalStateException - 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.