public interface HttpClient
HTTP/1.1
, then
of course the same output and input stream can be re-used.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes any underlying sockets or streams.
|
OutputStream |
getOutputStream()
Returns a stream for writing data to, if data is to be sent to the
server.
|
ClientResponse |
readResponse()
Reads the response data from the HTTP server.
|
void |
writeRequest(ClientRequest request)
Sends the first part of a
Request message,
consisting of a request line and headers. |
void writeRequest(ClientRequest request) throws IOException
Request
message,
consisting of a request line and headers.
The message body may be sent in one of two ways:
DataPoster
in the client request
object.
getOutputStream()
.
IllegalHttpStateException
- if the request was already sent
and the response was not yet readIOException
OutputStream getOutputStream()
GET
, calling this
method of course makes little sense. Data must be sent if
content-length or transfer encoding headers were sent.
This stream should be wrapped to control output based on the
headers specified in the request.IllegalHttpStateException
- if the request was not yet sent
or the response was already read, data was sent with a
DataPoster, or this method was already called
ClientResponse readResponse() throws IOException
IllegalHttpStateException
- if the request was not yet sentHttpException
- if the server returned an invalid HTTP
responseIOException
void close() throws IOException
IOException
Copyright © 2013. All Rights Reserved.