public final class HttpBody extends GeneratedMessageV3 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
Inheritance
Object > AbstractMessageLite<MessageType,BuilderType> > AbstractMessage > GeneratedMessageV3 > HttpBodyImplements
HttpBodyOrBuilderStatic Fields
CONTENT_TYPE_FIELD_NUMBER
public static final int CONTENT_TYPE_FIELD_NUMBER
Field Value | |
---|---|
Type | Description |
int |
DATA_FIELD_NUMBER
public static final int DATA_FIELD_NUMBER
Field Value | |
---|---|
Type | Description |
int |
EXTENSIONS_FIELD_NUMBER
public static final int EXTENSIONS_FIELD_NUMBER
Field Value | |
---|---|
Type | Description |
int |
Static Methods
getDefaultInstance()
public static HttpBody getDefaultInstance()
Returns | |
---|---|
Type | Description |
HttpBody |
getDescriptor()
public static final Descriptors.Descriptor getDescriptor()
Returns | |
---|---|
Type | Description |
Descriptor |
newBuilder()
public static HttpBody.Builder newBuilder()
Returns | |
---|---|
Type | Description |
HttpBody.Builder |
newBuilder(HttpBody prototype)
public static HttpBody.Builder newBuilder(HttpBody prototype)
Parameter | |
---|---|
Name | Description |
prototype | HttpBody |
Returns | |
---|---|
Type | Description |
HttpBody.Builder |
parseDelimitedFrom(InputStream input)
public static HttpBody parseDelimitedFrom(InputStream input)
Parameter | |
---|---|
Name | Description |
input | InputStream |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
IOException |
parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
input | InputStream |
extensionRegistry | ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
IOException |
parseFrom(byte[] data)
public static HttpBody parseFrom(byte[] data)
Parameter | |
---|---|
Name | Description |
data | byte[] |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
data | byte[] |
extensionRegistry | ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parseFrom(ByteString data)
public static HttpBody parseFrom(ByteString data)
Parameter | |
---|---|
Name | Description |
data | ByteString |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
data | ByteString |
extensionRegistry | ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parseFrom(CodedInputStream input)
public static HttpBody parseFrom(CodedInputStream input)
Parameter | |
---|---|
Name | Description |
input | CodedInputStream |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
IOException |
parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
input | CodedInputStream |
extensionRegistry | ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
IOException |
parseFrom(InputStream input)
public static HttpBody parseFrom(InputStream input)
Parameter | |
---|---|
Name | Description |
input | InputStream |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
IOException |
parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
input | InputStream |
extensionRegistry | ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
IOException |
parseFrom(ByteBuffer data)
public static HttpBody parseFrom(ByteBuffer data)
Parameter | |
---|---|
Name | Description |
data | ByteBuffer |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters | |
---|---|
Name | Description |
data | ByteBuffer |
extensionRegistry | ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
HttpBody |
Exceptions | |
---|---|
Type | Description |
InvalidProtocolBufferException |
parser()
public static Parser<HttpBody> parser()
Returns | |
---|---|
Type | Description |
Parser<HttpBody> |
Methods
equals(Object obj)
public boolean equals(Object obj)
Parameter | |
---|---|
Name | Description |
obj | Object |
Returns | |
---|---|
Type | Description |
boolean |
getContentType()
public String getContentType()
The HTTP Content-Type header value specifying the content type of the body.
string content_type = 1;
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
ByteString | The bytes for contentType. |
getData()
public ByteString getData()
The HTTP request/response body as raw binary.
bytes data = 2;
Returns | |
---|---|
Type | Description |
ByteString | The data. |
getDefaultInstanceForType()
public HttpBody getDefaultInstanceForType()
Returns | |
---|---|
Type | Description |
HttpBody |
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 | |
---|---|
Name | Description |
index | int |
Returns | |
---|---|
Type | Description |
Any |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
index | int |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
List<? extends com.google.protobuf.AnyOrBuilder> |
getParserForType()
public Parser<HttpBody> getParserForType()
Returns | |
---|---|
Type | Description |
Parser<HttpBody> |
getSerializedSize()
public int getSerializedSize()
Returns | |
---|---|
Type | Description |
int |
hashCode()
public int hashCode()
Returns | |
---|---|
Type | Description |
int |
internalGetFieldAccessorTable()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns | |
---|---|
Type | Description |
FieldAccessorTable |
isInitialized()
public final boolean isInitialized()
Returns | |
---|---|
Type | Description |
boolean |
newBuilderForType()
public HttpBody.Builder newBuilderForType()
Returns | |
---|---|
Type | Description |
HttpBody.Builder |
newBuilderForType(GeneratedMessageV3.BuilderParent parent)
protected HttpBody.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter | |
---|---|
Name | Description |
parent | BuilderParent |
Returns | |
---|---|
Type | Description |
HttpBody.Builder |
newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter | |
---|---|
Name | Description |
unused | UnusedPrivateParameter |
Returns | |
---|---|
Type | Description |
Object |
toBuilder()
public HttpBody.Builder toBuilder()
Returns | |
---|---|
Type | Description |
HttpBody.Builder |
writeTo(CodedOutputStream output)
public void writeTo(CodedOutputStream output)
Parameter | |
---|---|
Name | Description |
output | CodedOutputStream |
Exceptions | |
---|---|
Type | Description |
IOException |