message
including it's
headers
and optional
entity
, and
connections
over which messages are sent. In order to prepare messages before sending or after receiving, there are interceptors for
requests
and
responses
.
HttpEntity
An entity that can be sent or received with an HTTP message. Entities can be found in some requests
and in responses
, where they are optional.
In some places, the JavaDoc distinguishes three kinds of entities, depending on where their content
originates:
- streamed: The content is received from a stream, or generated on the fly. In particular, this category includes entities being received from a
connection
.Streamed
entities are generally notrepeatable
. - self-contained: The content is in memory or obtained by means that are independent from a connection or other entity. Self-contained entities are generally
repeatable
. - wrapping: The content is obtained from another entity.
public abstract InputStream getContent ()
Creates a new InputStream object of the entity. It is a programming error to return the same InputStream object more than once. Entities that are not repeatable
will throw an exception if this method is called multiple times.
public abstract boolean isRepeatable ()
Tells if the entity is capable to produce its data more than once. A repeatable entity's getContent() and writeTo(OutputStream) methods can be called more than once whereas a non-repeatable entity's can not.
public abstract void writeTo (OutputStream outstream)
Writes the entity content to the output stream.
HttpMessage
public abstract HttpEntity getEntity ()
Obtains the message entity of this response, if any. The entity is provided by calling setEntity
.
HttpClient
HttpGet
extends HttpRequestBaseThe HTTP GET method is defined in section 9.3 of RFC2616:
The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.
Get Methods will follow redirect requests from the http server by default. This behaviour can be disabled by calling setFollowRedirects(false).