Search in sources :

Example 1 with ResponseHandler

use of com.webpieces.http2engine.api.ResponseHandler in project webpieces by deanhiller.

the class Level8NotifyClntListeners method sendPushToApp.

public CompletableFuture<Void> sendPushToApp(ClientPushStream stream, Http2Push fullPromise) {
    ResponseHandler listener = stream.getOriginalResponseListener();
    PushStreamHandle pushHandle = listener.openPushStream();
    stream.setPushStreamHandle(pushHandle);
    return pushHandle.process(fullPromise).thenApply(l -> {
        stream.setPushPromiseListener(l);
        return null;
    });
}
Also used : ResponseHandler(com.webpieces.http2engine.api.ResponseHandler) PushStreamHandle(com.webpieces.http2engine.api.PushStreamHandle)

Example 2 with ResponseHandler

use of com.webpieces.http2engine.api.ResponseHandler in project webpieces by deanhiller.

the class Level8NotifyClntListeners method sendResponseToApp.

public CompletableFuture<Void> sendResponseToApp(Stream stream, Http2Response response) {
    if (stream instanceof ClientStream) {
        ClientStream str = (ClientStream) stream;
        ResponseHandler listener = str.getResponseListener();
        return listener.process(response).thenApply(w -> {
            str.setResponseWriter(w);
            return null;
        });
    }
    ClientPushStream str = (ClientPushStream) stream;
    PushPromiseListener pushListener = str.getPushPromiseListener();
    return pushListener.processPushResponse(response).thenApply(w -> {
        str.setPushResponseWriter(w);
        return null;
    });
}
Also used : PushPromiseListener(com.webpieces.http2engine.api.PushPromiseListener) ResponseHandler(com.webpieces.http2engine.api.ResponseHandler)

Example 3 with ResponseHandler

use of com.webpieces.http2engine.api.ResponseHandler in project webpieces by deanhiller.

the class Level8NotifyClntListeners method sendRstToApp.

@Override
public CompletableFuture<Void> sendRstToApp(Stream stream, CancelReason payload) {
    if (stream instanceof ClientStream) {
        ClientStream str = (ClientStream) stream;
        ResponseHandler handler = str.getResponseListener();
        return handler.cancel(payload);
    }
    ClientPushStream str = (ClientPushStream) stream;
    PushStreamHandle handle = str.getPushStreamHandle();
    return handle.cancelPush(payload);
}
Also used : ResponseHandler(com.webpieces.http2engine.api.ResponseHandler) PushStreamHandle(com.webpieces.http2engine.api.PushStreamHandle)

Aggregations

ResponseHandler (com.webpieces.http2engine.api.ResponseHandler)3 PushStreamHandle (com.webpieces.http2engine.api.PushStreamHandle)2 PushPromiseListener (com.webpieces.http2engine.api.PushPromiseListener)1