Retrieving a Reply
After an HTTP request is submitted, the server processes it and sends a response back to the client. Your application can retrieve the reply from the
RWHttpClient object using the
getReply() method:
RWHttpReply reply = client.getReply();
The
getReply() method returns an
RWHttpReply object. The
getReply() method blocks until the complete reply from the server is read.
RWHttpAgent combines the request and retrieval steps of
RWHttpClient into a single request as mentioned in
Sending a Request. Because the
RWHttpAgent request returns immediately with an
RWTIOUResult object, your application must ensure that the request is complete before attempting to access the results of the request:
RWHttpReply reply = replyIOU.redeem();
The
redeem() method of an
RWTIOUResult object blocks until the request is complete and the result is fully retrieved from the server. After the reply object is redeemed, the resulting reply is no different than one retrieved through an
RWHttpClient request.