Package com.google.api
Class HttpBody
java.lang.Object
com.google.protobuf.AbstractMessageLite<MessageType,BuilderType>
com.google.protobuf.GeneratedMessageLite<HttpBody,HttpBody.Builder>
com.google.api.HttpBody
- All Implemented Interfaces:
HttpBodyOrBuilder,com.google.protobuf.MessageLite,com.google.protobuf.MessageLiteOrBuilder
public final class HttpBody
extends com.google.protobuf.GeneratedMessageLite<HttpBody,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-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMessage that represents an arbitrary HTTP body.Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageLite
com.google.protobuf.GeneratedMessageLite.DefaultInstanceBasedParser<T extends com.google.protobuf.GeneratedMessageLite<T,?>>, com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType, BuilderType>, BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType, BuilderType>>, com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType, BuilderType>, BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType, BuilderType>>, com.google.protobuf.GeneratedMessageLite.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType, BuilderType>, BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType, BuilderType>>, com.google.protobuf.GeneratedMessageLite.GeneratedExtension<ContainingType extends com.google.protobuf.MessageLite, Type extends Object>, com.google.protobuf.GeneratedMessageLite.MethodToInvoke, com.google.protobuf.GeneratedMessageLite.SerializedForm Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessageLite.InternalOneOfEnum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intFields inherited from class com.google.protobuf.GeneratedMessageLite
unknownFieldsFields inherited from class com.google.protobuf.AbstractMessageLite
memoizedHashCode -
Method Summary
Modifier and TypeMethodDescriptionprotected final ObjectdynamicMethod(com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1) The HTTP Content-Type header value specifying the content type of the body.com.google.protobuf.ByteStringThe HTTP Content-Type header value specifying the content type of the body.com.google.protobuf.ByteStringgetData()The HTTP request/response body as raw binary.static HttpBodycom.google.protobuf.AnygetExtensions(int index) Application specific response metadata.intApplication specific response metadata.List<com.google.protobuf.Any>Application specific response metadata.com.google.protobuf.AnyOrBuildergetExtensionsOrBuilder(int index) Application specific response metadata.List<? extends com.google.protobuf.AnyOrBuilder>Application specific response metadata.static HttpBody.Builderstatic HttpBody.BuildernewBuilder(HttpBody prototype) static HttpBodyparseDelimitedFrom(InputStream input) static HttpBodyparseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static HttpBodyparseFrom(byte[] data) static HttpBodyparseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static HttpBodyparseFrom(com.google.protobuf.ByteString data) static HttpBodyparseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static HttpBodyparseFrom(com.google.protobuf.CodedInputStream input) static HttpBodyparseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static HttpBodyparseFrom(InputStream input) static HttpBodyparseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static HttpBodyparseFrom(ByteBuffer data) static HttpBodyparseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static com.google.protobuf.Parser<HttpBody>parser()Methods inherited from class com.google.protobuf.GeneratedMessageLite
createBuilder, createBuilder, dynamicMethod, dynamicMethod, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, emptyProtobufList, equals, getDefaultInstanceForType, getParserForType, getSerializedSize, hashCode, isInitialized, isInitialized, makeImmutable, mergeLengthDelimitedField, mergeUnknownFields, mergeVarintField, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBuilderForType, newMessageInfo, newRepeatedGeneratedExtension, newSingularGeneratedExtension, parseDelimitedFrom, parseDelimitedFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parsePartialFrom, parseUnknownField, registerDefaultInstance, toBuilder, toString, writeToMethods inherited from class com.google.protobuf.AbstractMessageLite
addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType, isInitialized
-
Field Details
-
CONTENT_TYPE_FIELD_NUMBER
public static final int CONTENT_TYPE_FIELD_NUMBER- See Also:
-
DATA_FIELD_NUMBER
public static final int DATA_FIELD_NUMBER- See Also:
-
EXTENSIONS_FIELD_NUMBER
public static final int EXTENSIONS_FIELD_NUMBER- See Also:
-
-
Method Details
-
getContentType
The HTTP Content-Type header value specifying the content type of the body.
string content_type = 1 [json_name = "contentType"];- Specified by:
getContentTypein interfaceHttpBodyOrBuilder- Returns:
- The contentType.
-
getContentTypeBytes
public com.google.protobuf.ByteString getContentTypeBytes()The HTTP Content-Type header value specifying the content type of the body.
string content_type = 1 [json_name = "contentType"];- Specified by:
getContentTypeBytesin interfaceHttpBodyOrBuilder- Returns:
- The bytes for contentType.
-
getData
public com.google.protobuf.ByteString getData()The HTTP request/response body as raw binary.
bytes data = 2 [json_name = "data"];- Specified by:
getDatain interfaceHttpBodyOrBuilder- Returns:
- The data.
-
getExtensionsList
Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];- Specified by:
getExtensionsListin interfaceHttpBodyOrBuilder
-
getExtensionsOrBuilderList
Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"]; -
getExtensionsCount
public int getExtensionsCount()Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];- Specified by:
getExtensionsCountin interfaceHttpBodyOrBuilder
-
getExtensions
public com.google.protobuf.Any getExtensions(int index) Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];- Specified by:
getExtensionsin interfaceHttpBodyOrBuilder
-
getExtensionsOrBuilder
public com.google.protobuf.AnyOrBuilder getExtensionsOrBuilder(int index) Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"]; -
parseFrom
public static HttpBody parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static HttpBody parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static HttpBody parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static HttpBody parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static HttpBody parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static HttpBody parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
- Throws:
IOException
-
parseFrom
public static HttpBody parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseDelimitedFrom
- Throws:
IOException
-
parseDelimitedFrom
public static HttpBody parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseFrom
- Throws:
IOException
-
parseFrom
public static HttpBody parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
newBuilder
-
newBuilder
-
dynamicMethod
protected final Object dynamicMethod(com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1) - Specified by:
dynamicMethodin classcom.google.protobuf.GeneratedMessageLite<HttpBody,HttpBody.Builder>
-
getDefaultInstance
-
parser
-