Send feedback
Class HttpBody (2.9.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version 2.9.0 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
Static Fields
CONTENT_TYPE_FIELD_NUMBER
public static final int CONTENT_TYPE_FIELD_NUMBER
Field Value
DATA_FIELD_NUMBER
public static final int DATA_FIELD_NUMBER
Field Value
EXTENSIONS_FIELD_NUMBER
public static final int EXTENSIONS_FIELD_NUMBER
Field Value
Static Methods
getDefaultInstance()
public static HttpBody getDefaultInstance ()
Returns
getDescriptor()
public static final Descriptors . Descriptor getDescriptor ()
Returns
newBuilder()
public static HttpBody . Builder newBuilder ()
Returns
newBuilder(HttpBody prototype)
public static HttpBody . Builder newBuilder ( HttpBody prototype )
Parameter
Returns
parseDelimitedFrom(InputStream input)
public static HttpBody parseDelimitedFrom ( InputStream input )
Parameter
Returns
Exceptions
parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseDelimitedFrom ( InputStream input , ExtensionRegistryLite extensionRegistry )
Parameters
Returns
Exceptions
parseFrom(byte[] data)
public static HttpBody parseFrom ( byte [] data )
Parameter
Name Description data byte []
Returns
Exceptions
parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom ( byte [] data , ExtensionRegistryLite extensionRegistry )
Parameters
Returns
Exceptions
parseFrom(ByteString data)
public static HttpBody parseFrom ( ByteString data )
Parameter
Returns
Exceptions
parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom ( ByteString data , ExtensionRegistryLite extensionRegistry )
Parameters
Returns
Exceptions
parseFrom(CodedInputStream input)
public static HttpBody parseFrom ( CodedInputStream input )
Parameter
Returns
Exceptions
parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom ( CodedInputStream input , ExtensionRegistryLite extensionRegistry )
Parameters
Returns
Exceptions
parseFrom(InputStream input)
public static HttpBody parseFrom ( InputStream input )
Parameter
Returns
Exceptions
parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom ( InputStream input , ExtensionRegistryLite extensionRegistry )
Parameters
Returns
Exceptions
parseFrom(ByteBuffer data)
public static HttpBody parseFrom ( ByteBuffer data )
Parameter
Returns
Exceptions
parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
public static HttpBody parseFrom ( ByteBuffer data , ExtensionRegistryLite extensionRegistry )
Parameters
Returns
Exceptions
parser()
public static Parser<HttpBody> parser ()
Returns
Methods
equals(Object obj)
public boolean equals ( Object obj )
Parameter
Returns
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;
Returns
getDefaultInstanceForType()
public HttpBody getDefaultInstanceForType ()
Returns
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
Returns
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
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
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
Returns
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
Overrides
getSerializedSize()
public int getSerializedSize ()
Returns
Overrides
getUnknownFields()
public final UnknownFieldSet getUnknownFields ()
Returns
Overrides
hashCode()
Returns
Overrides
internalGetFieldAccessorTable()
protected GeneratedMessageV3 . FieldAccessorTable internalGetFieldAccessorTable ()
Returns
Overrides
isInitialized()
public final boolean isInitialized ()
Returns
Overrides
newBuilderForType()
public HttpBody . Builder newBuilderForType ()
Returns
newBuilderForType(GeneratedMessageV3.BuilderParent parent)
protected HttpBody . Builder newBuilderForType ( GeneratedMessageV3 . BuilderParent parent )
Parameter
Returns
Overrides
newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
protected Object newInstance ( GeneratedMessageV3 . UnusedPrivateParameter unused )
Parameter
Returns
Overrides
toBuilder()
public HttpBody . Builder toBuilder ()
Returns
writeTo(CodedOutputStream output)
public void writeTo ( CodedOutputStream output )
Parameter
Overrides
Exceptions
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-21 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-21 UTC."],[],[]]