Class EmptyContent
java.lang.Object
com.google.api.client.http.EmptyContent
- All Implemented Interfaces:
HttpContent, StreamingContent
Empty HTTP content of length zero just to force
HttpRequest.execute() to add the header
Content-Length: 0.
Note that there is no Content-Length header if the HTTP request content is
null . However, when making a request like PUT or POST without a Content-Length header,
some servers may respond with a 411 Length Required error. Specifying the
Content-Length: 0 header may work around that problem.
- Since:
- 1.11
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the content length or less than zero if not known.getType()Returns the content type ornullfor none.booleanReturns whether or not retry is supported on this content type.voidwriteTo(OutputStream out) Writes the byte content to the given output stream.
-
Constructor Details
-
EmptyContent
public EmptyContent()
-
-
Method Details
-
getLength
Description copied from interface:HttpContentReturns the content length or less than zero if not known.- Specified by:
getLengthin interfaceHttpContent- Throws:
IOException
-
getType
Description copied from interface:HttpContentReturns the content type ornullfor none.- Specified by:
getTypein interfaceHttpContent
-
writeTo
Description copied from interface:StreamingContentWrites the byte content to the given output stream.Implementations must not close the output stream, and instead should flush the output stream. Some callers may assume that the output stream has not been closed, and will fail to work if it has been closed.
- Specified by:
writeToin interfaceHttpContent- Specified by:
writeToin interfaceStreamingContent- Parameters:
out- output stream- Throws:
IOException
-
retrySupported
public boolean retrySupported()Description copied from interface:HttpContentReturns whether or not retry is supported on this content type.- Specified by:
retrySupportedin interfaceHttpContent
-