@Beta public class ProtoHttpContent extends AbstractHttpContent
Beta Sample usage:
static HttpRequest buildPostRequest(
HttpRequestFactory requestFactory, GenericUrl url, MessageLite message) throws IOException {
return requestFactory.buildPostRequest(url, new ProtoHttpContent(message));
}
Implementation is not thread-safe.
| Constructor and Description |
|---|
ProtoHttpContent(com.google.protobuf.MessageLite message) |
| Modifier and Type | Method and Description |
|---|---|
long |
getLength() |
com.google.protobuf.MessageLite |
getMessage()
Returns the message to serialize.
|
ProtoHttpContent |
setMediaType(HttpMediaType mediaType) |
ProtoHttpContent |
setType(String type)
Deprecated.
(scheduled to be removed in 1.16) Use
setMediaType(HttpMediaType) instead. |
void |
writeTo(OutputStream out) |
computeLength, computeLength, getCharset, getMediaType, getType, retrySupportedpublic ProtoHttpContent(com.google.protobuf.MessageLite message)
message - message to serializepublic long getLength()
throws IOException
getLength in interface HttpContentgetLength in class AbstractHttpContentIOExceptionpublic void writeTo(OutputStream out) throws IOException
IOException@Deprecated public ProtoHttpContent setType(String type)
setMediaType(HttpMediaType) instead.null for none.
Default value is ProtocolBuffers.CONTENT_TYPE.
public final com.google.protobuf.MessageLite getMessage()
public ProtoHttpContent setMediaType(HttpMediaType mediaType)
setMediaType in class AbstractHttpContentCopyright © 2011-2013 Google. All Rights Reserved.