Class HttpBody.Builder (2.11.0)

public static final class HttpBody.Builder extends GeneratedMessageV3.Builder<HttpBody.Builder> implements HttpBodyOrBuilder

Message that represents an arbitrary HTTP body. It should only be used for payload formats that can't be represented as JSON, such as raw binary or an HTML page. This message can be used both in streaming and non-streaming API methods in the request as well as the response. It can be used as a top-level request field, which is convenient if one wants to extract parameters from either the URL or HTTP template into the request fields and also want access to the raw HTTP body. Example: message GetResourceRequest { // A unique request id. string request_id = 1; // The raw HTTP body is bound to this field. google.api.HttpBody http_body = 2; } service ResourceService { rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty); } Example with streaming methods: service CaldavService { rpc GetCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); rpc UpdateCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); } Use of this type only changes how the request and response bodies are handled, all other features will continue to work unchanged.

Protobuf type google.api.HttpBody

Implements

HttpBodyOrBuilder

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

Methods

addAllExtensions(Iterable<? extends Any> values)

public HttpBody.Builder addAllExtensions(Iterable<? extends Any> values)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameter
NameDescription
valuesIterable<? extends com.google.protobuf.Any>
Returns
TypeDescription
HttpBody.Builder

addExtensions(Any value)

public HttpBody.Builder addExtensions(Any value)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameter
NameDescription
valueAny
Returns
TypeDescription
HttpBody.Builder

addExtensions(Any.Builder builderForValue)

public HttpBody.Builder addExtensions(Any.Builder builderForValue)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameter
NameDescription
builderForValueBuilder
Returns
TypeDescription
HttpBody.Builder

addExtensions(int index, Any value)

public HttpBody.Builder addExtensions(int index, Any value)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameters
NameDescription
indexint
valueAny
Returns
TypeDescription
HttpBody.Builder

addExtensions(int index, Any.Builder builderForValue)

public HttpBody.Builder addExtensions(int index, Any.Builder builderForValue)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameters
NameDescription
indexint
builderForValueBuilder
Returns
TypeDescription
HttpBody.Builder

addExtensionsBuilder()

public Any.Builder addExtensionsBuilder()

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Returns
TypeDescription
Builder

addExtensionsBuilder(int index)

public Any.Builder addExtensionsBuilder(int index)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameter
NameDescription
indexint
Returns
TypeDescription
Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public HttpBody.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
HttpBody.Builder
Overrides

build()

public HttpBody build()
Returns
TypeDescription
HttpBody

buildPartial()

public HttpBody buildPartial()
Returns
TypeDescription
HttpBody

clear()

public HttpBody.Builder clear()
Returns
TypeDescription
HttpBody.Builder
Overrides

clearContentType()

public HttpBody.Builder clearContentType()

The HTTP Content-Type header value specifying the content type of the body.

string content_type = 1;

Returns
TypeDescription
HttpBody.Builder

This builder for chaining.

clearData()

public HttpBody.Builder clearData()

The HTTP request/response body as raw binary.

bytes data = 2;

Returns
TypeDescription
HttpBody.Builder

This builder for chaining.

clearExtensions()

public HttpBody.Builder clearExtensions()

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Returns
TypeDescription
HttpBody.Builder

clearField(Descriptors.FieldDescriptor field)

public HttpBody.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
HttpBody.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public HttpBody.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
HttpBody.Builder
Overrides

clone()

public HttpBody.Builder clone()
Returns
TypeDescription
HttpBody.Builder
Overrides

getContentType()

public String getContentType()

The HTTP Content-Type header value specifying the content type of the body.

string content_type = 1;

Returns
TypeDescription
String

The contentType.

getContentTypeBytes()

public ByteString getContentTypeBytes()

The HTTP Content-Type header value specifying the content type of the body.

string content_type = 1;

Returns
TypeDescription
ByteString

The bytes for contentType.

getData()

public ByteString getData()

The HTTP request/response body as raw binary.

bytes data = 2;

Returns
TypeDescription
ByteString

The data.

getDefaultInstanceForType()

public HttpBody getDefaultInstanceForType()
Returns
TypeDescription
HttpBody

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getExtensions(int index)

public Any getExtensions(int index)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameter
NameDescription
indexint
Returns
TypeDescription
Any

getExtensionsBuilder(int index)

public Any.Builder getExtensionsBuilder(int index)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameter
NameDescription
indexint
Returns
TypeDescription
Builder

getExtensionsBuilderList()

public List<Any.Builder> getExtensionsBuilderList()

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Returns
TypeDescription
List<Builder>

getExtensionsCount()

public int getExtensionsCount()

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Returns
TypeDescription
int

getExtensionsList()

public List<Any> getExtensionsList()

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Returns
TypeDescription
List<Any>

getExtensionsOrBuilder(int index)

public AnyOrBuilder getExtensionsOrBuilder(int index)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameter
NameDescription
indexint
Returns
TypeDescription
AnyOrBuilder

getExtensionsOrBuilderList()

public List<? extends AnyOrBuilder> getExtensionsOrBuilderList()

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Returns
TypeDescription
List<? extends com.google.protobuf.AnyOrBuilder>

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(HttpBody other)

public HttpBody.Builder mergeFrom(HttpBody other)
Parameter
NameDescription
otherHttpBody
Returns
TypeDescription
HttpBody.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public HttpBody.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
HttpBody.Builder
Overrides Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public HttpBody.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
HttpBody.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final HttpBody.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
HttpBody.Builder
Overrides

removeExtensions(int index)

public HttpBody.Builder removeExtensions(int index)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameter
NameDescription
indexint
Returns
TypeDescription
HttpBody.Builder

setContentType(String value)

public HttpBody.Builder setContentType(String value)

The HTTP Content-Type header value specifying the content type of the body.

string content_type = 1;

Parameter
NameDescription
valueString

The contentType to set.

Returns
TypeDescription
HttpBody.Builder

This builder for chaining.

setContentTypeBytes(ByteString value)

public HttpBody.Builder setContentTypeBytes(ByteString value)

The HTTP Content-Type header value specifying the content type of the body.

string content_type = 1;

Parameter
NameDescription
valueByteString

The bytes for contentType to set.

Returns
TypeDescription
HttpBody.Builder

This builder for chaining.

setData(ByteString value)

public HttpBody.Builder setData(ByteString value)

The HTTP request/response body as raw binary.

bytes data = 2;

Parameter
NameDescription
valueByteString

The data to set.

Returns
TypeDescription
HttpBody.Builder

This builder for chaining.

setExtensions(int index, Any value)

public HttpBody.Builder setExtensions(int index, Any value)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameters
NameDescription
indexint
valueAny
Returns
TypeDescription
HttpBody.Builder

setExtensions(int index, Any.Builder builderForValue)

public HttpBody.Builder setExtensions(int index, Any.Builder builderForValue)

Application specific response metadata. Must be set in the first response for streaming APIs.

repeated .google.protobuf.Any extensions = 3;

Parameters
NameDescription
indexint
builderForValueBuilder
Returns
TypeDescription
HttpBody.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public HttpBody.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
HttpBody.Builder
Overrides

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public HttpBody.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
HttpBody.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

public final HttpBody.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
HttpBody.Builder
Overrides