Class HttpHeaders.Builder
Object
se.curity.identityserver.sdk.http.HttpHeaders.Builder
- Enclosing class:
- HttpHeaders
A Builder of
HttpHeaders instances.
This builder is mutable and keeps intermediate state so that it can create headers based on
the current state when create(String...) is called.
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder()Creates an empty builder.Builder(HttpHeaders headers) Creates a builder that uses the header contents of the givenHttpHeadersinstance.Builder(HttpHeaders.Builder otherBuilder) Creates a builder that makes a copy of the state of the other builder. -
Method Summary
Modifier and TypeMethodDescriptioncreate()Create an instance ofHttpHeadersusing the current state of this builder.Create an instance ofHttpHeadersusing the current state of this builder.Get the values of the header with the given name.header(String name, Collection<String> values) Add a header with the given name and values.Add a header with the given name and value.Remove the header with the given name.toString()
-
Constructor Details
-
Builder
public Builder()Creates an empty builder.- See Also:
-
Builder
Creates a builder that makes a copy of the state of the other builder.- Parameters:
otherBuilder- to copy
-
Builder
Creates a builder that uses the header contents of the givenHttpHeadersinstance.- Parameters:
headers- to copy into this builder
-
-
Method Details
-
header
Add a header with the given name and value.Notice that if the value contains ',' (comma) or ';' (semicolon), it may be split apart into different values if the header is known to accept comma-separated or semicolon-separated values.
- Parameters:
name- of the headervalue- of the header- Returns:
- this builder
-
remove
Remove the header with the given name.If not present, this method has no effect.
- Parameters:
name- of header to remove- Returns:
- this builder
- Since:
- 2.1.0
-
header
Add a header with the given name and values.Notice that if any value contains ',' (comma) or ';' (semicolon), it may be split apart into different values if the header is known to accept comma-separated or semicolon-separated values.
- Parameters:
name- of the headervalues- for the header- Returns:
- this builder
-
create
Create an instance ofHttpHeadersusing the current state of this builder.- Returns:
- a new
HttpHeaders.
-
create
Create an instance ofHttpHeadersusing the current state of this builder.- Parameters:
exclude- name of the headers to exclude from the returnedHttpHeaders.- Returns:
- a new
HttpHeaders.
-
get
Get the values of the header with the given name.- Parameters:
headerName- header name- Returns:
- the values of this header, or the empty List if the header was not set
- Since:
- 2.1.0
-
toString
-