Send feedback
Class HttpBody (2.50.1)
Stay organized with collections
Save and categorize content based on your preferences.
Version latest keyboard_arrow_down
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
Inherited Members
com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT)
com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT,int)
com.google.protobuf.GeneratedMessageV3.<T>emptyList(java.lang.Class<T>)
com.google.protobuf.GeneratedMessageV3.internalGetMapFieldReflection(int)
Static 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 ()
getDescriptor()
public static final Descriptors . Descriptor getDescriptor ()
newBuilder()
public static HttpBody . Builder newBuilder ()
newBuilder(HttpBody prototype)
public static HttpBody . Builder newBuilder ( HttpBody prototype )
Parameter
Name
Description
prototype
HttpBody
parseDelimitedFrom(InputStream input)
public static HttpBody parseDelimitedFrom ( InputStream input )
parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseDelimitedFrom ( InputStream input , ExtensionRegistryLite extensionRegistry )
parseFrom(byte[] data)
public static HttpBody parseFrom ( byte [] data )
Parameter
Name
Description
data
byte []
parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom ( byte [] data , ExtensionRegistryLite extensionRegistry )
parseFrom(ByteString data)
public static HttpBody parseFrom ( ByteString data )
parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom ( ByteString data , ExtensionRegistryLite extensionRegistry )
parseFrom(CodedInputStream input)
public static HttpBody parseFrom ( CodedInputStream input )
parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom ( CodedInputStream input , ExtensionRegistryLite extensionRegistry )
parseFrom(InputStream input)
public static HttpBody parseFrom ( InputStream input )
parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom ( InputStream input , ExtensionRegistryLite extensionRegistry )
parseFrom(ByteBuffer data)
public static HttpBody parseFrom ( ByteBuffer data )
parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom ( ByteBuffer data , ExtensionRegistryLite extensionRegistry )
parser()
public static Parser<HttpBody> parser ()
Methods
equals(Object obj)
public boolean equals ( Object obj )
Parameter
Name
Description
obj
Object
Overrides
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;
getDefaultInstanceForType()
public HttpBody getDefaultInstanceForType ()
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;
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
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 ()
Overrides
getSerializedSize()
public int getSerializedSize ()
Returns
Type
Description
int
Overrides
hashCode()
Returns
Type
Description
int
Overrides
internalGetFieldAccessorTable()
protected GeneratedMessageV3 . FieldAccessorTable internalGetFieldAccessorTable ()
Overrides
isInitialized()
public final boolean isInitialized ()
Overrides
newBuilderForType()
public HttpBody . Builder newBuilderForType ()
newBuilderForType(GeneratedMessageV3.BuilderParent parent)
protected HttpBody . Builder newBuilderForType ( GeneratedMessageV3 . BuilderParent parent )
Overrides
newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
protected Object newInstance ( GeneratedMessageV3 . UnusedPrivateParameter unused )
Returns
Type
Description
Object
Overrides
toBuilder()
public HttpBody . Builder toBuilder ()
writeTo(CodedOutputStream output)
public void writeTo ( CodedOutputStream output )
Overrides
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-01-28 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-28 UTC."],[],[]]