|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface HttpClient
Specifies methods for an HTTP client. Methods must be called in specific order for a successful HTTP exchange to take place. The order of calls that must be made:
If the HTTP server and client areHTTP/1.1
, then
of course the same output and input stream can be re-used.
Method Summary | |
---|---|
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. |
Method Detail |
---|
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 read
IOException
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 sent
HttpException
- if the server returned an invalid HTTP
response
IOException
void close() throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |