Package com.linecorp.armeria.common
Class AbstractHttpMessageBuilder
java.lang.Object
com.linecorp.armeria.common.AbstractHttpMessageBuilder
- All Implemented Interfaces:
HttpMessageSetters
- Direct Known Subclasses:
AbstractHttpRequestBuilder
,HttpResponseBuilder
@UnstableApi
public abstract class AbstractHttpMessageBuilder
extends Object
implements HttpMessageSetters
A skeletal builder implementation for
HttpMessage
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSets the content for this message.Sets the content for this message.content
(MediaType contentType, CharSequence content) Sets the content for this message.Sets the content for this message.Sets the content for this message.Sets thePublisher
for this message.Sets the content as UTF-8 for this message.Sets the content as UTF-8 for this message.contentJson
(Object content) Sets the content for this message.header
(CharSequence name, Object value) Adds a header for this message.headers
(Iterable<? extends Map.Entry<? extends CharSequence, String>> headers) Adds multiple headers for this message.Returns thePublisher
that was set bycontent(MediaType, Publisher)
.trailer
(CharSequence name, Object value) Adds an HTTP trailer for this message.trailers
(Iterable<? extends Map.Entry<? extends CharSequence, String>> trailers) Adds HTTP trailers for this message.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.common.HttpMessageSetters
cookie, cookies
-
Constructor Details
-
AbstractHttpMessageBuilder
protected AbstractHttpMessageBuilder()Creates a new instance.
-
-
Method Details
-
publisher
Returns thePublisher
that was set bycontent(MediaType, Publisher)
. -
header
Description copied from interface:HttpMessageSetters
Adds a header for this message.- Specified by:
header
in interfaceHttpMessageSetters
-
headers
public AbstractHttpMessageBuilder headers(Iterable<? extends Map.Entry<? extends CharSequence, String>> headers) Description copied from interface:HttpMessageSetters
Adds multiple headers for this message.- Specified by:
headers
in interfaceHttpMessageSetters
- See Also:
-
content
Description copied from interface:HttpMessageSetters
Sets the content as UTF-8 for this message.- Specified by:
content
in interfaceHttpMessageSetters
-
content
Description copied from interface:HttpMessageSetters
Sets the content for this message.- Specified by:
content
in interfaceHttpMessageSetters
-
content
Description copied from interface:HttpMessageSetters
Sets the content for this message.- Specified by:
content
in interfaceHttpMessageSetters
-
content
@FormatMethod public AbstractHttpMessageBuilder content(@FormatString String format, Object... content) Description copied from interface:HttpMessageSetters
Sets the content as UTF-8 for this message. Thecontent
is formatted byString.format(Locale, String, Object...)
with English locale.- Specified by:
content
in interfaceHttpMessageSetters
-
content
@FormatMethod public AbstractHttpMessageBuilder content(MediaType contentType, @FormatString String format, Object... content) Description copied from interface:HttpMessageSetters
Sets the content for this message. Thecontent
is formatted byString.format(Locale, String, Object...)
with English locale.- Specified by:
content
in interfaceHttpMessageSetters
-
content
Description copied from interface:HttpMessageSetters
Sets the content for this message. Thecontent
will be wrapped usingHttpData.wrap(byte[])
, so any changes made tocontent
will be reflected in the request.- Specified by:
content
in interfaceHttpMessageSetters
-
content
Description copied from interface:HttpMessageSetters
Sets the content for this message.- Specified by:
content
in interfaceHttpMessageSetters
-
content
public AbstractHttpMessageBuilder content(MediaType contentType, org.reactivestreams.Publisher<? extends HttpData> publisher) Description copied from interface:HttpMessageSetters
Sets thePublisher
for this message.- Specified by:
content
in interfaceHttpMessageSetters
-
contentJson
Description copied from interface:HttpMessageSetters
Sets the content for this message. Thecontent
is converted into JSON format using the defaultObjectMapper
.- Specified by:
contentJson
in interfaceHttpMessageSetters
-
trailer
Description copied from interface:HttpMessageSetters
Adds an HTTP trailer for this message.- Specified by:
trailer
in interfaceHttpMessageSetters
-
trailers
public AbstractHttpMessageBuilder trailers(Iterable<? extends Map.Entry<? extends CharSequence, String>> trailers) Description copied from interface:HttpMessageSetters
Adds HTTP trailers for this message.- Specified by:
trailers
in interfaceHttpMessageSetters
-