Class AbstractHTTPClientStream
- All Implemented Interfaces:
 Closeable,AutoCloseable,HTTPClientStream,HTTPMessageStream
HTTPClientStream with several basic methods implemented.- Since:
 - 1.4.1
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final HTTPClientprotected Consumer<HTTPResponse>protected Consumer<HTTPResponseData>protected Consumer<HTTPMessageTrailers>protected Consumer<HTTPClientStream>protected HTTPResponseFields inherited from class org.omegazero.http.util.AbstractHTTPMessageStream
closed, onError, onWritable, request - 
Constructor Summary
ConstructorsConstructorDescriptionAbstractHTTPClientStream(HTTPRequest request, HTTPClient client) Creates a newAbstractHTTPClientStream. - 
Method Summary
Modifier and TypeMethodDescriptionvoidCalls theonResponseDatacallback.voidcallOnResponseEnded(HTTPMessageTrailers trailers) voidcallOnServerPush(HTTPClientStream reqstream) Calls theonServerPushcallback.Returns theHTTPClientthat created thisHTTPClientStream.Returns the received response of thisHTTPClientStream, ornullif no response was received yet.voidonResponse(Consumer<HTTPResponse> onResponse) Sets a callback that is called when thisHTTPClientStreamreceives a response.voidonResponseData(Consumer<HTTPResponseData> onResponseData) Sets a callback that is called when thisHTTPClientStreamreceives data for the response.voidonResponseEnded(Consumer<HTTPMessageTrailers> onResponseEnded) Sets a callback that is called when thisHTTPClientStreamhas finished receiving the response and data, including optional trailers.voidonServerPush(Consumer<HTTPClientStream> onServerPush) Sets a callback that is called when thisHTTPClientStreamreceives a pushed request.voidresponseReceived(HTTPResponse response) Calls theonResponsecallback and stores the response, ifHTTPResponse.isIntermediateMessage()isfalse.Methods inherited from class org.omegazero.http.util.AbstractHTTPMessageStream
callOnError, callOnWritable, getRequest, internalError, isClosed, onError, onWritableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.omegazero.http.util.HTTPClientStream
endRequest, sendRequestData, startRequestMethods inherited from interface org.omegazero.http.util.HTTPMessageStream
close, close, getRequest, isClosed, onError, onWritable, setReceiveData 
- 
Field Details
- 
client
 - 
response
 - 
onServerPush
 - 
onResponse
 - 
onResponseData
 - 
onResponseEnded
 
 - 
 - 
Constructor Details
- 
AbstractHTTPClientStream
Creates a newAbstractHTTPClientStream.- Parameters:
 request- The requestclient- The client
 
 - 
 - 
Method Details
- 
callOnServerPush
Calls theonServerPushcallback.- Parameters:
 reqstream- The pushed response stream
 - 
responseReceived
Calls theonResponsecallback and stores the response, ifHTTPResponse.isIntermediateMessage()isfalse.- Parameters:
 response- The response
 - 
callOnResponseData
Calls theonResponseDatacallback.- Parameters:
 data- The object to pass to the callback
 - 
callOnResponseEnded
- Parameters:
 trailers- Optional trailers to pass to the callback
 - 
getClient
Description copied from interface:HTTPClientStreamReturns theHTTPClientthat created thisHTTPClientStream.- Specified by:
 getClientin interfaceHTTPClientStream- Returns:
 - The 
HTTPClient 
 - 
getResponse
Description copied from interface:HTTPClientStreamReturns the received response of thisHTTPClientStream, ornullif no response was received yet.- Specified by:
 getResponsein interfaceHTTPClientStream- Returns:
 - The response
 
 - 
onServerPush
Description copied from interface:HTTPClientStreamSets a callback that is called when thisHTTPClientStreamreceives a pushed request.This callback is always called before the
onResponsecallback. If the underlying protocol does not support server push, this callback is never called.The new
HTTPClientStreampassed to the callback is used to receive the pushed response. The methodsHTTPClientStream.startRequest(),HTTPClientStream.sendRequestData(byte[], boolean), andHTTPClientStream.endRequest(HTTPMessageTrailers)should not be called on thisHTTPClientStream. TheonResponsecallback will be called as soon as the pushed response is received.- Specified by:
 onServerPushin interfaceHTTPClientStream- Parameters:
 onServerPush- The callback
 - 
onResponse
Description copied from interface:HTTPClientStreamSets a callback that is called when thisHTTPClientStreamreceives a response.No other callbacks in this
HTTPClientStreamare called before the given callback has returned.This callback may be called multiple times when receiving multiple responses (for example, a 102 Processing followed by the actual response, see also:
HTTPResponse.isIntermediateMessage()).- Specified by:
 onResponsein interfaceHTTPClientStream- Parameters:
 onResponse- The callback
 - 
onResponseData
Description copied from interface:HTTPClientStreamSets a callback that is called when thisHTTPClientStreamreceives data for the response.If
HTTPMessageData.isLastPacket()istruefor aHTTPResponseDataobject passed to the callback, it is followed by aonResponseEndedcallback.- Specified by:
 onResponseDatain interfaceHTTPClientStream- Parameters:
 onResponseData- The callback
 - 
onResponseEnded
Description copied from interface:HTTPClientStreamSets a callback that is called when thisHTTPClientStreamhas finished receiving the response and data, including optional trailers.If this callback is called, this
HTTPClientStreamis implicitly closed and no further callbacks will be called.- Specified by:
 onResponseEndedin interfaceHTTPClientStream- Parameters:
 onResponseEnded- The callback
 
 -